RCTimer/Turnigy/Hobbywing ESC DIY Firmware Flashing

Thanks to the help of timecop (yes he can be nice as long as he is interested ) I managed to flash my RCTimer 10A and 30A ESC. The procedure should be the exact same for the 18A and 20A versions. I will have some of these ESC in a few days and will test. Only difference can be the programming pads order, we will get into that.

Also note that the procedure is most likely the same for the Turnigy Plush if they have the same chip and pads. Check it all with a multimeter before hand! More and more ESC have their pinouts posted in this topic and I will update the initial post with them.

Another note. timecop and I also had some RCT 10A that went poof after the reflash. Problem is discussed in the thread, don't really know if it has been fixed...

Check this list made by TomSn0w of all compatible ESCs with their specs and appropriate firmware file. Thanks a lot for this!

- An AVR USB programmer. I am using USBASP from Protostack. It is the exact same kind of programmer used when flashing a Turnigy 9X.
- A way to connect temporarily the programming pads of the ESC to the AVR programmer.

- The hex file for the firmware (.hex is the compiled firmware, you can compile your own if you want to as well):

1- Go there: https://github.com/sim-/tgy
2- Hit the download button on the top right
3- Right click and save as the tgy.hex file from the bottom on the popup. There are newer versions posted from time to time. I used the tgy.hex one, but newer ones could be better! [EDIT: tgy.hex is good for the rctimer ESC and other very classic hw copies with no external oscillator. Depending on your ESC you might want to ask in this thread if you are better off using another compiled .hex. nfet and bfet stuff is getting too technical for me still ^^]

- AVRDUDE or AVRStudio or what ever software you want to use to actually flash the firmware.

-ALTERNATE: Use the tool posted in this thread coded by catch15117, thanks a lot for this! (not really up to date)

-ALTERNATE2: Another tool posted in this thread by LazyZero, thanks a lot!

2- Step by Step:

- Identify the pads:

This is what my RCTimer 10A ESC looks like, the 30A one is pretty much the same, just bigger.

You can see the 6 programming pads on the bottom of the board in the flash of light

They are in this order, from left to right: RESET, VCC, GND, SCLK, MISO, MOSI

Looking at the RCTimer 30A ESC from the top you will see the same 6 pads, but the order is reversed it is from left to right: MOSI, MISO, SCLK, GND, VCC, RESET

ALWAYS double check with a multimeter in continuity check mode that each pad goes to the right "leg" of the Atmega8. You can look in the datasheet at the MLF top view on page 2 to know what pin is what. Note the round mark for chip orientation. Thanks to timecop, here is one all marked up!

If you post a new ESC picture with pins marked, please attach it to your post so that by looking at attachments in the thread I can find them faster and keep it updated. Thanks everyone!

Turnigy/Hobbywing 6A:

Turnigy 12A plush (tested by JussiH and works on tgy.hex) Thanks JussiH for the picture.

Turnigy/Hobbywing 25A:

Turnigy Red Brick 25A:

Thanks to pia32.

Mystery FM30A:

Thanks to flashervn for this one.

Mystery/HK blue series 12A:

Thanks to tomk7 for this one!

Mystery/HK blue series 20A:

Mystery/HK blue series 30A:

Thanks to bas10an for those! Second HK Blue series 20A is thanks to larsm!

HK blue series 40A:

eRC 45A:

Thanks to SeismicWave for these ones!

Red Brick 25A, thanks to pia32 for the picture. Flashed with tgy.hex

HobbyKing F-20A:

Thanks to adlerbak!

HobbyKing F-30A:

Thanks to finkbuilt!

HobbyKing F-60A:

Thanks to SeismicWave

DYS 30A:

Thanks to Dolby for these pics!

RCTimer 40A:

Thanks to adlerbak

HobbyKing SS non programable 30A:

Thanks to capt

- Connecting to the AVR programmer:

Here is how I did mine:

Simple headers for the connections to the AVR programmer. I used single strain wires from Radio Shack, but any kind of wires will do, just solder the metal part of a male header pin at the end so you have something stiff. A nice solder blob on twisted wires could do as well, but may make lining up very tricky, just find your way!

To hold the wires in place together I just used a big blob of hotglue. Also note that you WILL WANT to make those wires much longer than I did, no big deal but more length would have helped. Close up of my artistic work:

You can always solder the wires to the pads, but when you have 4+ ESC to do it is a pain!

This is how jonnyc67 did it:

You can find more info on this setup with pogo pins in his post in this topic.

Simonk also has a similar method using long board to board headers. More info and info in this post

- Getting the right software:

I got this link from timecop, never heard of that project but it is supposed to be the most up to date one: https://github.com/sim-/tgy. So hit download on the top right, and right click save as the tgy.hex file. This is the new firmware file. Thanks a lot to simonk for writing this! There could be newer versions of the compiled firmware (.hex files). [EDIT: tgy.hex is good for the rctimer ESC and other very classic hw copies with no external oscillator. Depending on your ESC you might want to ask in this thread if you are better off using another compiled .hex. nfet and bfet stuff is getting too technical for me still ^^]

I am using a command line software to program AVR stuff but I heard AVR Studio is a really nice GUI. I am on Mac OS X but AVRDUDE is multi platform, so I will base this howto on it.

Linux peeps, well you know what to do, go get the AVRDUDE sources and compile them This is how I installed it on OS X btw.

