Flash KK2.0 KK2.1 1.6 Firmware Update Upgrade Using Arduino

Who says you have to have an USBasp AVR programmer to flash the KK2.0 or KK2.1? I have flashed ATTiny microcontrollers before using Arduino as the ISP programmer, so why not try that on the KK2.0? And I happen to have a couple of Arduinos lying around, so I decided to give it a try. I will show you how I flash KK2.0 flight controller using the Arduino. 

These instructions should work for both the Arduino Uno and the Arduino Mega. it saves you money buying extra parts when you have the Arduino available.

Note that this tutorial also works with KK2.1, the latest KK2 board.

Preparation for Flashing the KK2 board with Arduino

Software wise, you need follow these steps first.

You will need the following hardware components.

  • Hobbyking KK 2.0 flight controller board.
  • One of the Arduino Board such as Arduino Uno, Nano, or Mega.
  • A 10 uF Capacitor (optional)
  • Some female to female and Male to Female jumper wires.

Arduino Setup and Wire Connection

Do not power up anything just yet.

First you need to connect your Arduino to your PC using USB cable, in the IDE open up the example sketch in File->Examples->ArduinoISP. Upload this sketch to your Arduino, it will make your Arduino an ISP programmer.

Connect the Arduino and the KK2.0 board according to the following pin layout

KK2-ISP-Pinout

click picture to enlarge.

Arduino-flash-kk2

Arduino Uno / Nano

Arduino Pin 10 – SS / Reset
Arduino Pin 11 – MOSI
Arduino Pin 12 – MISO
Arduino Pin 13 – SCK

Arduino Mega 

Arduino Pin 50 – MISO
Arduino Pin 51 – MOSI
Arduino Pin 52 – SCK
Arduino Pin 53 – SS / Reset

Do not power the KK 2.0 with your arduino, and avoid sharing the same power source. You might failed if you do that. The easiest thing to do is, power your Arduino with the USB cable from the computer, and use external power source to power your KK board, for example an ESC 5V BEC from your quadcopter.

Now power up your KK2.0 board.

Next you need to put a 10 uF capacitor between the SS/Reset pin and the GND (I flased two KK2.0 without this, and it seems working fine). Check the below picture for more details. Basically, the long leg of the capacitor should be connected to the Reset side and the shorter leg should be connected to the GND.

I have seen people got away without connecting the capacitor, but do this at your own risk!

connect kk20 arduino

Let’s Start Flashing in Command Line

Don’t get freaked out by command line, all you need to do is to type the following lines in the CMD and check whether the output is the same as mine.

Please double check your ISP pin connections before you proceed. Now that everything is powered and connected, we can run the following command to check if everything is ready to be flashed.

Arduino Uno

D:kkflashtoollibavrdudewindowsavrdude.exe -P COM3 -p m324pa -c arduino -b 19200

Arduino Mega 2560

D:kkflashtoollibavrdudewindowsavrdude.exe -P COM3 -p m324pa -c avrisp -b 19200

Replace COM3 with the port on which your Arduino is connected to.

The output should be similar to this.

flash-kk20-with-Arduino

If it says “Ok”, then we are ready to flash the KK2.0 board. If the Device signature is all zeros, you’ve probably connected the ISP pins on the KK board the wrong way around. Just double check and plug it in other way.

To start the firmware flash, execute the following commands.

Arduino Uno R3

D:kkflashtoollibavrdudewindowsavrdude.exe -P COM3 -b 19200 -c arduino -p m324pa -v -e -U flash:w:"D:KK2_1V6KK2_1V6kk2.hex":i

Arduino Mega 2560

D:kkflashtoollibavrdudewindowsavrdude.exe -P COM3 -b 19200 -c avrisp -p m8 -v -e -U flash:w:"D:KK2_1V6KK2_1V6kk2.hex":i
  • Replace COM3 with the port on which your Arduino is connected to.
  • Replace “D:kk2.hex” with the full path to your firmware file.

The output should be something like this.

flash-kk20-with-Arduino-done

Please note that the screen will become white during and after flashing, this is normal.

After it’s done and you see “Thank you” on the screen, restart KK2.0 and you should see the new firmware number which means you have upgraded the firmware successfully. Enjoy flying! :-)

Firmware on KK2.1 and KK2.1.5

I heard the 1.6 Firmware has bugs on the KK2.1, kind people have been working hard to provide new firmware to fix these bugs, check out Stevie’s KK Firmware.

Also notice the KK2.1 and KK2.1.5 has a different chip, which is m644p, so you need to use a different command to flash it.

C:UsersOscar>D:flashlibavrdudewindowsavrdude.exe -P COM1 -b 19200 -c avr
isp -p m644p -v -e -U flash:w:"D:kk2KK2V1_1V11S2.hex":i

Possible Errors When Flashing Firmware

avrdude.exe: Expected signature for for ATmega8 is 1E 93 07
Double check chip, or use -F to override this check.

You need to change the original command to

C:UsersOscar>D:flashlibavrdudewindowsavrdude.exe -P COM1 -b 19200 -c avr
isp -p m644p -v -e -U flash:w:"D:kk2KK2V1_1V11S2.hex":i

 

