|Sep 28, 2011, 03:23 PM|
RCTimer/Turnigy/Hobbywing ESC DIY Firmware Flashing
*Links to other HOWTOs*
DIY Multi rotor wooden frame. Tricopter to Dodeca
DIY MultiWii Shield and pinout information
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...
1- Required stuff:
- RCTimer or other Atmel chip compatible ESC stripped of it's shrink tube.
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- 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 12A plush (tested by JussiH and works on tgy.hex) Thanks JussiH for the picture.
Turnigy Red Brick 25A:
Thanks to pia32.
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:
Thanks to SeismicWave for these ones!
Red Brick 25A, thanks to pia32 for the picture. Flashed with tgy.hex
Thanks to adlerbak!
Thanks to finkbuilt!
Thanks to SeismicWave
Thanks to Dolby for these pics!
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.
Just looking it up on google I found this link: http://sourceforge.net/projects/winavr/ which should install AVRDUDE. This link has a tutorial on how to run it in command line.
For OS X go here: http://www.ladyada.net/learn/avr/setup-mac.html Option 1 for install is supposed to be easy and works.
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.
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.
avrdude -c usbasp -p m8 -U flash:w:tgy.hex
avrdude: warning: cannot set sck period. please check for usbasp firmware update. avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.01s avrdude: Device signature = 0x1e9307 avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed To disable this feature, specify the -D option. avrdude: current erase-rewrite cycle count is -50462977 (if being tracked) avrdude: erasing chip avrdude: warning: cannot set sck period. please check for usbasp firmware update. avrdude: reading input file "tgy.hex" avrdude: input file tgy.hex auto detected as Intel Hex avrdude: writing flash (1482 bytes): Writing | ################################################## | 100% 1.08s avrdude: 1482 bytes of flash written avrdude: verifying flash memory against tgy.hex: avrdude: load data flash data from input file tgy.hex: avrdude: input file tgy.hex auto detected as Intel Hex avrdude: input file tgy.hex contains 1482 bytes avrdude: reading on-chip flash data: Reading | ################################################## | 100% 0.72s avrdude: verifying ... avrdude: 1482 bytes of flash verified avrdude: safemode: Fuses OK avrdude done. Thank you.
EDIT: Fuses don't need to be changed on the newer versions of the firmware, which is what you should be using.
The following is left for reference only, not needed anymore.
3- Quick Recap:
- Identify the right pins
- Make a connector to the AVR Programmer
- Install AVRDUDE and use this command for reflashing:
avrdude -c usbasp -p m8 -U flash:w:tgy.hex
ImagesView all Images in thread
|Sep 28, 2011, 03:31 PM|
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..
|Sep 28, 2011, 03:43 PM|
Also please post your pogo pin setup if you get to doing it that way
|Sep 28, 2011, 04:28 PM|
Good write-up. I have been thinking of this for a long time...but I changed timing instead. I do have a spare USBASP programmer (and 1 installed in my 9X radio)
I mainly use 18A's.
|Sep 28, 2011, 05:26 PM|
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
|Sep 28, 2011, 07:06 PM|
Canada, BC, North Vancouver
Joined Dec 2010
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!
|Sep 28, 2011, 07:28 PM|
Joined Dec 2010
RCTimer pinout is exactly same as tgy, as he just recommends downloading the precompiled .hex file - which I assume uses tgy.inc as-is. So it should be all good.
|Sep 29, 2011, 01:25 AM|
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.
|Sep 29, 2011, 02:58 AM|
Very nice how-to, thanks.
The photo of the ESC is missing.
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?
|Sep 29, 2011, 03:03 AM|
Joined Dec 2010
It's SCK. Also called SCLK. SCL is unrelated.
I hereby donate this diagram for the 1st post of the thread.
Last edited by timecop; Sep 29, 2011 at 03:09 AM.
|Sep 29, 2011, 03:04 AM|
|Sep 29, 2011, 01:08 PM|
Canada, BC, North Vancouver
Joined Dec 2010
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.
|Sep 30, 2011, 04:39 PM|
Simon, consider doing a 200-1200ms (UltraPWM) version of the code and gain popularity with the Xaircraft users (poor guys).
|Category||Thread||Thread Starter||Forum||Replies||Last Post|
|Discussion||Rctimer 30A esc cutting out with KK board||Efliernz||Multirotor Talk||2||May 26, 2011 02:20 PM|
|Sold||FS: Tricopter Parts- HK401b, Pentium 30A ESC, rctimer 750kv motors||pwu_1||Aircraft - General - Miscellaneous (FS/W)||2||Jan 18, 2011 09:58 PM|
|Sold||RCTimer 2826-6 + ESC 30A New in packaging will trade as well Pics Added!||planebldr||Aircraft - Electric - Power Systems (FS/W)||4||May 25, 2010 09:54 PM|
|Discussion||RCTimer 30A Programmable ESC||hunter7193||Power Systems||8||Jan 02, 2010 02:27 PM|
|For Sale||Several New ESC's - 10a, 20a, 30a - Reduced||Callen9345||Aircraft - Electric - Power Systems (FS/W)||0||Apr 20, 2009 02:31 PM|