3DRobotics > ArduCopter > common-PPM Encoder APM 2.
x Atmega 32U2 (8 Channel PPM Encoder)
Table of Contents
APM 2.x Atmega 32U2 8 Channel PPM encoder
Contents [hide]
1 APM 2.x Atmega 32U2 8 Channel PPM encoder
2 What you need
3 Putting the Atmega32U2 into programming (DFU) mode
3.1 For the APM 2.5 board
3.2 For the APM 2 board
4 Using FLIP to upload the firmware
How to flash the Atmega32U2 (PPM encoder) through USB If you every find yourself in a situation where your PPM encoder has
become corrupted for some reason, or you want to upload a new version, you can. The PPM encoder (ATMega32-U2) has an special
bootloader that allows you to flash it without needing a special SPI programmer. The 32U2 firmware controls the USB connection to the
2560 and is also used to convert radio PCM signals to a PPM signal for the 2560. APM 2.5 modules shipped before March 4th 2013
have an older version of the firmware. Here is a discussion on the newer firmware.
What you need
Windows XP/Vista/7
USB cable
Download and install Flip, click here.
The firmware (HEX file) you want to load can be downloaded here. (The source code, while not necessary if using the compiled code,
can be found here.)
Putting the Atmega32U2 into programming (DFU) mode
For the APM 2.5 board
First, unscrew the top of your APM 2.5 case, so you can get to the pins.
After installing flip, connect your APM 2.5 to your computer with your USB cable.
When turned on, insert a jumper cap into the JP2 port to short it, as indicated in the picture below.
This is the same small jumper that came with your APM 2.5 board.
If you’re currently using it on the JP1 pins, temporarily move it to JP2. When you’re done with the procedures on this page, you can
move it back to JP1.
Use a pair of needle-nosed pliers or a little piece of wire to short circuit the GND and RST pins of the Atmega32U2 in order to reset it.
You can find those pins broken out in the chip’s ICSP header on the edge of the board:
After reseting you will hear the USB disconnect/connect sound in your Windows computer.
Your board should be in DFU mode now and ready to be programmed. Scroll down to the Using Flip part.
For the APM 2 board
After installing flip, connect your APM 2 to your computer with your USB cable.
When turned on, insert a jumper cap into the JP2 port to short it, as indicated in the picture below.
This is the same small jumper that came with your APM 2 board.
If you’re currently using it on the JP1 pins, temporarily move it to JP2. When you’re done with the procedures on this page, you can
move it back to JP1.
Use a little piece of wire to short circuit the GND and RST pins of the Atmega32U2 in order to reset it.
You can find those pins broken out in the chip’s ICSP header on the edge of the board:
After reseting you will hear the USB disconnect/connect sound in your Windows computer.
Your board should be in DFU mode now and ready to be programmed. Scroll down to the Using Flip part.
Using FLIP to upload the firmware
1) Open Flip by double clicking the flip icon:
2) When opened you will see a window like this:
3) Press on the icon indicated with a red arrow or just go to the menu “Device->Select” or just press Ctrl+S.
4) Then select Atmega32U2 and click OK. If this doesn’t work, see 5a below.
5) Click on the icon indicated with an arrow or just go the menu “Settings->Communications->USB” or just press Ctrl+U and click
“Open”.
5a) If you get an alert box that says “AtLibUsbDfu.dll not found”, you’ll need to load an updated driver for your board in DFU mode.
Go to the Windows Device Manager (in the Control Panel/Hardware and Sound) and you should see the Atmega chip highlighted
with an exclamation point, signifying an error.
Right-click on it, and choose “Update Driver Software”.
Then choose “Browse my computer for driver software” and navigate to the “C:\Program Files (x86)\Atmel\Flip 3.4.7\usb” folder (if
you’re using a different version of Flip, the folder name will reflect that version).
Then press Next and it should install the correct driver. Restart FLIP and do steps 1-3 again; they should work this time.
6) If everything is correct you will see the Signature bytes, etc, like in the next pic:
6a) You can view the current firmware in the buffer before you upload new firmware if you want to. Some PPM firmware versions will
have the version embedded in the code. Click [Device] [Read] to download the current memory into the buffer and then [Buffer]
[Edit] to view. (See Flip manual for details.) The version may be near the end of the code before all the FF entries. Here is a sample
of the end of the code segment for one version of the PPM firmware.
01470 98 08 20 03 E8 03 20 03 98 08 20 03 06 09 20 03 .. … … … .
01480 98 08 20 03 98 08 20 03 98 08 20 03 08 52 41 72 .. … … ..RAr
01490 64 75 50 50 4D 76 32 2E 33 2E 31 36 00 30 20 00 duPPMv2.3.16.0 <– this is the version number.
014A0 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ……………. <– this is the area without code
014B0 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF …………….
7) Now lets load the HEX by clicking on the icon indicated with a red arrow or go to the menu “File->Load HEX” or just press Ctrl+L.
8) Choose the HEX file you just downloaded and click OK.
9) Now make sure you select all the options on “Operations Flow” box as indicated in the picture with a red arrow.
10) Now just press the “Run” button indicated with a red arrow below and the system will upload the new firmware.
11) If you are lucky and have done everything correct you will see a green dot in every option as indicated:
12) Now remove the USB then the jumper and cycle the power of the APM 2.5 board.
13) Your board is ready to go!
Questions about this page? Comments? Suggestions? Post to APM Forum! Use the platform specific to your query, and make sure to
include the name of the page you are referring to.
Sponsored By 3DRobotics.