Browsed by
Tag: avr

ESC reflash with SimonK firmware

ESC reflash with SimonK firmware

20AUBEC

I hadn’t gotten around to modifying the internals of my TX so I figured I’d have a go at reflashing the Hobby King 20A (F-20A) ESCs first. I chose this ESC because:

  • They were really cheap
  • They supported reflashing with SimonK’s firmware
  • They had their test pads in a row so it would be easier
  • All it’s FETs were the same (N-Channel)

Some wiring had to be done to match the pin-outs from my 10 pin AVR programmer to the test pads on the ESC. I found the information that I needed over at this RC Groups thread. I also read the instructions found here at openpilot.

As for the firmware we can find it on github along with more useful instructions. I suggest you read all of it and refer to this spreadsheet for your particular ESC.

IMG_0490

I wanted to test this really quickly so I just slapped some wiring together with a breadboard to get everything hooked up.

IMG_0491

The test pads are in the following order: MOSI, MISO, SCK, -, +, RESET (from bottom to top). I took the time to tin the wire, that I took from an old IDE cable, to make sure I had good contact and no stray wires crossing pads. I then lined it up and held it in place with some scotch tape so that I didn’t have to keep holding it there. The tape doesn’t really maintain the contact so prior to programming I would still need to use my finger to press down, it just keeps me from fumbling around.

With the wiring done, I plugged the AVR programmer into the USB port and fired up AVRFuses.

avrfuses-program1

I set the device to “ATmega8″ which is the microcontroller found on this ESC, and probably most other ESCs compatible with the SimonK firmware. I also pointed the hex file to the firmware file that I had downloaded for my ESC. Then I took a deep breath, pressed my finger to the wire on the ESC and clicked on program. A few seconds later… “SUCCESS”.

I unhooked the ESC and reconnected it to a battery, servo tester and motor. Upon doing this I heard 3 beeps followed by a 4th telling me that everything was good. A few twists on the servo tester and the motor was spooling like a dream.

The flashing instructions make mention of the fuses on the ESC. We do not need to do this and can leave it stock.

default-fuse-F20A

In case something was changed accidentally (and you still have access to the ATmega) here are the default fuse settings as seen by AVRFuses.

I, on the other hand, somehow managed to mess things up and bricked 1 of my 4 ESCs during the process. Not too bad for my first time doing this, but now I had to go order another ESC. I’ll probably buy a few as spare.

Atmel AVR programming on OS X

Atmel AVR programming on OS X

I finally received the AVR USBASP programmer that I ordered on aliexpress.com today. I’ve been waiting for this so that I could start tinker with reflashing of ESCs and the Turnigy 9x that I had recently bought. I choose this one cause it had some built in protection (diodes) added.

IMG_0488

It was also voltage selectable (3.3V and 5V) via adding or removing a 0ohm resistor. I plan on replacing the resistor with headers and a jumper later. It comes default as 5V which works for me, so I’ll leave it for now.

I run OS X, and most guides for things related to R/C are written for windows. I basically looked for the equivalent Mac based tools as described by the Windows based guides. I knew that I could do this cause there is nothing platform specific when it comes to working with the Atmel microcontrollers (the atmega8a that controls our ESC).

I chose to use CrossPack, by Objective Development Software, to provide me with the toolchain for working with the Atmel microcontrollers. And while I’m pretty comfortable with the OS X command line (many years of Linux), I figured that I wanted to be lazy and have a GUI interface. Thus I also chose to install AVRFuses, by Jason von Nieda, as the GUI that would hook into avrdude (comes with CrossPack and is the actual program that will flash the firmware to the ESC).

At the time of writing this, the versions that I used are (on OS X 10.7.4):

  • CrossPack-AVR-20120217.dmg
  • AVRFuses_1.4.4.zip

Installation is a piece of cake so I won’t go into that. I will however talk a bit about configuring AVRFuses so that it can talk to the AVR Programmer through avrdude.

avrfuses-prefs

After installing both pieces of software, open up AVRFuses and go to it’s preference pane. Here we will need to define “Path to avrdude” and if you read the readme file that came with CrossPack, you would know that it installs by default to “/usr/local/CrossPack-AVR-20120217/” and the full path to avrdude is “/usr/local/CrossPack-AVR-20120217/bin/avrdude”.

The programmer that I bought was USBASP so I selected “usbasp” (obviously), You may need to select a different option depending on your programmer. The port should again be selected based on the hardware programmer that you are using, and it is pretty safe to leave the baud rate at “[Default]“.

There has not been an update to AVRFuses since 2008, but I wanted to leave the option checked in case Jason decides to do something someday. I also left “Show avrdude Command Lines” so that I could monitor what was going on Click on “Close” and if everything is good you will see a nice green “SUCCESS” in the output console.

Now we can get ready to reflash the TX and some ESCs. I’ll write about those later on.