Atmega2560 - Can flash with AVR Studio fine, when flashing with avrdude via linuxgpio I get error

Thread Starter

mbxs3

Joined Oct 14, 2009
170
Hello,

I have been working on a project where I am using a raspberry pi with avrdude to bit bang an atmega2560. If I use, for example, the blink sketch for a Mega, and flash it through my raspberry pi, it works fine. If I use the firmware file that I need for my specific project (provided by a 3rd party) then I get a verification error.

If I use AVR studio to flash the chip with the project specific firmware file then it works fine.

Here are some screenshots of my avrdude flash output:

avrdude-write-read.PNG

I also "verified" the flash that was written by avrdude using AVR studio and received the same verification error:

verify-using-avr-studio.PNG

Any ideas why I may be getting this different response? I will also say that I have multiple "project specific" firmware files that vary in size, one is 11kb and the other is 152kb, so I do not believe the size of the file is an issue.

Thanks,

Mike
 

Thread Starter

mbxs3

Joined Oct 14, 2009
170
The command I am running is:

Code:
avrdude -p m2560 -C ~/AVR/gpio_config/cable1/cable_1.conf -c cable_1 -v -U flash:w:/home/pi/AVR/gpio_config/cable1/MP_US_6-7.hex:i
My "cable_1.conf" for my cable_1 programmer is:

Code:
# Linux GPIO configuration for avrdude.
# Change the lines below to the GPIO pins connected to the AVR.
programmer
  id    = "cable_1";
  desc  = "Use the Linux sysfs interface to bitbang GPIO lines";
  type  = "linuxgpio";
  reset = 4;
  sck   = 3;
  mosi  = 17;
  miso  = 2;
;
 

Thread Starter

mbxs3

Joined Oct 14, 2009
170
It looks like what is happening is that when the line in the intel hex file has a data byte value less than 0x10, that any 0x00 data in that line gets written as 0xFF.

Here is an example arduino "blink" hex file where I manipulated the third from last line to meet the reqyuirement of less than 0x10 data bytes:

Original Hex Line before I Modified: :1005C000FF1F881F8BBF0790F691E02D1994F894B8
Modified Hex Line: :0F05C000FF1F881F8BBF0790F691E02D19940045

Hex line read after flashing with avrdude: 1205C000FF1F881F8BBF0790F691E02D1994FFFFFFCF76

The error occurs at byte 0x05CE which is confirmed when avrdude attempts to verify the read versus the hex file:

Verification error: first mismatch at byte 0x05ce, 0xff != 0x00
 

Attachments

Top