Unique Serial Number or Mac Address in XMC4400

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User7757
Level 2
Level 2
Hi, I'm trying to find a way to retrieve a unique Serial Number from every chip. That Serial Number must be write protected so it can't be overwritten when we re-program the device. What's the best way to do it? So far, I tried to program the BMI (boot-mode index) in the UCB2 page 1, but it doesn't seem to work. The Mac Address in BMI block copied in DSRAM1 at bootup is not constant and doesn't correspond to the value I want. However, the BMI Word (4 bytes in BMI string) is written successfully (I set the Mac Address valid flag). Any idea what I'm doing wrong?

Thanks,
Cedric
0 Likes
19 Replies
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
"That Serial Number must be write protected so it can't be overwritten when we re-program the device."

Yes, the above mention can be write protect using UCB0 or UCB1 (Selected memory sector write protection). However to protect a few words will be quite a waste to be done on a memory sector of 16KB in size (This is the smallest sector).


"So far, I tried to program the BMI (boot-mode index) in the UCB2 page 1, but it doesn't seem to work."

Can you check on the command sequence?
0 Likes
User7757
Level 2
Level 2
I took the code from FLASH002 app.

Here what I do to call the function to write the BMI :

status_t st;
const FLASHBMIString_Type MyBMITestString =
{
//boot mode
FLASH_BMI_BOOT_NORMAL,
//BMI Flags
FLASH_BMI_MAC_ADDR_VALID,
//MAC ADDR extension
{0x07,0xDD,0x09,0x20,0x22,0x90},
//IP ADDR extension
{0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA, 0x99, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00},
//USB serial number
{0x12, 0x34, 0x56, 0x78}
};
st = FLASH002_EraseUCB(2);
st = FLASH002_ConfigureBMI (&MyBMITestString);

- functions always return SUCCESS
- When I look at the BMI string copied in DSRAM1 after boot-up, the BMI Word (4 bytes) seems correct (the MAC P flag is set), but the MAC Address (6 bytes) is not set.
- The MAC Address is not constant and is sometime modified upon reset. I need the MAC address to keep its value forever...
- Do I need to erase the UCB before I call the FLASH002_ConfigureBMI? I tried with or without erasing and got the same result.

Thanks,
Cedric
0 Likes
User7757
Level 2
Level 2
I'm still waiting for a solution to write-protect a 6 byte MAC ADDRESS in flash. Anyone can help?
0 Likes
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Hi furterRMDS,

"I'm still waiting for a solution to write-protect a 6 byte MAC ADDRESS in flash. Anyone can help?"

Do you mean that you want to write protect the MAC Address which is written into the UCB to prevent unnecessary overwritting during flash programming? If Yes, then this might be unnecessary as the UCB has no chance of overwritting during flash programming.

"- The MAC Address is not constant and is sometime modified upon reset. I need the MAC address to keep its value forever..."

I have to check on this.



Best Regards
Travis
0 Likes
User7757
Level 2
Level 2
"Do you mean that you want to write protect the MAC Address which is written into the UCB to prevent unnecessary overwritting during flash programming? If Yes, then this might be unnecessary as the UCB has no chance of overwritting during flash programming."

No, the real problem is that the UCB MAC Address is not written with the code above. I was just asking if there was another solution. I think I will reserve a 16 KB Sector just for the MAC Address.

Thanks,
Cedric
0 Likes
User7372
Level 2
Level 2
Hi Travis,

when I read through the reference manual (xmc4500_rm_v1.3_2013_08.pdf), I came across the SCU fields ID, IDCHIP and IDMANUF (section 11.10, pages 527ff) and wondered if IDCHIP would be as unique as the manual states "Register containing unique ID of the chip."
However, after reading this register from a hand-full of devices, I just got two different values.

Now, is there already a real unique ID somewhere on the chip, or do we have to rely on external components/tasks (manually flashing or e.g. the DS28CM00 silicon serial number chip) to get a unique, but constant, number?

-Benjamin
0 Likes
User7372
Level 2
Level 2
OK, at least for part 1 of my question I've found the answer myself:

The SCU_IDCHIP register is not unique among devices of the same stepping, but rather and indicator of which stepping the chip is from: http://www.infineonforums.com/threads/1014-Atep-aa-ab-ac-differences#post2959

-Benjamin
0 Likes
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Hi benjamin.st,

"I'm trying to find a way to retrieve a unique Serial Number from every chip. That Serial Number must be write protected so it can't be overwritten when we re-program the device."

You can have a look at the "IDCHIP" register. This is preprogrammed in the factory and there is no way that this can be erased. Am I right to say that you are trying to do some kind of authentication using this ID? Please note that the Chip ID will be the same from the same batch of MCU.

The BMI UCB2 page 1 however does allow user to program the MAC address and IP address which is unique to every chip. But in your case the MAC address seems to be unstable when it is stored into the DSRAM1. Please let me check on this application and get back to you.
0 Likes
User7372
Level 2
Level 2
Hi furterRMDS, Travis,

@furterRMDS: sorry for hijacking your thread, but I think we are looking for the same thing:

furterRMDS wrote:
Hi, I'm trying to find a way to retrieve a unique Serial Number from every chip.


I also want to read a unique serial number from every XMC chip - possibly programmed already during the fabrication of the chip - I don't need to (I especially don't want to) program a self-chosen ID for each device.

