Flashing a Turnigy 9x with an Arduino

Don't you think those programmable transmitters are really expensive ? Well here is one solution to this problem : If you already have an Arduino, some wire, a soldering iron and a litle bit of dexterity, you can have a complete, highly customizable transmitter !

Indeed, some awesome guys made new firmwares for the "well known" Turnigy 9x (a low cost 9 channels transmitter, about $60). Even better, those projects are opensource and free. What else ? Ok lets start this little hack.

Turnigy 9x

There are numerous projects (TH9X, ER9X, GRUVIN9X, ERSKY9X,..) and the choice is up to you. I personnaly used Open9X because it seems to be the better easy-to-use/fonctiunalities ratio. But before talking about software, lets discuss the hardware. The problem is, how to send the new firmware to the radio ? Actually this is where you'll need to solder a little. It can be pretty scary, but it's not that hard if you have a good iron ;-).

Lets add a programming port to your 9X !

[important]If you purchased a "9XR" version, there is no need to to this hack since it's already done in factory ![/important]

The Freshly bought Turnigy 9X

Ok you said goodbye to your beloved radio ? Let's unscrew it ! Note that on mine the screws were really hard to unscrew, and I had unfortunately to destroy one of them. Once i'ts open, you'll first be like "WTF am I doing?". Actually, it's pretty simple. First thing you have to do is disconnect the connector that goes from the front part to the back part. After this you'll be able to separate them. On the front part, locate a "big" chip. It's the heart of this radio, the ATMEGA64. Pretty simple stuff, actually. It will be easy to reflash thanks to the AVR isp (In-System Programming) protocole. You'll just have to add the wire to be able to use that protocole.

Atmega64, heart of the system

You'll need 6 wires for the isp protocole :

  1. MISO (Master In Slave Out) known as PDO (Program Data Out) on the chip
  2. Vcc (5v)
  3. SCK (clock signal)
  4. MOSI (Master Out Slave In) known as PDI (Program Data In) on the chip
  5. RST (Reset)
  6. GND

You can figure out by yourself were you should solder those signals reading the ATMEGA64 datasheet (pin n° 2,3,11,20,21/52, 22/53) but I'll give you a simpler way to solder it : Actually the designer of this board were cool guys, the little pads you can see can be easilly used as entry point to solder your own wires.2013-01-01 16.40.50+annots

Pretty easy, isn't it ? I strongly recommend you to make an interface to the outside of the radio because there are several softwares that allow you to customize your model on your computer and then transfert the result in the radio memory, using this protocole. I personnaly used a DB9 connector. but you can use whatever you want (it must have at least 6 connections). The better place to put this connector is under the radio so your hands won't be disturbed.

2013-01-01 17.08.29

2013-01-01 16.41.06

Ok you can now close your radio (don't forget to plug the 12 wires connector). Try to turn on your radio. If it works, lets go to the next step!

Turn your arduino into a AVR programmer

From here, you can use every AVR programmer you want that is compatible with AVRDude (that is, almost every programmer, actually). But I hadn't one and I knew that the Arduino could be used as one. Here is basically the schematics you want (leds are optionnal but strongly recommended. Also, the PCB should not be really hard to design and make).

Untitled Sketch_bb_corr_1.01

Note that the reset is tied to Vcc to prevent reset when connecting the Arduino.

Double-check your connections between the ISP and the ATMEGA64, if you don't want to buy another 9X 🙂

The Scketch to upload to the Arduino is located under the examples as "ArduinoISP". This is actually an implementation of a subset of the "STK500" protocole  (learn more here), and therefore you'll be able to use it with Avrdude (which is nice because that's what we need to easilly flash our 9x !).

Pin assigment is given in the sketch :

// pin name:     not-mega : mega(1280 and 2560)</div>
// slave reset: 10        : 53</div>
// MOSI:        11        : 51</div>
// MISO:        12        : 50</div>
// SCK:         13        : 52</div>

[notice]

Because of the ATMEGA64 EEPROM address managment, you have to make 2 modifications : when reading the EEPROM and writing the EEPROM : the code looks like it :


uint8_t write_eeprom(int length) {
// here is a word address, get the byte address
int start = here * 2;

and


char eeprom_read_page(int length) {
// here again we have a word address
int start = here * 2;

You have to delete the "*2" since the address is already a byte in the ATMEGA64.

[/notice]

The Firmware

Just install the Companion9X software that will do everything for you. Just change your programmer option under Burn/Configure... and enter the following :

conf_avrdude

(The Port is the port representing your Arduino)

Ok, time to flash ! You can download whatever version you want and try all those wonderfull firmwares !

2013-01-02 15.49.34

2013-01-02 15.51.34

I hope this little tutorial has been usefull for you 🙂 Stay tuned !