FlySky/Turnigy 9X Protocol - Page 7 - RC Groups
Thread Tools
Jan 02, 2013, 03:46 AM
Registered User
Originally Posted by dave1993
if im not mistaken isnt that a v1 which is incompatible with the current hopping protocol?
On the picture, it's the v1. I have the v2. I don't know about current hoppong protocole.
Sign up now
to remove ads between posts
Jan 02, 2013, 05:26 PM
Registered User
Nice job catching rx spi dialog Surfbreizh!

But I can't understand how it works because mc (=microcontroller) never test a flag or something like that to know if RX packed arrived while repeating sequence:

A -> go in standby mode
F -> reset fifo read
0F xx -> choose channel xx
C -> goes in RX mode

Then you switch on TX and mc send "40" to check "Mode Register" flag !
How did mc knows TX was switched on?
Is there an other hardware link than spi (i mean gpio1 or 2 as exemple) between A7105 and mc?
Jan 02, 2013, 05:41 PM
Registered User
ok reading A7105 datasheet I saw that gio1 or gio2 give rx status (valid packet received). Sorry for bothering you...
Jan 02, 2013, 06:44 PM
RC beginner
Originally Posted by Surfbreizh
On the picture, it's the v1. I have the v2.
ahhh yes. your photo made no sense. my 1st 9x was v1 and, having purchased several of the v1 rx, was very upset when they became obsolete. i did eventually replace the rf board with v2 and bought many more rx which were $3 and change then. now they are much more expensive ($9-$10) so i was a little disappoint about that. but we can make out own real cheap now so im happy again.

btw you dont need the 4th gio1 wire. 5th bit, crcf, in the status reg also tells when a packet is ready. i tried this with one of my early units in order to get 3ch with tiny13. only 6 io. but i can say now using gio1 is much better due to superior timing. if you can afford the extra bit that is.
Jan 04, 2013, 10:49 AM
Registered User
Thanks Thierry for the information, I didn't know it.

I haven't go through all SPI dialog so I do not what going all yet. I have also caught GIO1. I have not so much time right now to analyse all of it. First, I will categorize all data file then feel free to ask me the file.

What about "choose channel xx"? Why does it always change?
Jan 04, 2013, 04:33 PM
Registered User
Component are on the pcb (I made a small mistake about module width but managed to sold it anyway, so wait for "errata" if you want to do this pcb).
I have started coding pic18f14k22.
Dialog with A7105 is ok but haven't yet received a rx packet...
Still working on it...

btw, strobe command (spi bus) should be "8A", "8F", ... instead of "A","F" !?
you can read in A7105 datasheet page 31:
Address byte:
Bit 7: Command bit
[0]: Control registers.
[1]: Strobe command.
Jan 06, 2013, 03:55 PM
Registered User
The strobe command is only 4 bit, so "A", "F" is correct.
I checked on my Turnigy 9x v2 receiver and it is the same.
I've compared the initialization section and it is identical.

The data packet is:
45 55 26 C2 02 00 DA 05 D9 05 2F 04 E4 05 30 04 30 04 3F 04 3E 04

This means:
45 - sent from mcu: read FIFO
55 26 C2 02 - ID of the transmitter
00 - i'm not sure what this means
DA 05 - channel 1
D9 05 - channel 2
2F 04 - channel 3
E4 05 - channel 4
30 04 - channel 5
30 04 - channel 6
3F 04 - channel 7
3E 04 - channel 8

If you convert the values to decimal you get the duration in ms for the output pulse for each channel.

The GIO1 pin is configured as WTR and seems to be connected to the 4th pin of the MCU, altough i cannot see the trace on pcb. Could be an inner layer perhaps.
Jan 07, 2013, 06:45 AM
RC beginner
welcome to rcgroups cristi,

you are off by one byte. 55 is sync, id is 26 C2 02 00, rest is channels. i notice all 9x id so far ends in 00. v911, v929, v939, do not. not sure if this is consistant.
Jan 08, 2013, 12:31 AM
Registered User
Thank you Dave!