Thus, my search for such already existing unique ID on the XMC registers continues ... (so far, we hav always used the DS28CM00 silicon serial number chip by Maxim - http://www.maximintegrated.com/datasheet/index.mvp/id/5248 - works fine, but requires additional components on the PCB and some IOs on the microcontroller )

@Travis:
yes, I'm trying to do some kind of authentication using this ID -> I'm building a microcontroller node that will be connected to numerous of the same on an Ethernet network. Therefore I want to have some kind of unique ID to set a MAC address and then the nodes may automatically obtain the IP address for communication via DHCP. I do not want to configure the MAC address (or IP address) for each node individually, there will be too much nodes ...

You mentioned to program the BMI string that contains a user-configurable MAC address. While reading the sections in the reference manual, I found another memory location that is labeled "Unique Chip ID" - it's located at the start of DSRAM1 and written by SSW upon every reset - please refer to Reference Manual V1.2 page 2595 (section 26-4, chapter 26.2.2 "Initial boot sequence)
Will this "Unique Chip ID" - located at the 16 bytes from 0x20000000 to 0x2000000F be completely unique among all XMC devices?

Thanks, Benjamin
0 Likes
User7757
Level 2
Level 2
@benjamin : We are indeed, looking for the same thing. I also had some hope with this "Unique Chip ID", but from what I saw, the 16 bytes copied in DSRAM1 at bootup are always 0, so it doesn't seem to work.
0 Likes
User7372
Level 2
Level 2
OK great.
I have not used the BMI string so far. I've read the memory locations from 4 devices I have at my desk:
Index 0 is 0x20000000, Index 1 is 0x20000004, then 8 and then C ... so these values are u32.

E144-1 (hexagon DRAM 1)
[0] 0x0a038201
[1] 0x44002006
[2] 0x10000682
[3] 0x0000000a

E144-2 (hexagon DRAM 2)
[0] 0x08898201
[1] 0x44002005
[2] 0x10000682
[3] 0x0000000a

F144-1 (hexagon GP 1)
[0] 0x0c860101
[1] 0x47038005
[2] 0x10000682
[3] 0x0000000a

F100-1 (relax 1)
[0] 0x098780c1
[1] 0x4902200f
[2] 0x10000682
[3] 0x0000000a

from these values I can see that all 4 chips have different IDs and the ID is most likely build up the following way:
[3] & [2] & [1] & [0] -> 0000 000a 1000 0682 ... and then changing - so it looks like these are real unique IDs

-Benjamin
0 Likes
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
I also want to read a unique serial number from every XMC chip - possibly programmed already during the fabrication of the chip - I don't need to (I especially don't want to) program a self-chosen ID for each device.

Thus, my search for such already existing unique ID on the XMC registers continues ...

Travis:
The "IDCHIP" register contains the unique ID of the chip, however the ID value maybe the same for the same batch of production so this may not serve your intended purposes.


Will this "Unique Chip ID" - located at the 16 bytes from 0x20000000 to 0x2000000F be completely unique among all XMC devices?

Travis:
No, it basically a copy of the IDCHIP.

For your need I think the best way is to program a MAC ID into the UCB.
0 Likes
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
furterRMDS wrote:
I took the code from FLASH002 app.

Here what I do to call the function to write the BMI :

status_t st;
const FLASHBMIString_Type MyBMITestString =
{
//boot mode
FLASH_BMI_BOOT_NORMAL,
//BMI Flags
FLASH_BMI_MAC_ADDR_VALID,
//MAC ADDR extension
{0x07,0xDD,0x09,0x20,0x22,0x90},
//IP ADDR extension
{0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA, 0x99, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00},
//USB serial number
{0x12, 0x34, 0x56, 0x78}
};
st = FLASH002_EraseUCB(2);
st = FLASH002_ConfigureBMI (&MyBMITestString);

- functions always return SUCCESS
- When I look at the BMI string copied in DSRAM1 after boot-up, the BMI Word (4 bytes) seems correct (the MAC P flag is set), but the MAC Address (6 bytes) is not set.
- The MAC Address is not constant and is sometime modified upon reset. I need the MAC address to keep its value forever...
- Do I need to erase the UCB before I call the FLASH002_ConfigureBMI? I tried with or without erasing and got the same result.

Thanks,
Cedric


Hi Cedric,

Can I check if you had configure the Boot mode pin to BMI mode?328.attach
0 Likes
User7372
Level 2
Level 2
Travis wrote:

Will this "Unique Chip ID" - located at the 16 bytes from 0x20000000 to 0x2000000F be completely unique among all XMC devices?

Travis:
No, it basically a copy of the IDCHIP.



how can it be a copy of the IDCHIP register, if you clearly can see that the address locations 0x20000000 to 0x20000007 vary in my 4 readings ??
0 Likes
User7757
Level 2
Level 2
Travis wrote:
Hi Cedric,

Can I check if you had configure the Boot mode pin to BMI mode?328.attach


No, I was in Normal Boot Mode.
0 Likes
User7757
Level 2
Level 2
I tried to configure the MAC Address in the BMI string using boot mode BMI and it works. Case closed for me.

Thanks a lot,
Cedric
0 Likes
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
furterRMDS wrote:
I tried to configure the MAC Address in the BMI string using boot mode BMI and it works. Case closed for me.

Thanks a lot,
Cedric


Good to hear that.
0 Likes
Not applicable
Hi Cedric,

I don't suppose, you might have your final code, for obtaining a unique ID, and setting the ETH_LWIP MAC address ?

I read through all of the post and links, but couldn't quite ascertain the final answer, that closed the case..

Best regards,

David King
0 Likes
rst
Level 3
Level 3
First solution authored Welcome!
David King wrote:
I read through all of the post and links, but couldn't quite ascertain the final answer, that closed the case..

As I understand - the only reliable way: to generate a unique number yourself at the production stage or when the device is turned on for the first time.
The uniqueness of "chip ID" (at addr 0x2000000) is not guaranteed for all instances of this IC.
0 Likes