- Flashing:

The meat of things! Open up your terminal/cmd line client and navigate to the folder where you downloaded tgy.hex

Plug in your AVR Programmer into USB and now be VERY careful and press the stiff end of your wires onto the pins and keep em pressed down. This is where you will need a steady helping hand or some sort of plastic grips, vice, whatever, just find a way to keep those pins lined up and contacting the pads. If you are lined up right you will hear the initial beeps and then continuous beeping.

Now here are the AVRDUDE commands that need to be issued in the terminal while everything is connected. Quick rundown on the arguments. "-p m8" says that my chip is an Atmega8, "-c usbasp" is the programmer name, type "avrdude -c asdf" to have the list of the compatible programmers.

Code:

avrdude -c usbasp -p m8 -U flash:w:tgy.hex

You should get this readout in the terminal, disregard the sck warning, no idea what that is lol

Nice one Nek I may just have to give this a go - I've got 6 30A rctimer esc's, 6 20A esc's & 6 18A esc's to do for current projects - guess I'm going to make up something with pogo pins as I'll have a few to do..

Nice one Nek I may just have to give this a go - I've got 6 30A rctimer esc's, 6 20A esc's & 6 18A esc's to do for current projects - guess I'm going to make up something with pogo pins as I'll have a few to do..

Good stuff!!! Try it on just enough to have a flying machine and see how you like it first. I haven't flown the firmware enough to have everyone commit, there is NO turning back

If it's similar to quax's old firmware, it seems to give fast pwm/better throttle response (as it cuts out some software filtering)than the standard firmware, provides better step resolution & removes any low battery cut off functionality. removes any card programmability though. I think it also hard sets the pwm response from 1000-2000 so you can't program for individual tx throttle endpoints... I'm sure TC will chip in at some pint to confirm/deny this

This tree is my attempt to simplify and improve quax' original code, and make it support multiple boards. There are some feature improvements now, and I've been hacking on it fairly heavily over the last month. See the commit history and README and stuff on github at https://github.com/sim-/tgy and https://github.com/sim-/tgy/commits/master/ . Some people have sent me motors and boards to test/fix weird corner cases, so hopefully it will turn into something that works well for everybody.

The main thing that pissed me off enough to start hacking on it was the 8kHz PWM frequency that Turnigy Plush boards were stuck with (causing the annoying audible whine), the clicking with lower kV motors, the screaming instead of proper restart if the motor is stopped while running, and the averaged throttle response instead of immediate input->output (with some timing-based limiting to avoid overcurrent, only at low speeds). All of these should be fixed or improved over the OEM firmware and quax' tree.

Keep in mind, this means it will totally break a helicopter that requires slow start and there is no battery protection or thermal shutdown; however, this is usually better than any other option on a multicopter. Actually, I thought maybe pulsing high/low PWM rate might be a useful audible indicator of one of these bad conditions, but haven't done that yet. Feedback, patches, pull requests (and free hardware) definitely welcome!

Oh, and for programming plush boards, I just use a long-pin 2x3 header (like about 1.5 inches long) that I bent to line up all to pins in a row, quite similar to how Nek did it with wires. It's springy yet strong enough to stand up to many uses. I started with wires first, but they were hard to keep straight enough. The header method is good enough that I have done it hundreds of times for testing, and the board looks untouched after, which is nicer than solder blobs and wires all over the place. pogo pins would certainly work, too!

Nek, did you make a new pinout for the RCtimer boards, then? If so, I can merge it into the tree as a new include file. Cheers!

Care to tell us noobs what difference it'll make? I just re-flashed a Turnigy 9X and found it somewhat fun so perhaps...

From one noob to another all I know is that it doubles the speed of updates from the ESC to the motors and allows 8X faster communication with the flight controller.

Now I had a day of flying on them and man do they rock now! simonk thank you so much for that firmware! I added a good minute of flight, motors are cooler and the tricopter much more stable! Still have to tweak my PIDs more but am very very pleased with the results.

As timecop said I did not change the pinout. I checked most of them and they were spot on so I just went with the default compiled hex file.

You wrote "They are in this order, from right to left: MOSI, MISO, SCLK, GND, VCC, RESET"

SCLK? Looking at the Atmega8 datasheet there is SCL, SDA and SCK, do you mean SCL?

I urge everyone to post their findings regarding the order of these connections on various ESC's.

Nek, perhaps you'd like to update post #1 with the photos and connection order that we post here?

Sebastian

Will sure do Sebastian. But unless my eyes are very tired I don't see any SCL or SDA pins on that diagram. SCLK is referring to SCK sorry if that was confusing. I don't know what is wrong with the ESC pictures, will re upload them!

Last edited by Nek; Sep 29, 2011 at 04:06 AM.
Reason: pictures should be fixed

The current tgy.hex is a build of 95471bfd from September 6th, which still used WGM20 phase-correct hardware PWM mode at intrc/510 Hz, which is just about 16kHz PWM. Not much has really changed since then that will affect flight. The only major bug fix was the all_pFET_off macro being screwed up, but it's probably OK for now. I won't upload a new tgy.hex until I've had a chance to test and make sure there are no timing issues with any of the newer commits; I haven't been tagging versions or anything yet, but just uploading mostly stable hex files after I test that they work and fly properly on my tricopter.