MCU User Forum
  MCU User Forum
  Automatically assigning Serial Numbers

Post New Topic  Post A Reply
profile | register | preferences | faq | search

UBBFriend: Email This Page to Someone! next newest topic | next oldest topic
Author Topic:   Automatically assigning Serial Numbers
jcb095
New Member
posted February 28, 2006 08:07 AM     Click Here to See the Profile for jcb095   Click Here to Email jcb095     Edit/Delete Message
I am using the C8051F320 micro and I would like to automatically assign each micro with a Serial number. What is the best way to accomplish this? Thanks in advance.

IP: Logged

ReneK
Member
posted February 28, 2006 08:42 AM     Click Here to See the Profile for ReneK   Click Here to Email ReneK     Edit/Delete Message
This is what I do:

I wrote a simple serial number genrator that fits my needs (it simply generates the number and writes it as serial number descriptor into an asm or c file).

Production programming is done by a small script. This script
- Invokes the serial number generator
- Invokes the Assembler or C-Compiler to translate the generated file
- Invokes the linker to link the project files
- Downloads the newly created hex file into the MCU

I don't know if this is the best way, but it is good enough for me.

IP: Logged

jeremy
New Member
posted February 28, 2006 03:22 PM     Click Here to See the Profile for jeremy     Edit/Delete Message
Give your serial number an absolute location in code space (using the _at_ keyword), then after you program the micro, you can use the Flash Utils DLL to set your serial number.

Alternatively, a serial number generator could generate a HEX file to program the serial number into the right place.

IP: Logged

Tsuneo
Member
posted March 01, 2006 09:15 AM     Click Here to See the Profile for Tsuneo   Click Here to Email Tsuneo     Edit/Delete Message
- The code FLASH is erased to 'FF' in this MCU. And when the data written to it is 'FF', no write procedure is actually performed to that byte, it remains 'FF'.
- "Flash program utilities" can 'overwrite' a range of the code FLASH without erasing other part.

a) Fill the range to be replaced with 'FF' on the original firmware.

// string descriptor for serial number: ABC12345
{ 18, // number of bytes in this descriptor
0x03, // identifier of the descriptor
'A', 0,
'B', 0,
'C', 0,
'1', 0,
'2', 0,
'3', 0,
'4', 0,
'5', 0 };

// string descriptor for serial number: ABCxxxxx
{ 18, // number of bytes in this descriptor
0x03, // identifier of the descriptor
'A', 0,
'B', 0,
'C', 0,
0xFF, 0xFF,
0xFF, 0xFF,
0xFF, 0xFF,
0xFF, 0xFF,
0xFF, 0xFF };


b) Locate the range on the code FLASH after linking it.
- find its address on the linker map
- confirm it with the IDE 'Tools' menu > 'Upload memory to file', after loading the firmware to the MCU.

c) Using the "Flash program utilities", overwrite the address in the serial number.

Anyway you need a 'serial number generator' program.
If a binary file can be generated, BIN2HEX converts it to a hex file.
"GENERAL: MAKING HEX FILES FROM BINARY FILES"

Tsuneo

IP: Logged

frief
Member
posted March 01, 2006 09:30 AM     Click Here to See the Profile for frief     Edit/Delete Message
Ideally someone would implement this for srecord:
http://sf.net/projects/srecord/
or more specifically
http://sourceforge.net/tracker/index.php?func=detail&aid=776221&group_id=72866&atid=535953

IP: Logged

erikm
Member
posted March 03, 2006 08:32 AM     Click Here to See the Profile for erikm   Click Here to Email erikm     Edit/Delete Message
why not include a Dallas DS2411?

Erik

IP: Logged

stoyanmihaylov
New Member
posted March 19, 2006 07:04 AM     Click Here to See the Profile for stoyanmihaylov   Click Here to Email stoyanmihaylov     Edit/Delete Message
Some time ago I and one my colegue did something similar.
I made loader (using supplied DLLs), this loader had connection to MySQL. It did couple of things:
1. Connect to MySQL
2. Get bootloader.hex
3. Create and get unique.hex
4. Loads all code
To have unique number, I am printing small labels with unique number which are something like 1a22w - and I am using barcodes also to automate whole proces. Meaning - I refuse to load code without unique number. And number is unique - MySQL can guarantee it.
I used this technique to load unique key for criptography.

IP: Logged

All times are CT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | MCU User Forum

Have you seen our MCU Knowledge Base?


Ultimate Bulletin Board 5.47b

Site Guide Privacy Legal