AVR Device Signature - Page 1
Forum section: electronics / general

author: admiralk
author_rank: Regular Contributor
timestamp: September 05, 2018, 12:24:36 am
content: I have a small problem that is mostly due to the mixed up file system on my PC, and will probably be fixed when I get around to installing a new C: drive, but until then...Just how important is having the correct device signature? As far as I can tell, it is only wrong due to being a newer chip; PA instead of P, and an older version of avrdude. I run into problems here:Code:avrdude: Device signature = 0x1e9511avrdude: Expected signature for ATMEGA324P is 1E 95 08Double check chip, or use -F to override this check.A newer version of the avrdude.conf lists:Code:#------------------------------------------------------------# ATmega324PA#------------------------------------------------------------# similar to ATmega324Ppart parent "m324p"id = "m324pa";desc = "ATmega324PA";signature = 0x1e 0x95 0x11;ocdrev = 3;;So that is apparently the problem with the device signature, since that is not in the older config file. Unfortunately, that version is overriding the newer one.Code:avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/Copyright (c) 2007-2014 Joerg WunschSystem wide configuration file is "E:\WinAVR-20100110\bin\avrdude.conf"I can think of three fixes. 1)Use the -F switch, but I am not sure of how good an idea that is, or how well it will work when it comes to actually flashing the chip. 2)Somehow get rid of the system wide configuration, uninstalling WinAVR did not help. 3)Copy that part of the newer config file to the older one.The new C: drive would accomplish #2, but is not likely to happen anytime soon. #3 would be the easiest, I assume I should put it right after the ATmega324P part like in the newer one. Before I, possibly, make a bigger mess of things than I have already, it would be nice to get some better informed opinions.

author: amyk
author_rank: Super Contributor
timestamp: September 05, 2018, 12:29:06 am
content: Compare datasheets and note any differences in programming.

author: westfw
author_rank: Super Contributor
timestamp: September 05, 2018, 12:40:43 am
content: I think they should be identical from an ISP perspective.https://datasheet.octopart.com/ATMEGA164PA-ANR-Atmel-datasheet-85429918.pdf(Atmelgets poor marks for some of their part numbering and signature choices, IMO.)

author: alank2
author_rank: Super Contributor
timestamp: September 05, 2018, 01:38:15 am
content: Different Atmel AVR parts can be very similar, P vs. PA, P vs. non-P, etc., but they will have a different signature to reflect their actual model. Often the same code (HEX or ELF) will run perfectly fine on different variants.

author: admiralk
author_rank: Regular Contributor
timestamp: September 05, 2018, 02:00:58 am
content: I think it is just that the PA version did not exist when avrdude 5.1 came out, but did exist when 6.3 came out. If I could use 6.3 there should not be a problem. When I try to use 6.3 however, I get this:Code:avrdude: error at E:\WinAVR-20100110\bin\avrdude.conf:320: programmer type mustbe written as "id_type"avrdude: error reading system wide configuration file "E:\WinAVR-20100110\bin\avrdude.conf"I guess I forgot to show that part.I am not so much worried about code compatibility as my ability to simply program it in the first place.

author: alank2
author_rank: Super Contributor
timestamp: September 05, 2018, 12:24:45 pm
content: I'm not familiar with avrdude, but perhaps there is a way to specify the signature manually? I sell some programmers that are standalone - you program them with a PC and then they can be taken to an AVR project/device and program it without the PC. My way of dealing with this is to allow someone to put in a manual signature, and you can select multiple signatures and connect them to a single firmware. Contact me via PM and I'll send you a link to my auctions/manual if you want to take a look at the autoprogrammer.

author: admiralk
author_rank: Regular Contributor
timestamp: September 05, 2018, 08:22:56 pm
content: Thanks, but I am not looking for a different tool chain.With the -F switch, avrdude continues and reports the fuses are OK, like it should, so it should work that way. Besides the missing bit about the ATmega324PA, the only relevant differences I found in the config file were:Code:5.16.3chip_erase_delay = 9000;chip_erase_delay = 55000;ocdrev = 3;I am not sure what that means, but I guess I can try adding the lines to the config file and see if that works.

