Here's a small tutorial on how you can use an Arduino board to program a KK2.0 board or your ESCs.
All you need is an Arduino board and a few connecting wires.
Step 1: Burn the ArduinoISP code onto your Arduino board. The instructions for the same are given at:
http://arduino.cc/en/Tutorial/ArduinoISPStep 2: Connect your Arduino board to your KK2.0 board/ESC. Basically you have to connect the MOSI of Arduino to MOSI of board, MISO of Arduino to MISO of board, and so on for SCK, RST, VCC, GND.
Diagrams for the pinouts are attached.
Step 3: Download the latest version of avrdude from:
http://download.savannah.gnu.org/releases/avrdude/A short tutorial on avrdude is given here:
http://www.ladyada.net/learn/avr/avrdude.htmlOnce you have downloaded avrdude. Open command prompt by typing 'cmd' at RUN. Go to the directory of the downloaded avrdude by using 'cd' command and then type 'avrdude' to open the program.
Step 4: Once your avrdude is ready to burn the code, check whether the connection between the boards is alright by typing the command:
avrdude -P COM4 -b 19200 -c avrisp -p m324pa -v -FCOM4 represents the serial port at which your Arduino board is connected to your computer. You would have to change it according to your computer. If all goes well, you would get a similar output:
avrdude: Version 5.11svn, compiled on Jan 18 2012 at 22:40:34
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
Using Port : COM4
Using Programmer : avrisp
Overriding Baud Rate : 19200
AVR Part : ATmega324PA
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
W ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
eeprom 65 10 128 0 no 1024 4 0 9000 90
00 0xff 0xff
flash 33 6 256 0 yes 32768 128 256 4500 45
00 0xff 0xff
lock 0 0 0 0 no 1 0 0 9000 90
00 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 90
00 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 90
00 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 90
00 0x00 0x00
signature 0 0 0 0 no 3 0 0 0
0 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0
0 0x00 0x00
Programmer Type : STK500
Description : Atmel AVR ISP
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.07s
avrdude: Device signature = 0x1e9511
avrdude: safemode: lfuse reads as D7
avrdude: safemode: hfuse reads as D1
avrdude: safemode: efuse reads as FC
avrdude: safemode: lfuse reads as D7
avrdude: safemode: hfuse reads as D1
avrdude: safemode: efuse reads as FC
avrdude: safemode: Fuses OK
avrdude done. Thank you.
Having done this, you can go ahead and finally burn the KK2.0 code onto your KK board. The latest firmware can be found at:
http://www.rcgroups.com/forums/showpost.php?p=23209042&postcount=6371You would have to copy the HEX file and paste it into your avrdude folder.
The command to burn the code is:
avrdude -P COM4 -b 19200 -c avrisp -p m324pa -v -e -U flash:w:kk2.hex:iYou would get this output:
avrdude: Version 5.11svn, compiled on Jan 18 2012 at 22:40:34
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
Using Port : COM4
Using Programmer : avrisp
Overriding Baud Rate : 19200
AVR Part : ATmega324PA
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
W ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
eeprom 65 10 128 0 no 1024 4 0 9000 90
00 0xff 0xff
flash 33 6 256 0 yes 32768 128 256 4500 45
00 0xff 0xff
lock 0 0 0 0 no 1 0 0 9000 90
00 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 90
00 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 90
00 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 90
00 0x00 0x00
signature 0 0 0 0 no 3 0 0 0
0 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0
0 0x00 0x00
Programmer Type : STK500
Description : Atmel AVR ISP
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.07s
avrdude: Device signature = 0x1e9511
avrdude: safemode: lfuse reads as D7
avrdude: safemode: hfuse reads as D1
avrdude: safemode: efuse reads as FC
avrdude: erasing chip
avrdude: reading input file "kk2.hex"
avrdude: writing flash (32112 bytes):
Writing | ################################################## | 100% 31.86s
avrdude: 32112 bytes of flash written
avrdude: verifying flash memory against kk2.hex:
avrdude: load data flash data from input file kk2.hex:
avrdude: input file kk2.hex contains 32112 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 25.80s
avrdude: verifying ...
avrdude: 32112 bytes of flash verified
avrdude: safemode: lfuse reads as D7
avrdude: safemode: hfuse reads as D1
avrdude: safemode: efuse reads as FC
avrdude: safemode: Fuses OK
avrdude done. Thank you.
You would notice that the display on your KK2.0 board changes during the code is being burnt. Once the procedure is completed, the board will automatically restart and you would notice that the new firmware has been installed.
I used the procedure to update my KK2.0 board, but I'm pretty sure you can use it change the firmware for your ESCs too.
Warning – It is possible to ruin your board while attempting this process.