Author Topic: AVR Device Signature  (Read 6519 times)

0 Members and 1 Guest are viewing this topic.

Offline admiralkTopic starter

  • Regular Contributor
  • *
  • Posts: 178
  • Country: us
AVR Device Signature
« on: September 05, 2018, 12:24:36 am »
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: [Select]
avrdude: Device signature = 0x1e9511
avrdude: Expected signature for ATMEGA324P is 1E 95 08
         Double check chip, or use -F to override this check.

A newer version of the avrdude.conf lists:

Code: [Select]
#------------------------------------------------------------
# ATmega324PA
#------------------------------------------------------------

# similar to ATmega324P

part 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: [Select]
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System 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. 

 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8416
Re: AVR Device Signature
« Reply #1 on: September 05, 2018, 12:29:06 am »
Compare datasheets and note any differences in programming.
 

Online westfw

  • Super Contributor
  • ***
  • Posts: 4315
  • Country: us
Re: AVR Device Signature
« Reply #2 on: September 05, 2018, 12:40:43 am »
I think they should be identical from an ISP perspective.https://datasheet.octopart.com/ATMEGA164PA-ANR-Atmel-datasheet-85429918.pdf(Atmel gets poor marks for some of their part numbering and signature choices, IMO.  :palm: )
 

Offline alank2

  • Super Contributor
  • ***
  • Posts: 2196
Re: AVR Device Signature
« Reply #3 on: September 05, 2018, 01:38:15 am »
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.
 

Offline admiralkTopic starter

  • Regular Contributor
  • *
  • Posts: 178
  • Country: us
Re: AVR Device Signature
« Reply #4 on: September 05, 2018, 02:00:58 am »
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: [Select]
avrdude: error at E:\WinAVR-20100110\bin\avrdude.conf:320: programmer type must
be written as "id_type"
avrdude: error reading system wide configuration file "E:\WinAVR-20100110\bin\av
rdude.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.
 

Offline alank2

  • Super Contributor
  • ***
  • Posts: 2196
Re: AVR Device Signature
« Reply #5 on: September 05, 2018, 12:24:45 pm »
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.
 

Offline admiralkTopic starter

  • Regular Contributor
  • *
  • Posts: 178
  • Country: us
Re: AVR Device Signature
« Reply #6 on: September 05, 2018, 08:22:56 pm »
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: [Select]
5.1 6.3

chip_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.
 

Offline HwAoRrDk

  • Super Contributor
  • ***
  • Posts: 1564
  • Country: gb
Re: AVR Device Signature
« Reply #7 on: September 05, 2018, 09:21:20 pm »
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 -C command line argument to supply a path to this new configuration file - e.g. -C "c:\your\path here\avrdude_new.conf".
- Put just the additional MCU part definition in a avrdude.rc in 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).
 

Offline admiralkTopic starter

  • Regular Contributor
  • *
  • Posts: 178
  • Country: us
Re: AVR Device Signature
« Reply #8 on: September 06, 2018, 01:00:24 am »
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.
 

Offline JustMeHere

  • Frequent Contributor
  • **
  • Posts: 817
  • Country: us
Re: AVR Device Signature
« Reply #9 on: September 06, 2018, 01:24:12 am »
I've always had beat luck with Avrdude located here:
http://download.savannah.gnu.org/releases/avrdude/
 

Offline admiralkTopic starter

  • Regular Contributor
  • *
  • Posts: 178
  • Country: us
Re: AVR Device Signature
« Reply #10 on: September 06, 2018, 11:55:12 pm »
I am not sure what I am doing wrong here? I tried the avrdude.rc route and got this

Code: [Select]
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 "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:7

I 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, looking here, I cannot see anything wrong.

Quote
Parts can also inherit parameters from previously defined parts using the following syntax. In this case specified integer and string values override parameter values from the parent part. New memory definitions are added to the definitions inherited from the parent.
    

   part parent <id>                              # quoted string
       id               = <id> ;                 # quoted string
       <any set of other parameters from the list above>
     ;

I 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 result

Code: [Select]
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "E:\arduino-1.8.5\hardware\tools\avr\
etc\avrdude.conf"

         Using Port                    : usb
         Using Programmer              : usbasp
avrdude: usbasp_open("usb")
avrdude: Warning: cannot query manufacturer for device: No such file or director
y
avrdude: Warning: cannot query product for device: No such file or directory
avrdude: 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 port
 
Code: [Select]
Using Port                    : lpt1Hopefully that will fix it, but it will have to wait until tomorrow.
 

Offline admiralkTopic starter

  • Regular Contributor
  • *
  • Posts: 178
  • Country: us
Re: AVR Device Signature
« Reply #11 on: September 07, 2018, 07:00:30 pm »
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.
 

Offline JustMeHere

  • Frequent Contributor
  • **
  • Posts: 817
  • Country: us
Re: AVR Device Signature
« Reply #12 on: September 09, 2018, 10:27:52 am »
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 usbtiny

Also the config file in this zip is correct:
http://download.savannah.gnu.org/releases/avrdude/avrdude-6.3-mingw32.zip

This is the best ARVDUDE site:
http://savannah.nongnu.org/projects/avrdude
 

Offline admiralkTopic starter

  • Regular Contributor
  • *
  • Posts: 178
  • Country: us
Re: AVR Device Signature
« Reply #13 on: September 09, 2018, 06:33:28 pm »
For the first one, the whole thing is

Code: [Select]
C:\Users\admin>avrdude -c usbasp -p m324pa -v -v -v -v

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 "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:7

C:\Users\admin>

and the user config is
Code: [Select]
#------------------------------------------------------------
# ATmega324PA
#------------------------------------------------------------

# similar to ATmega324P

part 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.
 

Online westfw

  • Super Contributor
  • ***
  • Posts: 4315
  • Country: us
Re: AVR Device Signature
« Reply #14 on: September 10, 2018, 01:27:49 am »
Quote
Code: [Select]
syntax error at E:\WinAVR-20100110\bin\avrdude.rc:7
Quote
the most common solution was to install a different driver.
Installing 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: [Select]
avrdude -c arduino               -p ATmega324PA -P /dev/tty.usbserial-FTD61T6Q -t -b19200
avrdude: error at /usr/local/Cellar/avrdude/6.3/etc/avrdude.conf:7: can't find parent part
avrdude: error reading system wide configuration file "/usr/local/Cellar/avrdude/6.3/etc/avrdude.conf"
 

Offline JustMeHere

  • Frequent Contributor
  • **
  • Posts: 817
  • Country: us
Re: AVR Device Signature
« Reply #15 on: September 10, 2018, 05:07:07 am »
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".)



 

Offline admiralkTopic starter

  • Regular Contributor
  • *
  • Posts: 178
  • Country: us
Re: AVR Device Signature
« Reply #16 on: September 10, 2018, 09:24:55 pm »
Hmmm, it must more than the config file Arduino messed with because I get the same error.

Code: [Select]
C:\Users\admin>E:\arduino-1.8.5\hardware\tools\avr\bin\avrdude -c usbasp -p m324
pa -C C:\avrdude.conf -v

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\avrdude.conf"

         Using Port                    : usb
         Using Programmer              : usbasp
avrdude: Warning: cannot query manufacturer for device: No such file or director
y
avrdude: Warning: cannot query product for device: No such file or directory
avrdude: 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: [Select]
C:\Users\admin>H:\Downloads\Web\avrdude-6.3-mingw32\avrdude -c usbasp -p m324pa
-C C:\avrdude.conf

avrdude: warning: cannot set sck period. please check for usbasp firmware update
.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: 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.

Quote
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!
That 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf