avrsetup not working anymore?


5 posts
by MrGreg » Thu Jan 03, 2013 3:27 pm
I recently bought some fresh atmel 328s
avrsetup returned this

pi@raspberrypi ~ $ avrsetup

Initialising a new ATmega microcontroller for use with the Gertboard.

Make sure there is

a new ATmega chip plugged in, and press
.. 1 for an ATmega328p or 2 for an ATmega168: 1
Initialising an ATmega328p

...
avrdude: Expected signature for ATMEGA328P is 1E 95 0F
Double check chip, or use -F to override this

check.

pi@raspberrypi ~ $

Thought there may be a problem with the chips, so bought some more from a different source.
Same again
did clean install of Raspian and reinstall of "Gordons" avr for gertboard
Still got the problem...


I guess there may be some connection with this post

viewtopic.php?f=42&t=24759

Any ideas on how to get it working?
Posts: 45
Joined: Sun Jun 10, 2012 7:25 pm
by panik » Thu Jan 03, 2013 11:25 pm
MrGreg wrote:I recently bought some fresh atmel 328s

You left out the part where it says what the current device signature is. Did you get ATmega328P, or ATmega328 (without the 'P', for 'Pico-power'). Not to be confused with 'ATmega328-P', or 'ATmega328-PU'. That's a different 'P'.

Avrdude says the following if you tell it to use an ATmega328P, but feed it an ATmega328 (non-P):
Code: Select all
avrdude: Device signature = 0x1e9514
avrdude: Expected signature for ATMEGA328P is 1E 95 0F
         Double check chip, or use -F to override this check.

Gordon's patched avrdude is not the latest, where the non-P's are supported. But there are ways around it: http://www.avrfreaks.net/index.php?name ... c&p=922850
Posts: 222
Joined: Fri Sep 23, 2011 12:29 pm
Location: Netherlands
by MrGreg » Fri Jan 04, 2013 12:18 pm
Ah Ha...
They are (the more common?) 328-PU devices

I did try the -F option to no avail. I will take a look at the work around in the next few days. I'm sure I am not the first or last to encounter this problem.
Many thanks for the info.

Perhaps the nice Mr Gordon H. will update the patched averdude.

Happy new year to all
Posts: 45
Joined: Sun Jun 10, 2012 7:25 pm
by panik » Fri Jan 04, 2013 1:32 pm
Yeah, easy to make 'mistake'. I think they're 'newer', not necessarily 'more common' but who knows? All is not lost, the problem will solve itself in time. You definitely won't be the first or last, as you say.

The '-F' option did work for me, though. Setting the fuses (you could edit the avrsetup script):
Code: Select all
avrdude -F -qq -c gpio -p atmega328p -U lock:w:0x3F:m -U efuse:w:0x07:m -U lfuse:w:0xE7:m -U hfuse:w:0xD9:m

Force uploading 'blinky.hex' to an ATmega328 (non-P):
Code: Select all
avrdude -F -p atmega328p -c gpio -v -U flash:w:blinky.hex

I don't know how you would pass the -F option in the Arduino IDE (if you use that), so hacking /etc/avrdude.conf is probably your best option here. If the 328 non-P's are the only ones you have, you probably get away with only changing the 0x0F in the 'signature' entry of the ATmega328P to 0x14, and leave the rest 'as is'. Haven't tried though.

Let us know how it goes?
Posts: 222
Joined: Fri Sep 23, 2011 12:29 pm
Location: Netherlands
by MrGreg » Fri Jan 04, 2013 2:57 pm
Bingo..!

The quick and dirty hack of changing the sig to 0x14 in avrdude.conf worked.
Blinky is blinking again :)

This will do fine as I now have several 328-PU devices (Well for now)

To anyone doing this, avrdude.conf is a really big file.! The 328p section is a little past half way down.

Many thanks
Posts: 45
Joined: Sun Jun 10, 2012 7:25 pm