author: HwAoRrDk
author_rank: Super Contributor
timestamp: September 05, 2018, 09:21:20 pm
content: If your installed version of avrdude is lacking a definition for the ATmega324PA, then if you have the correct definition available, you can get avrdude to use it in either of two ways:- Copy the main avrdude.conf file, add the PA definition, then use the-Ccommand line argument to supply a path to this new configuration file - e.g.-C "c:\your\path here\avrdude_new.conf".- Putjustthe additional MCU part definition in aavrdude.rcin the same directory as the executable. This is a 'local' config file intended to supplement the main config file, so you can add stuff without modifying the main one (allowing for easy upgrades that don't wipe out your customisations or additions).

author: admiralk
author_rank: Regular Contributor
timestamp: September 06, 2018, 01:00:24 am
content: Ahh, now we are getting somewhere. I am going to have to look that all up, when I am more awake, but it sounds like with the -C switch I can get it to use the newer config file. I think I like the second one better though. Either way, I could not mess up something that is otherwise working. It would be good to get rid of the warning before I do more than blink some LEDs with a button.Thanks.

author: JustMeHere
author_rank: Frequent Contributor
timestamp: September 06, 2018, 01:24:12 am
content: I've always had beat luck with Avrdude located here:http://download.savannah.gnu.org/releases/avrdude/

author: admiralk
author_rank: Regular Contributor
timestamp: September 06, 2018, 11:55:12 pm
content: I am not sure what I am doing wrong here? I tried the avrdude.rc route and got thisCode:avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/Copyright (c) 2007-2009 Joerg WunschSystem wide configuration file is "E:\WinAVR-20100110\bin\avrdude.conf"User configuration file is "E:\WinAVR-20100110\bin\avrdude.rc"syntax error at E:\WinAVR-20100110\bin\avrdude.rc:7I used the definition in my first post which should have the right syntax, since I copied it from a different config file. Line 7 is the parent part line. Also, lookinghere, I cannot see anything wrong.QuoteI tried adding it to a copy of the config file and got the same result with the -C switch. Also, with the -C switch, I was able to get the newer version to use its config file, but with this resultCode:avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/Copyright (c) 2007-2014 Joerg WunschSystem wide configuration file is "E:\arduino-1.8.5\hardware\tools\avr\etc\avrdude.conf"Using Port : usbUsing Programmer : usbaspavrdude: usbasp_open("usb")avrdude: Warning: cannot query manufacturer for device: No such file or directoryavrdude: Warning: cannot query product for device: No such file or directoryavrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'avrdude done. Thank you.Wait, maybe I found the problem. I just noticed that with the -F switch it uses a different portCode:Using Port : lpt1Hopefully that will fix it, but it will have to wait until tomorrow.

author: admiralk
author_rank: Regular Contributor
timestamp: September 07, 2018, 07:00:30 pm
content: Nope, changing the port made no difference. I guess I am stuck with the -F switch until I get around to changing out a couple HDDs in my PC. Unless I can figure out the syntax error for the avrdude.rc file.

author: JustMeHere
author_rank: Frequent Contributor
timestamp: September 09, 2018, 10:27:52 am
content: Hmm, what's your command line? Your first error message doesn't make sense if you are using the right part switch. It should be something like:avrdude -p m324pa -c usbtinyAlso the config file in this zip is correct:http://download.savannah.gnu.org/releases/avrdude/avrdude-6.3-mingw32.zipThis is the best ARVDUDE site:http://savannah.nongnu.org/projects/avrdude

author: admiralk
author_rank: Regular Contributor
timestamp: September 09, 2018, 06:33:28 pm
content: For the first one, the whole thing isCode:C:\Users\admin>avrdude -c usbasp -p m324pa -v -v -v -vavrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/Copyright (c) 2007-2009 Joerg WunschSystem wide configuration file is "E:\WinAVR-20100110\bin\avrdude.conf"User configuration file is "E:\WinAVR-20100110\bin\avrdude.rc"syntax error at E:\WinAVR-20100110\bin\avrdude.rc:7C:\Users\admin>and the user config isCode:#------------------------------------------------------------# ATmega324PA#------------------------------------------------------------# similar to ATmega324Ppart parent "m324p"id = "m324pa";desc = "ATmega324PA";signature = 0x1e 0x95 0x11;ocdrev = 3;;Looking further into the second error, I found that the most common solution was to install a different driver. I also saw one mention about Arduino doing something to the avrdude it used. Since it works otherwise and I am using an avrdude from an Arduino install, maybe that is the problem. I will try using the config file from your link and see if that makes a difference when I get a chance.

author: westfw
author_rank: Super Contributor
timestamp: September 10, 2018, 01:27:49 am
content: QuoteQuoteInstalling a new driver is not going to fix your inability to properly edit the avrdude.rc file...The config you've added looks correct, but in order for it to work, it has to be inserted in config file AFTER the defintion of the "parent" that it references. Since it's reporting an error on line 7, presumably you have added the definition right at the top of the file, and that isn't going to work!My much newer version (6.3) of avrdude has a better error message:Code:avrdude -c arduino -p ATmega324PA -P /dev/tty.usbserial-FTD61T6Q -t -b19200avrdude: error at /usr/local/Cellar/avrdude/6.3/etc/avrdude.conf:7: can't find parent partavrdude: error reading system wide configuration file "/usr/local/Cellar/avrdude/6.3/etc/avrdude.conf"

author: JustMeHere
author_rank: Frequent Contributor
timestamp: September 10, 2018, 05:07:07 am
content: Cool. The avrdude in that zip is the one I use.Here are some gotchas I've learned the hard way:Keep your programming header clean. Don't let the flux left over from soldering ruin your night.Make sure to bias your CS pins if you any other devices on your SPI bus. Generally that means pull them high. You don't want a slave device seeing the programming and think its being accessed. (This actually goes for many things. While programming your output pins will be floating. This can cause unpredictable things to happen. Ex: a relay opening/closing for "no reason".)

author: admiralk
author_rank: Regular Contributor
timestamp: September 10, 2018, 09:24:55 pm
content: Hmmm, it must more than the config file Arduino messed with because I get the same error.Code:C:\Users\admin>E:\arduino-1.8.5\hardware\tools\avr\bin\avrdude -c usbasp -p m324pa -C C:\avrdude.conf -vavrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/Copyright (c) 2007-2014 Joerg WunschSystem wide configuration file is "C:\avrdude.conf"Using Port : usbUsing Programmer : usbaspavrdude: Warning: cannot query manufacturer for device: No such file or directoryavrdude: Warning: cannot query product for device: No such file or directoryavrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'avrdude done. Thank you.However, with this one.Code:C:\Users\admin>H:\Downloads\Web\avrdude-6.3-mingw32\avrdude -c usbasp -p m324pa-C C:\avrdude.confavrdude: warning: cannot set sck period. please check for usbasp firmware update.avrdude: AVR device initialized and ready to accept instructionsReading | ################################################## | 100% 0.01savrdude: Device signature = 0x1e9511 (probably m324pa)avrdude: safemode: Fuses OK (E:FF, H:99, L:62)avrdude done. Thank you.I would expect 6.3 to be 6.3. Outside of a different compile time, which you really would not notice unless you were looking, I do not know how to tell the two apart. I know I do not need the -C switch anymore, with this one, I just used it to see if it maybe I was typing something wrong and that was why id did not work with the Arduino one.QuoteThat was the entirety of avrdude.rc. When I added it to the config file the error line 4000 or so. Since there is a 2.5 hr difference in compile times, I can only guess that they changes something in avrdude itself that makes it not read the config right.Anyway, it is working now and I do not have to ignore the warning I got from using the -F switch. Thanks to everyone who helped me through this! Now off to the datasheet to learn about timers and interrupts.