Since I couldn't find anyone who done this before I thought I should write a guide on how to do it.

3689546785?profile=original

As I understand it some of the Arduflyers delivered by RCTimer in 2012 and early 2013 are missing the bootloader on the ppm encoder chip, the Atmega 32u2. This makes it impossible to upgrade the firmware on the ppm encoder using USB and Flip as instructed on the wiki. You will know if the bootloader is missing if it doesn't say Atmega 2560 dfu in device manager after you have reset the 32u2 chip.

I was about to upgrade the firmware for the PPM encoder when I noticed that one my APM boards where missing the bootloader. While I was searching to buy a programmer to use to restore the bootloader I discovered that it was possible to use an Arduino as an avrisp programmer together with avrdude. I decided to give this a shot and as it turned out it worked really well. So if you are missing the bootloader on your 32u2 chip and have an Arduino laying around you don't have to buy a programmer to restore the bootloader. I used an Arduino UNO but it should work with any Arduino like the Duemilanove, Mega, Micro etc.

Download and install winavr from Sourceforge.
It will install to C:\WinAVR-20100110 and avrdude.exe will be found under the bin catalog.
Backup your avrdude.conf file and replace it with this one avrdude.conf.
The configuration file will be found under the same catalog as the avrdude.exe file.

Download the Arduino-usbdfu.hex bootloader file or build it. I downloaded it from the 2.9 branch. Place the file in the winavr bin directory.
If you don't already have the Arduino IDE installed, download and install it.
Load the ArduinoISP sketch to your Arduino.
Wire up the Arduino as instructed in the sketch. If you have a 6 pin ICSP-cable you can use the ICSP connector on the Arduino. I also added 3 leds to pins 7, 8, and 9 with a 1k resistor, for heartbeat, error and programming.
Add a 10uF capacitor between reset and GND after you have downloaded the sketch to your arduino. This is to disable the autoreset function.


Ok, your arduino is now an ISP programmer and you are now ready to flash your 32u2 chip on your APM or your 2560 chip if you would like. The manual for avrdude can be found here. I strongly suggest you read it to understand what your doing before trying this.


Connect your arduino and your APM to the computer and then connect your ICSP cable to the APM. Readup on Jabrams instructions where applicable here.


Read the fuses a couple of times to make sure you have a good connection and get the same results back every time, especially the device signature. 

avrdude -P com6 -b 19200 -c avrisp -p m32u2 -U lfuse:r:-:h -U hfuse:r:-:h -U efuse:r:-:h -U lock:r:-:h

Then flash the Arduino-usbdfu.hex to the 32u2 chip using this command:

avrdude -P com6 -b 19200 -c avrisp -p m32u2 -F -v -U flash:w:Arduino-usbdfu.hex -U efuse:w:0xF4:m -U hfuse:w:0xD9:m -U lfuse:w:0xFF:m -U lock:w:0x0F:m

Note that my arduino is on com6 and you have to change that part to whatever port yours is on.

After you have flashed the dfu hex, recycled power and use filp to flash the latest ArduPPM.hex to the 32u2 following the instructions on the wiki.


E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Ah sorry. I see didn't read your post properly and just assumed you were looking for the arduino sketch.
    I can't remember how it was wired up but it is documented in the arduino sketch. Read up on Jabrams blog post and google ICSP pinout and it will be clear to you.
  • But, the connections between APM and arduino aren´t there... and that´s what Im looking for.

    If you could make me a sketch or whatever I will be very thanked to you

    Regards

  • The scetch is included in the arduino ide.
    File->Examples->ArduinoISP IF i remember correctly.
  • Could you include a sketch for the wiring? I can´t find any :( 

    By the way, I´m using an arduino mega as ISP programmer, does that matter?

  • My Uno shall be used for this! I must load er9x on my 9XR!!!!!

  • Nice! I've been looking for this.

  • Well, it's basically that http://arduino.cc/en/Tutorial/ArduinoISP

    That is why it is a good idea to have an http://arduino.cc/de/Guide/ArduinoNano lying around. I flashed my turingy 9x following that principle......

This reply was deleted.