Wednesday, 28 September 2016

Flashing Firmware of KK Multicopter Board using Arduino

Use Arduino instead of USBaps to upload your firmware to any KK Board. I am using 5.5 and it must suit for any other version. I am also using Arduino Uno R3 which is the most commonly available. So Let's Go!!

THE ARDUINO PART

Step 1: Open your Aruino IDE and open File/Example/ArduinoISP/ArduinoISP


Step 2: Please note done the baud rate at which the Arduino is going to comunicate. mine is : 19200


Step 3: Now upload the code to your arduino. This will turn your arduino into ISP ( In-System Programmer). It can now program any AVR board/ Controller if you have a hex file for it.

THE FLASH TOOL PART

Step 1: Download the KKMulticopter Flash tool from here.Even though we are not going to use it, I is going to help to get the firmwares.

Step 2: Unzip the downloaded file and open  “kkflashtool_xxxxx.exe” depending on your Operating System.

Step 3: This step is to download the .hex file for the type of multicopter you want. Dis-connect everything from your laptop. Select any thing from the first two list.

Step 4: Select the  controller you want mine is "KK Blackboard168P/PA (16k flash)" and from the firmware select the type you want and then click the Flash button.  It will show an error that the selected device is unavailable (wow!!! great discovery).



Step 5: Now the best part... Open the tmp folder in the downloaded software directory. You will find the .hex file that you were ought to flash. 



Copy that file and paste it in "......kkmulticopterflashtool_0.77\lib\avrdude\windows". I was trying to build a Tricopter and couldn't find any downloadable hex file and this thing I just got it in fluke!!!


Hardware Connection

Now that we have the programmer (Arduino) and the Firmware to upload. give the circuit connections as follows:

Step 1: Take the KK Multicopter board and locate the ISP from it. The one for 5.5 is as follows:



Step 2: The Pins are as follows


Step 3: Connect the pins from multicopter to the Arduino as follows

KK board Pins
Arduino Uno Pins
1 (MISO)
12
2(Vcc)
5V
3(SCK)
 13
4(MOSI)
11
5(RST)
10
6(GND)
Gnd

Step 4: Now plug in the Arduino to PC.

Flashing Firmware

Step 1: Open the command prompt as administrator.

Step 2: Go to the "......kkmulticopterflashtool_0.77\lib\avrdude\windows".

Step 3:  Enter the command avrdude.exe -P COM3 -p m168p -c arduino -b 19200

I have used "m168p" because the controller on KK 5.5 is ATMega 168p. I you want to know the code for your controller just remove the part from it, you will get a list denoting the codes for all the programmable microcontroller and also change the COM number according to your PC and arduino. Here the 19200 represents the baud rate of the ISP as in the ArduinoISP.ino file.

If you have done all right you must get something like this :



Step 4: Now try this: avrdude.exe -P COM3 -b 19200 -c arduino -p m168p -v -e -U flash:w:"xxxx.hex":i

Replace "xxxx.hex" with the name of the .hex file you copied previously. This must give you the result as follows:


GREAT!!!! You have successfully flashed your kk board using Arduino!!!!! Comment if you have any queries.

1 comment: