User avatar
dobra-dobra
Posts: 34
Joined: Wed Dec 26, 2012 2:04 pm
Location: Poland

[SOLVED] ATmega48 - not reliable avrdude

Sun Dec 22, 2013 12:13 am

I'm spending my free time tinkering with GertDuino, which I have bought this week. I had an idea to use Ino (http://inotool.org/) to build .hex files for ATmega328 and 48 from command line, which I will then upload using avrdude (I have modified Gert's program_328 and program_48 scripts for this purpose). Initial setup was done with great help of Gordon's site (https://projects.drogon.net/raspberry-p ... ega-setup/).

The thing is that for 328 everything works great, while for 48 I got a lot of errors from avrdude. For example:

Code: Select all

ino build -m gertduino48
/usr/bin/avrdude -c gpio -p m48p ./.build/gertduino48/firmware.hex -U flash:w:./.build/gertduino48/firmware.hex
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e920a
avrdude: safemode: Verify error - unable to read lfuse properly. Programmer may not be reliable.
avrdude: safemode: To protect your AVR the programming will be aborted

avrdude done.  Thank you.
or

Code: Select all

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x003d0a
avrdude: Expected signature for ATMEGA48P is 1E 92 0A
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.
Similar situation is when I try to program it from Arduino IDE (also here 328 works without any problems).
But still once for a time it is possible to succeed:

Code: Select all

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e920a
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: current erase-rewrite cycle count is -512 (if being tracked)
avrdude: erasing chip
avrdude: reading input file "./.build/gertduino48/firmware.hex"
avrdude: input file ./.build/gertduino48/firmware.hex auto detected as Intel Hex
avrdude: writing flash (952 bytes):

Writing | ################################################## | 100% 0.13s

avrdude: 952 bytes of flash written
avrdude: verifying flash memory against ./.build/gertduino48/firmware.hex:
avrdude: load data flash data from input file ./.build/gertduino48/firmware.hex:
avrdude: input file ./.build/gertduino48/firmware.hex auto detected as Intel Hex
avrdude: input file ./.build/gertduino48/firmware.hex contains 952 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.07s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0x41 != 0x00
avrdude: verification error; content mismatch

avrdude: safemode: Verify error - unable to read lfuse properly. Programmer may not be reliable.
avrdude: safemode: Verify error - unable to read lfuse properly. Programmer may not be reliable.
avrdude: safemode: Sorry, reading back fuses was unreliable. I have given up and exited programming mode

avrdude done.  Thank you.
It is totally random and still there is a verification error, but I have confirmed with blink sketch and LED trick from manual that it is possible to program it. I tried to purge arduino and start over again, but without any improvement. Can I ask for some suggestions? :roll:

EDIT

In other thread (http://www.raspberrypi.org/forum/viewto ... 96&t=62026) I have found Gordon's suggestion that such behaviour can occur when RPi is overclocked. It turns out out that some time ago I overclocked my Pi and forgot about that. After returning to factory settings everything runs as it should.

Return to “HATs and other add-ons”