For anyone that is experimenting with developing or modifying their own ESC (electronic speed controller), this is intended to be a useful step by step guide on flashing the MCU with the popular simonk firmware.
- ICSP programmer such as the Pololu PGM03A, make sure you download drivers for your O/S if needed.
- kkMulticopter software (works on Windows/OSX/Linux) We used 0.80 Beta 6 for this guide. Download links were down near the bottom of the page.
- Atmel based MCU, we use the Afro NFET ESC in this example which has an atmega8 MCU.
###1. Configure kkMulticopter
The USB programmer we are using uses the avrisp 2 protocol. Check out port number. Leave the baud rate and use default alone. Finally choose the controller.
####2. Upload the fuze configuration
The first time your initialize a brand new MCU you have to set the fuzes which are the internal configuration parameters of the chip. The “atmega 8-based brushless ESC (fuse restore, external clock (8kb flash)” is the option you will probably want, assuming you are using an external clock source.
While not critical on this step, you might as well choose the closest setting to your ESC. In many cases, you may start from one of the open source reference designs. In other’s you might be using similar type of MOSFETs with only subtle changes. This guide does not cover the actual software development or electrical considerations for the design being used. The rest of this guide will continue to use the Afro NFET esc as an example just because that is the ESC we have been shipping with our OpenROV Kit.
Now press the green running man icon to upload the fuze configuration. It should only take a brief moment and the result screen should be all white text.
####3. Upload the boot loader
One of the nice things about the SimonK firmware is that is supports programming over the servo ports. The reason for this guide is that there is a boot strapping issue, you cannot upload new versions of the firmware unless a version has already been put on the MCU.
Simply select the “+ enable boot loader” option whenever you want to burn or reburn the bootloader logic to the MCU. Press the green running man icon to upload again.
####4. All Done.
At this point the MCU is all ready to go. If you need to upload again in the future you can use the servo line programmer or, if you want to use the ICSP programmer again you can do so and you can choose the simpler option without boot loader to just update the actual firmware that controls the ESC.
####5. Tailoring the SimonK options
One nice feature of the kkMulticopter flash tool is that it simplifies tailoring the configuration options for the firmware.
The first time you use this option you will need to click the download button to the right of the “select version” drop down. That will go to github and download the latest source code.
Select the right ESC for you, their are likely more options than on the “Flashing Firmware” screen only because your viewing the options straight from the source code repository.
You now have two text files in the screen where you can change configuration options. “tgy.asm” changes the behavior of the ESC, the .inc are the device specific configuration for the different hardware configuration of the esc.
So for instance, we typically toggle on the following options in ‘tgy.asm’ for underwater applications using the OpenROV electronics package:
.equ RC_PULS_REVERSE = 1 ; Enable RC-car style forward/reverse throttle .equ RC_CALIBRATION = 0 ; Support run-time calibration of min/max pulse lengths .equ FULL_RC_PULS = 2000 ; Full speed at or above this pulse length .equ STOP_RC_PULS = 1000 ; Stop motor at or below this pulse length