Thread Tools
Apr 24, 2015, 12:23 PM
Registered User
Thread OP
Discussion

APM only green light, Arduino Mega as ISP boot loader (solved)


My first built was an octocopter with HK multiwii pro. It saw the sky for one day only when two motor mounts of HK octo frame broken. Frame was very weak and Hk multiwii was just struggling to handle more than 5000 watt copter.
Per others advice, I came to simple basics and built a quad with cc3d and another quad with APM 2.8 and they worked like charm with some issues later on. My aim of heavy lift quad full filled by lifting a dslr Nikon d3100 and then a laptop of total weight around 4.5 Kg.
See the videos here.
Heavy lift quadcopter, lifting 4.55 kg, 10 pounds (1 min 51 sec)

Quadcopter lifting DSLR nikon D3100 (0 min 23 sec)


After some practice it was time for APM to come as a driver for octo. Two days ago firmware uploaded but motors were starting at very high speed. I decided to go back to quad firmware and the problem started. Soon only green light on APM and Mission planner was giving communication error.
Change of usb cables, change in PC, and using old versions of planner but nothing worked. Disabling Bluetooth adapter and other ports didnít work.
After lot of search I found this is a boot loader problem. If that is corrupt mission planner will not copy the .hex file of the firmware.
I used Arduino custom IDE for APM and copied the code, ended up with few warnings but APM remained non responsive with only solid green light.
Installed Atmel flip on a different laptop, connected APM via usb and installed driver manually for Atmel 32u2 chip. Driver was present within Atmel folder at C:\Program Files (x86)\Atmel\Flip 3.4.7\usb. Selected devise as AtMega32u2 and connected via usb. Initially I was wrong and tried to copy .hex file for Mega2560 later I came to know this is a small chip on APM and problem is not because of this. During this I downloaded all files of APM 2.9 and copied ArduPPM_v2.2.68_ATMega32U2.hex through flip into the 32u2 chip which was successful.
Now the main part was to copy boot loader for Atmega 2560 chip of APM. I connected APM with Arduino UNO as ISP and made a setup similar to shown here http://diydrones.com/profiles/blogs/...tmel-32u2-chip
This setup is for 32u2 but same way I used for 2560, only difference is to use SPI points of 2560 chip as shown here.

Name: Atmega 2560 SPI.jpg
Views: 263
Size: 79.9 KB
Description:


Use Arduino IDE and followed same as in above link but it was giving an error when uploading bootloader. I decided to use Arduino Mega for the same purpose and connected with the same layout and to my surprise it worked great.


Name: Arduino Maega as ISP for APM bootloader.jpg
Views: 269
Size: 475.0 KB
Description:


From APM 2.9 folder copied the bootloader file stk500boot_v2_mega2560.hex to same folder which was shown in command prompt.
Used the Winavr in cmd prompt and wrote this line:
C:\Users\my>avrdude -P com6 -b 19200 -c avrisp -p m2560 -F -v -U flash:w:stk5
00boot_v2_mega2560.hex -U efuse:w:0xF4:m -U hfuse:w:0xD9:m -U lfuse:w:0xFF:m -U
lock:w:0x0F:m

Note identifier for the chip is m2560.
It took two day to understand and resolve the problem. Other lights of APM started blinking and just now I have uploaded Octo firmware and ready to do flying experiments.
Here is final outcome of avr.
avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch

System wide configuration file is "C:\WinAVR-20100110\bin\avrdude.conf"


Using Port : com6
Using Programmer : avrisp
Overriding Baud Rate : 19200
AVR Part : ATMEGA2560
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 8 0 no 4096 8 0 9000 90
00 0x00 0x00
flash 65 10 256 0 yes 262144 256 1024 4500 45
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
lock 0 0 0 0 no 1 0 0 9000 90
00 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0
0 0x00 0x00
signature 0 0 0 0 no 3 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 = 0x1e9801
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as FD
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed

To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "stk500boot_v2_mega2560.hex"
avrdude: input file stk500boot_v2_mega2560.hex auto detected as Intel Hex
avrdude: writing flash (256458 bytes):

Writing | ################################################## | 100% 3.80s

avrdude: 256458 bytes of flash written
avrdude: verifying flash memory against stk500boot_v2_mega2560.hex:
avrdude: load data flash data from input file stk500boot_v2_mega2560.hex:
avrdude: input file stk500boot_v2_mega2560.hex auto detected as Intel Hex
avrdude: input file stk500boot_v2_mega2560.hex contains 256458 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 163.26s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x1e000
0xff != 0x0d
avrdude: verification error; content mismatch

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as FD
avrdude: safemode: Fuses OK

avrdude done. Thank you.
Sign up now
to remove ads between posts


Quick Reply
Message:

Thread Tools