That makes sense. I suppose the last byte of the id could be used as a manufacturer id to assure they don't overlap.
Jan 12, 2013, 06:45 AM
Registered User
Thanks CristiV !
I realised that I misunderstood 7105 datasheet even if it was clearly explained (p33)...
I send 0xA0, 0xF0, ... (don't want to code for a specific 4 bit spi procedure for strobe commands) and it works fine.
I received my first data packets and I started to code ppm in order to be able to test it soon in an indoor model...
Jan 16, 2013, 05:46 PM
Registered User
that's it ! The receiver works quite well.

I decided to use internal oscillator that is in fact very accurate (I setup an interruption at 100hz to toggle an output pin and measured 100,00Hz with a frequency meter!). Of course it may shift with temperature...

The receiver can manage 6 servos. It is not so light (5gram) with standard servo connectors... but I planed to do a smaller version with smaller pic: pic16F1503 (14pin, 150mil wide, 1.27 pitch).

Servo pulse are done with an interruption procedure using 2 timers (one starts pulse sequence every 20ms, the other one counts pulse duration) and 2 indirect registers.
Quite a short interruption procedure (about 50 assembler instructions) but very accurate with 1 micro sec resolution.

When switch on the RX tries to bind with TX for 2.5s (led flashing at 12hz), if TX not found, then it uses previous TX id that was recorded (last successfull bind) in pic eeprom. then It follows hopping sequence (associated to TX id). Led is on when rx is ok, off if not...

Take a look at the program, I tried to put many comments in english.
(sorry for the english I'am french...)

things to take care if you want to develop your hown RX code with this protocol:

you have to substract one from all channels sequence number.
I mean, as an exemple, for binding procedure, RX listen on channel 0 (and not 1)
So I just decrement channel number after reading the table that contains channel sequence...

wait a few millisec after switch on to let the A7105 wake up !!!
everything worked with debugger and nothing worked with release version (?)
I spend an evening on that trouble and then realised that the only difference was that debugger was doing a soft reset (A7105 was allready on) ...

I can do a special software version for you, with ppm in place of servo6 output ?

you can download files at:

ok it's late, I need sleep...
Jan 16, 2013, 06:52 PM
RC beginner
congratulations thierry. amazing accomplishment. it took me 10x longer and my program is much more complicated. i also had trouble with the numbering method for channels. apparently it was decided to number them one more like they do with rc channels. they say "one is the loneliest number" but zero must be even more depressing so they decide to ignore it. lol!

i found your program very easy to follow and understand. i dont comment mine in any language let alone english so cant understand a thing the next day. shame on me.

thanks for posting the details. i got some 18f14k22 from digikey. its a great chip but unfortunately my programmer is obsolete and dont support it. i wish i could find a simple description of the algorithm so i could build a diy burner. meanwhile i got a unit on the way from china but that will take a while. good work.
Jan 17, 2013, 01:38 AM
Registered User
slebetman's Avatar
Originally Posted by ThierryRC
Servo pulse are done with an interruption procedure using 2 timers (one starts pulse sequence every 20ms, the other one counts pulse duration) and 2 indirect registers.
Quite a short interruption procedure (about 50 assembler instructions) but very accurate with 1 micro sec resolution.
That's the one thing I love about the PIC. They suck at a lot of things but when it comes to timing I've found few things are as deterministic, accurate and dependable as PICs. And it does all that with fairly simple and small amount of code.
Jan 17, 2013, 07:15 AM
Registered User
thanks Dave!

I forgot to say that you need to cut (or bend) pin16 of pic before soldering...
because to simplify trace I decided to run MCLR through pin16 (RC0) but it was not a really good idea because when programming MCLR goes 12V and then "clamping diode" of RC0 pin short-circuits to vdd (3 volts) ! I was lucky not to damage pic or pickit3 programmer.

You need a pickit3 programmer/debugger or china clone (half price, about 15$) like the one Dave ordered. It is worth buying it rather than making it because it is not as simple as an AVR/atmel programmer that is basically an usb/rs232 link... unless you are a real DIY fan !

You also need to download free MPLAB 8.xx IDE. I also tried cross platform MPLABX IDE but had some issue with debugging: "run to cursor" function does not work (or perhaps I don't know how to make it works).
Jan 17, 2013, 01:05 PM
RC beginner
thanks for the tools info. im not sure what version of mplab i got now but probably as out of date as my programmer was. ill update if i get into the nitty gritty. for now your hex file will allow me to play with the hardware which is my main interest atm. hopefully your schematic is ok because, lacking patience needed for pcbs, im gonna try deadbug first. speaking of which i was inspired by your success to give my dead avr deadbug another try. good thing because i found the problem and so have finally posted pics of it in my flysky rx thread.

sman, i can tell you have experience with more than one mcu family because you hit the nail on the head about pic timing. very predictable, unlike avr where you simply cannot predict interrupt latency. only way is to int from sleep which can be tricky. but i gotta say pic programming algorithms are a real pain though. that 12v is not universal for all devices. if only they standardized on a voltage or protocol. seems like you have to buy a new programmer every time a chip is released. thats where avr leads the pack. virtually identical across the board and no more than 3 signals from a pc port to do the trick. no dongles needed at all.

Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Question 9X - FlySky/iMax/Turnigy/Eurgle FOR DUMMIES aeajr Radios 1425 May 11, 2017 03:45 AM
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