Tell me more ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

I have tens of PIC16 chips. I would like to retrieve some kind of unique serial number from the chip for identification purposes. I know it can be done manually. But it's tedious.

Questions:

  1. Does PIC has a built-in serial number?
  2. If the answer is No, is there a easy way to upload a code with unique serial number to each chip when I order the chip from Microchip?
share|improve this question

2 Answers

up vote 13 down vote accepted
  1. No

  2. Is possible, but I don't know what quantities are required, i.e. if they'll do it for tens of devices. We always had batches of at least 1000 parts. It's just like preprogramming with your software, but you indicate at which location(s) the unique ID should be programmed. You'll need to supply the starting ID, and the format (BCD, binary, LSD/MSD first, ...).

Note that this number resides in normal program memory, and it will be erased if you erase the part for reprogramming.

edit
The reason controllers most often don't have this at chip level is that it's expensive: the programming is done by lasering, which is an extra production step. Mass-programmed microcontrollers can easily have the unique ID programmed with the software, and this doesn't require an extra step.

An alternative would be an SSN (Silicon Serial Number) like the Maxim DS2411. These are also laser-programmed, so not cheap either, but you avoid the extra logistic steps, where there can always go something wrong. I've known it happen.
(another edit) Mike suggests a MAC address chip as an alternative. These are EEPROMs which have a unique ID (MAC addresses are globally unique) programmed in a part of the device which is write protected. The rest of the part can be used as normal EEPROM, like for storing device parameters. The EEPROMs appear to be a lot cheaper than the SSN, while serving the same function.


see also
Method for assigning unique per-board addresses

share|improve this answer
Any reason why it's not done always? – Federico Russo Oct 28 '11 at 8:07
@Federico - added to my answer – stevenvh Oct 28 '11 at 8:22
A cheaper alternative to the Dallas/Maxim part is Microchip's Ethernet MAC address chips, which also give you some eeprom space. microchip.com/stellent/… – mikeselectricstuff Oct 28 '11 at 8:59
@stevenvh,thanks for the answer. Especially about SSN. I need to order 100 chips, how to "indicate at which location(s) the unique ID should be programmed. You'll need to supply the starting ID, and the format". You mean I can do this through microchip website when I order the chips? – mlam Oct 28 '11 at 16:11
Thanks @mikeselectricstuff, it's useful. I will consider it. – mlam Oct 28 '11 at 16:11
show 2 more comments

As Steven said, PICs don't have unique serial numbers built into them at manufacturing time. Let's be clear that we're talking about a number that would vary between two chips of the identical model.

Most PICs do have a chip ID encoded into them. This can be read by a PIC programmer to determine the type of PIC it is connected to. As far as I can tell, only the 12 bit core PICs don't have such a chip ID. All the other PIC can be identified electrically, although there are quite a number of differing ways they have to be put into programming mode and then the chip ID read out. PIC programmer software that can identify a arbitrary PIC is not trivial.

If you really meant serial number, then this has to be programmed into the part after production. We have done this many times. During the production test process when the firmware is programmed into the PIC, you set it up to also get a unique serial number and program that in too. One easy way is to start with a master HEX file as produced by the firmware tools. This contains a blank serial number. You write a small program that grabs a new serial number according to whatever your strategy is, reads the master HEX file, substitutes the new serial number for the blank one, and writes out a temporary HEX file. The temporary HEX file is used to program the part, then deleted.

For better robustness, you store the serial number state in EEPROM in the production jig, not in a disk file. The system asks the jig for a new number, and this jig is designed to never give out the same number twice. When it's assiged serial number range is exhausted, it refuses to work. This is especially useful if you have a remote manufacturer building units for you. This way if they mess up something on the computer and restore from backup, it won't also reset the serial number range. Yes, this has actually happened.

If the serial number is to be read from outside, then the user ID locations that most PICs have might be the appropriate place to store it. These differ from general program memory or EEPROM in that they can be read even when the chip is code protected.

If you get your PICs programmed by the Microchip or a distributor, you can usually get them serialized in some way. However, factory programming is only for mature high volume products. If you think you'll be upgrading the firmware regularly, then don't use factory programming. The lead times are long and you'll be stuck with old versions in the pipeline. Your device will have to be tested after it is built anyway, so adding a step to program the PIC is usually very little extra burden.

share|improve this answer
This production jig idea is fantastic! – Joel B Oct 28 '11 at 17:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.