Thread Tools
Feb 02, 2013, 09:14 AM
Registered User
midelic's Avatar
From what I see on A7105 data, SCS pin should be low all the time for accessing SPI.
Is it not better to connect SCS pin to the the ground?
Or it needs to be toggled hi and low every transmitting data time to the A7105.I think I got the answer myself.
Last edited by midelic; Feb 02, 2013 at 10:32 AM.
Sign up now
to remove ads between posts
Feb 02, 2013, 03:49 PM
Registered User
Yes, SCS pin needs to be toggle to start and end SPI dialog.
For example, when you write TX packet (write to A7105 TX FIFO) A7105 chip doesn't know how many bytes you want to write so you have to toggle hi SCS at the end.

In flysky protocol, RX never transmit his ID number to TX.
btw, RX transmit nothing, that's why, as Dave pointed out, RX rfo pin is not connected. (in my RX there is a "A7105 transceiver module" so both rfi and rfo pin are connected, and that's why it could be converted into a TX)

So you are right to be perplex with the code: changing RX id number is not useful and you can remove this code.
In fact, I have done that first to test spi dialog with A7105: writing and reading ID number, then I removed ID reading code but let ID writing code...
Feb 02, 2013, 05:23 PM
Registered User
midelic's Avatar
Yes ,but is useful to clarify some things.Honestly at the moment I'm more interested in TX protocol coding.In fact I'm trying to write some tx code in avr assembler.I plan to build a tx module myself,hope this plan is not too ambitious.I have some code for ID transmitting in avr and I don't know if is good or not.I'm not very familiar with opcode sequencial write in avr assembler.Any help will be appreciated.
LDI A,0x06;send to adress 0x06, 32 bits 0x5475c52a
RCALL SPI_MasterTransmit
LDI A,0x54
RCALL SPI_MasterTransmit
LDI A,0x75
RCALL SPI_MasterTransmit
LDI A,0xc5
RCALL SPI_MasterTransmit
LDI A,0x2a
RCALL SPI_MasterTransmit
Last edited by midelic; Feb 02, 2013 at 05:30 PM.
Feb 03, 2013, 11:53 AM
Registered User
midelic's Avatar
I see in A7105 data sheet calibration procedure and State Machine,.... "CAL",........ that VCO bank calibration starts in PLL mode.
I think for that should be issued a strobe PLL command first.For that A7105 should be set in PLL mode....strobe 0xb.I don't see any.
VCO current and IF filter calibration can be in both modes(Standby and PLL) so no problem.

How did you program(if so?) SPI data latching betwen SDIO and SCK?There is minimum 50 ns between hod time and setup time between SCK and SDIO.

Another thing, FIFO Pointer Reset strobe 4bits 0x0e......... not 0xe0.
Last edited by midelic; Feb 03, 2013 at 01:31 PM.
Feb 03, 2013, 03:11 PM
Registered User
SPI latching is not necessary because pic run at 4mhz instruction cycle(with 16mhz clock) so there is a minimum of 250ns between clock rise/fall and sdio test or set (> 50ns)

There are some errors in "flysky.txt". As example, there is 21 bytes (not 22) of data per packet : first byte "0x05" is not a data packet but FIFO adress register
These errors does not exist in "flysky.c" files ! so you also have to check with ".c" file

Well, I also work on TX for fun: everything seems ok but it is not binding with rx... I'am try to find the bug...
Feb 03, 2013, 03:31 PM
Registered User
midelic's Avatar
If you finished your tx code can you upload it on your site?I'll try to translate to avr assembler.Now I understand it better also I can read easier your pic assembler.

I have some problem understanding Easy FIFO transmitting.It says for example for 16bytes of data set FEP control register to 0x0f.And for 32 bytes ...set FEP to 0x1f.We have 21 bytes of data.How you program this one for 21Bytes?
Feb 04, 2013, 03:28 AM
Registered User
I'll update "my site" as soon as it works...

I think FEP is just a maximum number of byte in FIFO before reading/sending. You don't need to fill FIFO till maximum before reading/sending data. So FEP need to be 32 or more for 21 bytes data packet...

btw, I think A7105 never get in PLL mode... A7105 works in what they call in datasheet "normal fifo mode" switching between "standby mode" (update registers and fill/read fifo) and "TX/RX mode" (when you issue a TX/RX strobe command to send/receive rf data and then switch back to standby mode automatically after that)
Feb 04, 2013, 03:35 AM
Registered User
well, in fact A7105 gets in "PLL mode" but you don't have to take care about that:
it is done automatically and temporary (to set rf frequency corresponding to channe I think) when you issue a RX/TX strobe command
Feb 04, 2013, 07:14 AM
RC beginner
Originally Posted by ThierryRC View Post
btw, I think A7105 never get in PLL mode... A7105 works in what they call in datasheet "normal fifo mode" switching between "standby mode" (update registers and fill/read fifo) and "TX/RX mode" (when you issue a TX/RX strobe command to send/receive rf data and then switch back to standby mode automatically after that)
if im not mistaken it returns to whatever mode was set prior to rx/tx. in mine (and pb too afaik) that is pll mode. it draws more current than returning to standby mode but allows faster bit sync. similar to cc2500 (frsky), rfm22b (silabs/olrs), 24l01 (old walkera?), etc where re-aquisition can take a while. in fact impossible to implement frsky protocol w/o those kind of tricks.
Feb 04, 2013, 08:26 AM
Registered User
I may be wrong, but I understood from datasheet that:

If you don't change channel going from stanby into RX state takes 130us (about 10% of 1.46ms rx period) while it takes 70us (about 5% of rx period) to go from PLL to RX state.