49 thoughts on “Flash KK2.0 KK2.1 1.6 Firmware Update Upgrade Using Arduino

  1. Jimit Patel

    Thanks for the help man it worked took some time to figure out what i was doing wrong but it worked.
    I used the Arduino to power the kk2 board and used a 10uf cap as you mentioned above and flashed the latest kk2.1.19s1 pro firmware.
    I think they have integrated arduino isp into the kkflashing software, i have to check for that till then thanks.

    Reply
  2. paras brahmbhatt

    hello i get this error when i was flashing kk2.1.5 board.

    C:\Users\admin>D:\flashing\lib\avrdude\windows\avrdude.exe -P COM6 -p m644p -c a
    vrisp -b 19200

    avrdude.exe: stk500_recv(): programmer is not responding
    help me.

    Reply
  3. Bharat

    C:\Xilinx\14.2\ISE_DS>C:\Users\AKSHAY\Desktop\kkflashtool\lib\avrdude\windows\avrdude.exe -P COM8 -p m328p -c arduino -b 19200
    for the above code i got this error please help

    ‘avrdude.exe: stk500_getsync(): not in sync: resp=0x15’

    Reply
  4. Alex

    Hi Oscar,
    I’ve been slightly confused about what to do after I flash the KK2 board with a newer version. I am using v1.9S1 by Steveis and everything updated properly, but I do not know if I should adjust the PID settings or not. Does the update take care of that for you so don’t have to change those settings? Or does it reset everything making it so that you have to manually adjust the PID settings from scratch? I believe I still need to re-calibrate the self leveling setting and reenter the calculated mixer settings so that the board knows where each motor is. Thanks.

    Reply
  5. soumya kanta srichandan

    hii oscar
    in kk2.1.5 there is 644pa microcotroller but m644pa is not available we have to use m644p.Do you think it would work properly??

    Reply
  6. soumya kanta srichandan

    hii Oscar
    Thank you for such a comprehensive guide.I want to know can i update my kk2.1.5 board with these steps??any changes…i cant understand this avrdude thing..please can you explain

    Reply
    1. Oscar Post author

      it should still be the same. I don’t understand it fully either, it’s just a command you need to type it in… don’t worry about it too much.

      Reply
  7. bob booth

    hi this is the problem i have any help i have a kk2 1.6 connected to a arduino uno and i get this

    Microsoft Windows [Version 10.0.10240]
    (c) 2015 Microsoft Corporation. All rights reserved.

    C:\Users\DAD>C:kkflashtoollibavrdudewindowsavrdude.exe -P COM3 -p m324pa -c arduino -b 19200
    ‘C:kkflashtoollibavrdudewindowsavrdude.exe’ is not recognized as an internal or external command,
    operable program or batch file.

    C:\Users\DAD>cd/

    C:\>C:kkflashtoollibavrdudewindowsavrdude.exe -P COM3 -p m324pa -c arduino -b 19200
    ‘C:kkflashtoollibavrdudewindowsavrdude.exe’ is not recognized as an internal or external command,
    operable program or batch file.

    C:\>C:\kkmulticopterflashtool_0.77\lib\avrdude\windows\avrdude.exe -P COM3 -p m324pa -c arduino -b 19200

    avrdude.exe: AVR device initialized and ready to accept instructions

    Reading | ################################################## | 100% 0.02s

    avrdude.exe: Device signature = 0x1e960a
    avrdude.exe: Expected signature for ATmega324PA is 1E 95 11
    Double check chip, or use -F to override this check.

    avrdude.exe done. Thank you.

    C:\>

    Reply
  8. Prince

    Hi Oscar,
    What is with the flashing? Why is it done? I have kk2.1.5 flight control though haven’t set up anything yet.

    Reply
    1. Oscar Post author

      A custom Firmware is basically a software that is written by third party (not the manufacturer), they sometimes have additional functionality, or better performance.
      The default KK2 firmware is absolutely fine! And you don’t have to flash other firmware if you don’t want to. But read about what the new firmware can do, see if there is any additional features that might interest you to do it.

      Reply
  9. satyam khanna

    Hi Oscar,
    I want to know does this procedure work for kk5.5 blackboard too or not…??

    thanxx please leave a rep

    Reply
  10. Nader

    On my kk board 2.0 i had to put a completely different code, the flashing tool does not work either. I’v put m324pa insead of m8 as said in example.

    D:kkflashtoollibavrdudewindowsavrdude.exe -P COM52 -b 19200 -c avrisp -p m324pa -v -e -U flash:w:”D:KK2_1V6KK2_1V6kk2.hex”:i

    Reply
  11. kade

    I did this and now my kk2 has white screen and no beep, but if I connect 5v to ISP header it comes on and shuts off if disconnected from the arduino. I switched escs to see if that was the problem and still nothing. It was the kk2 hc which I was told is the same just remote screen and buttons. Any help appreciated.

    Reply
  12. Phil

    Oscar,

    Thanks so much for this guide! It’s very comprehensive and worked great for flashing Stevies Firmware to my KK2.1.5! Everything went smooth and worked great!

    Reply
  13. Atmosakun

    I do not see the function of KK 2.0 windows flashing tool in the above step. then for what I downloaded this software? could be explained again, I want to try this step. because I do not have usb downloader. thanks before.

    Reply
  14. Mike

    Unfortunately it hasn’t work yet for me. I used V1.18S1 Pro and got this readout:

    Reading | ################################################## | 100% 3.36s
    avrdude.exe: verifying …
    avrdude.exe: 4420 bytes of flash verified
    avrdude.exe done. Thank you.
    Flashing of firmware was successful.

    Then after powering the KK2.1 the software is stuck at version 1.2. Any suggestions?

    Reply
  15. Oskar

    Thanks for this guide! For the first time I have real use of my Arduino :)
    But I have one question.. I soldered an adapter to connect from the Arduino to KK, but when I power up the Arduino and connecting the FC it automaticly takes the power from the Arduino.. But in your guide you wrote that the Arduino and the KK board should not share power.. I’m confused.. Should I skip the 5V lead from the Arduino and just connect 5 leads to the KK? And then power the KK with UBEC? I don’t think that I should connect the UBEC when The KK gets power from the Arduino at the same time :)

    Reply
    1. Oscar Post author

      yes I admit what I wrote is confusing. In the diagram, I was actually powering the KK2 from the Arduino, which is not recommended. (it worked for me the first time, that’s why I drew it this way, but I realized it’s not safe later on. I should have updated the diagram)
      The right way should be connecting the 5V from the KK2 to an external power source, such as an UBEC, or ESC BEC 5V instead, and connect the ground of the BEC to the arduino GND (Common Ground), so the 5V on the Arduino is not connected to anything.

      Reply
      1. Oskar

        I did not use the 5V from the arduino as you wrote and It worked perfekt! Thanks for the guide again!

    1. Oscar Post author

      the voltage rating on the capacitor means what the max voltage you can use with these caps.
      We are only working with 5V, so anything above that would be fine.

      In fact, I flashed a couple of boards without the capacitor successfully.

      Reply
  16. David Henderson

    Oscar,

    Every tutorial of yours is perfect; thank you so much for taking the time to document this process. I did exactly as you described and everything worked exactly as you said it would.

    Thanks again

    Reply
  17. Noreen

    Aw, this was an incredibly good post. Finding the time and actual
    effort to make a very good article… but what can I say… I put things off a whole
    lot and never manage to get anything done.

    Reply
  18. rob

    You use the deicated KK flasing tool along with the arduino as described here.This allows you to get the very latest firmwares from a central repository with each variation an version displayed.
    When using this software and I recommend you do so simply select atmel avrisp as the programmer and select the correct com port.

    Reply
  19. Tanvir Parhar

    Hey thanks for the awesome tutorial… only one amendment in the command for flashing the kk2.0 with megaduino… the board written there is m8, it should be m324pa
    so the command becomes

    D:kkflashtoollibavrdudewindowsavrdude.exe -P COM3 -b 19200 -c avrisp -p m324pa -v -e -U flash:w:”D:KK2_1V6KK2_1V6kk2.hex”:i

    Reply
    1. Oscar Post author

      that’s odd, i tried m324pa it didn’t work, that’s why i used m8.
      Anyway there is no harm trying, if anyone failed using one then they should try the other.

      thanks for the tip.

      Reply
  20. Philip

    When I type in the command from the “Possible Errors When Flashing Firmware”, it says: avrdude.exe: Can’t find programmer id “avr”

    Valid programmers are:
    [List of valid programmers]

    Please help.

    Philip

    Reply
  21. Philip

    I have a problem: when I paste in:

    C:UsersGamesflashlibavrdudewindowsavrdude.exe -P COM5 -b 19200 -c avr isp -p m644p -v -e -U flash:w:”D:kk2KK2V1_1V11S2.hex”:i

    It says “The system cannot find the path specified”.

    Please help.

    Reply
  22. Mahmoud

    Hello Oscar
    I have a KK2.0 V1.2 and i want to update it to the newest version… though i have heard that it doesnt support the new Firmware 1.6. Is this true? can i upload the new Firmware on my KK2.0?

    thank you

    Reply
  23. Stian

    Hello! Could you please give me some schematics of the circuit? I have a hard time to see what goes where, and I am not that experienced with Arduino. It would really help me and my class out!

    Thx :)

    Reply
  24. misterT

    It works with a 4.7 uf capacitor, But for other people i recommand you to make better pictures when you explain how to connect the capacitor !!

    Reply
      1. misterT

        no, i mean a 100uf capacitor?

        Because with the Arduino starter kit you have:
        5 Capacitors 100nF
        3 Capacitors 100uF
        5 Capacitor 100pF

        arduino.cc/en/Main/ArduinoStarterKit

      2. Oscar

        i see. I have seen people got away with 1uF and 47uF capactiors.
        I don’t know if that would work with 100uF because I haven’t tried it.

Leave a Reply

Your email address will not be published. Required fields are marked *

Are you Robot? *

I only check blog comments once or twice a week, if you want a quick reply you can post your question on this forum IntoFPV.com... You might get a faster response from me there (multirotor related only).