Atmega328pb serial number format?

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm using the unique serial numbers in the atmega328pb to identify and track our products, but there are way more bytes (10) than I really need (2-3).  

 

Anyone know how ATMEL assigns these?  Are they just serialized (i.e. can I just use the last 3 bytes), or is there another coding they use?

 

My coworkers in customer service will be angry if they need customers to read 20 hexadecimal digits... so I'd like to distill this to 3 unique bytes.

 

(Yes, I could burn a serial number of my choosing in EEPROM, but I'd like to use the built-in one if possible.)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You could run the chip's serial number through a hash function with the appropriate length output value and use that as the ID.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jrs454 wrote:
but there are way more bytes (10) than I really need

What does the datasheet say?  devil

33.5. Serial Number
Each individual part has a specific serial number. This can be used to identify a specify part while it is in
the field.
The serial number consists of nine bytes which can be accessed from the signature address space.
 

(but that is a typo, as we see bytes 0-9 in the address chart:)

Now I have to say something useful -- I seem to recall that an early adopter played with a few, and part of the serial number appeared to be equivalent to "model number".  You'd probably need a few units, and/or 'Freaks help with their units, to confirm.

 

Anecdotal results here, which is probably the thread I was thinking of:

https://www.avrfreaks.net/forum/u...

 

Now, many of the results posted there were for Mega168PB.  Let's grab a few from that thread for discussion...

Serial Number :  0x59 0x34 0x37 0x31 0x37 0x37 0xFF 0x3 0x1C 0x16

Serial Number :  0x4A 0x39 0x33 0x34 0x33 0x30 0xFF 0x16 0x3 0x9
Serial Number :  0x6E 0x75 0x6E 0x6B 0x77 0x6F 0xFF 0x3 0x21 0x16

There w3as some discussion there about Xmega serial numbers which have die/die position info.

 

Look at the above:  The first 6 bytes are decodable characters.  The 7th is 0xff, and then perhaps 24 bits of "real" serial number?

Y47177 ... 203798

J93430 ... 1442569

nunkwo ... 205078   (that last one sure looks like "unknown" to me -- maybe the die info in an ES device?)

 

[edit] byte swap the last into 16-bit chunks and un kn ow  -- "unknow[n]"

Perhaps the last bytes also?  Dunno.

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Last Edited: Mon. May 1, 2017 - 08:48 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Let us say that the ATmega328PB sells in large quantities.   e.g. 1 billion.  

A 4-byte binary Serial number would go up to 4 billion.

A 5-byte BCD Serial number would go up to 9,999,999,999 e.g. 10 billion

 

So yes,  9 bytes seems like overkill.  But hey-ho,  it is always wise to design for success.  e.g. 1000 billion.  5-byte binary or 6-byte BCD.

 

David.

Last Edited: Mon. May 1, 2017 - 08:51 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This thread https://www.avrfreaks.net/comment... has discussion of Tiny/AVR8/Xmega lot number decoding (as marked on the chip) and correspondence to signature row values.  Might be workth the exercise with '328PB you have in hand?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is this different to Xmega then? In that the ID is made up of things like the manufacture year, week, wafer number, x and y position on the wafer and so on. I'm pretty sure the Xmega data explains all this. Is there some reason to assume 328pb is different in some way? (bit if an oversight if the data doesn't mimic Xmega though). 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

From one of the links I dug out above, it mentions Xmega is 11 bytes.  I didn't follow up, but just that would mean non-identical mapping, right?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can probably form pairs ...maybe add bytes 0,2,4,6,8  bytes 1,3,5,7,9  bytes 0,1,4,5,8,9  bytes 2,3,6,7  bytes 0,2,5,9  now you have 40 bits of likely randomness.  Using 36 symbols (A-Z & 0-9) 40 bits can be represented by 7.74  (8)  digits of password entry.  or exactly 8 digits of a 32 symbol alphabet.

 

So that might tell someone who has a database of all of the bytes which unit it is (through matching).  You can't go from the 8 chars back to the 80 bits (but you can go from 80 bits in a database to 8 chars).

 

Or maybe you just want to punch in a code to verify that a caller's unit is "valid" (yes/no) rather than figuring out which unit it is.  That can be slightly different/easier. 

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is it important to positively and uniquely identify each device, or is it enough if there is a "quite high" probability that the device is legit?

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Tue. May 2, 2017 - 02:29 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:
Is it important to positively and uniquely identify each device, or is it enough if there is a "quite high" probability that the device is legit?

 

"quite high" is adequate.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:
You could run the chip's serial number through a hash function with the appropriate length output value and use that as the ID.

 

Not knowing anything about the SN format, how would I choose/design a hash function that prevented collisions?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have a read on Wikipedia on the 'Birthday Attack'; there's a useful table in there that relates hash-size to probability of a collision. Then see this thread on Stackoverflow...

 

http://stackoverflow.com/questio...

 

 

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Perhaps a CRC-type operation?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.