If you change channel each time(and that's what we do except for binding) latency is the same in both mode (130us).

A7105 draws about 9mA average in "normal mode" and about 12mA in "PLL mode" with flysky protocol (1.46ms period, A7105 spend about half time in RX or TX mode according to gio signal)

If that's right, there is not a big difference between these two modes both in terms of time and current for flysky protocol.
Last edited by ThierryRC; Feb 04, 2013 at 08:31 AM.
Feb 04, 2013, 09:15 AM
RC beginner
if bulding a tx, specially with display etc like 9x, current is not that important. but for rx in a glider the difference could be between 9 minutes and 12 minutes which is significant. even for me and the tiny planes i like to build a few extra ma can help.

as far as lock time you are right. using interrupts there is more than enough time to do almost anything between packets. however for bit-bangers like me every microsecond counts. for example it is simply not an option, even with interrupts, for the frsky protocol which is right on the edge with a slow poke mcu like avr. anyway i have a strong dislike using things like interrupts and hardware timers if the job can be done with inline code. working with so many different processors portabilty is a big deal for me.
Feb 04, 2013, 11:16 AM
Registered User
midelic's Avatar
I don't know if I understand correctly the packet data sent to TX FIFO register(0x05)-A7105 data sheet.I try to clarify some things.
1....4 bytes preamble =to adress 0x05 0xaaaaaaaa....1010101...10 in sequence.Replaced for 2 bytes with 0xaa wait 3 s and after 0x55?
2....4 bytes ID code=0x5475c52a ??Only ID is sent in litle endian or all data?This is the ID code sent previously to ID register.?????
3...16 bytes payload data.????
4...2 bytes CRC data-optional??
total data is 22 bytes(why 21)??It is not very clear.I see in Flysky description preamble is only 2bytes(word 1) ?
Another one ,I see ID is sent in ID register and also in each frame packet in Tx FIFO register.

For the TX build I think it is not necessary all table channels data(is more needed for RX build).You can chose only one ID and build the packet with this one.

Originally Posted by ThierryRC View Post
The 4 least significant bit of TX id gives line number of "sequence table".
As example TX id of my mini quadcopter (H36 vitality) is 30 00 00 06 so channel sequence is the 7th line of sequence table (first line number is 00).
TX sends a new packet (contains TX id, and servos position) every 1,46ms.
Last edited by midelic; Feb 05, 2013 at 07:12 AM.
Feb 05, 2013, 04:12 AM
Registered User
I think you don't really have to take care of preamble and A7105 ID code
they are automatically added before payload.
you just have to take care of payload (21 bytes = AAor55 + 4 bytes TX ID +2 bytes x 8 channels)

As you see there are in fact 2 IDs transmitted !!! A7501 ID (that is added automatically before payload) and TX ID that belongs to payload (flysky protocol)

I don't know if A7105 ID value is of importance, but you can freely read or write to it...
Feb 05, 2013, 05:21 AM
Registered User
midelic's Avatar
So if all others is automatically loaded we need to write code only for those 21 bytes data frame.???
What is the second ID?where this ID is coming from?Is it invented?I know that can be captured from one of your tx.....but I wonder if can be randomly generated.So which TX ID I can use?In the protocol are mentioned 16 channels rows so 16 ID's.
About the code preamble is to much coincidence that in place of 4 bytes 0xaa or 0x55(it depends on the first bit of ID code) we have only the first byte.
Last edited by midelic; Feb 05, 2013 at 07:07 AM.
Feb 05, 2013, 08:02 AM
Registered User
yes I think you only need to write 21 bytes of load.

It looks like only "4 less significant bits" of "4 bytes TX ID" is of importance to choose frequency hopping sequence.

In "frequency shift" (FSK) radio transmission (I am not talking about frequency hopping, but about frequency modulation to code 2 levels: 0 bits ans 1 bits) alternate betwenn 0bits and 1bits helps receiver to synchronise... so you often see in "preamble " transmission numbers like 0xAA... and 0x55... (=01010101)

that's why, I think designers of flysky protocol added 1 byte = 0xAA or 0x55 at the beginning of payload, perhaps to strengthen radio transmission...
despite the fact that 4 bytes of AA or 55 have been allready added automatically by A7105 in preamble.

In datasheet you can read (page65):
Recommend to set ID Byte0 = 5xh or Axh
even for A7105 ID it is recommended to use A or 5 values...

btw at the same line you read:
If RX circuitry checks the ID code correct, received payload will be stored into RX FIFO

so it looks like A7105 ID (register x06, not TX ID) is also important...
perhaps that's why my homemade TX is not binding with my quadcopter...
Last edited by ThierryRC; Feb 05, 2013 at 08:11 AM.

Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Question 9X - FlySky/iMax/Turnigy/Eurgle FOR DUMMIES aeajr Radios 1422 Mar 26, 2017 07:23 PM
Discussion Benefits of buying FlySky TH9x (v2) over Turnigy 9x (v2) wwfisher Radios 111 Jun 26, 2016 02:16 PM
Found turnigy 9x/flysky 9x wanted!!! kremecheze Aircraft - General - Radio Equipment (FS/W) 2 Mar 25, 2012 04:04 PM
Wanted ER9x or Turnigy/Flysky 9x daign FPV Equipment (FS/W) 0 Mar 22, 2012 06:21 PM
Found Turnigy/FlySky/Eurkle/etc 9X Shell flyandi Aircraft - General - Radio Equipment (FS/W) 0 Mar 11, 2012 06:12 PM