Can you read the uC's serial number in code?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can you read the uC's serial number in code?

Jump to solution
1,181 Views
Poley
Contributor V

Hi,

Is there a way to read the chips serial number so I can display it on CAN? 

Thanks!

0 Kudos
1 Solution
1,131 Views
mariuslucianand
NXP Employee
NXP Employee

Hello @Poley ,

I've seen that error before but I was unable to solve it because I cannot reproduce it on my end.

Regarding reading the UID, the other way s to use Data Read Mem block and type the direct address of the registers. Please see the attached example.

For the second request, restarting the MCU there are basically two ways. One of them is to use the watchdog, the other is to use the AIRCR register of the ARM Core. I tried the last one, and if you press the SW4 this should reset the MCU. Please see the attached exmaple. Also, the count variable is incremented every step time so once you press the button the value starts again from 0. 

Hope this helps,

Marius

View solution in original post

4 Replies
1,171 Views
mariuslucianand
NXP Employee
NXP Employee

Hello @Poley 

I think you can try using the Read Register block and accessing the SIM -> UIDH, UIMH, UIML and UIDL.

mariuslucianand_0-1624610065118.png

Hope this helps,

Marius

 

0 Kudos
1,167 Views
Poley
Contributor V

Hi @mariuslucianand 

I get this error when trying to put a read register block in my model, am I missing something obvious?

Poley_0-1624614354033.png

 

Also, Is there a way to do a device reset from software? I am looking at ways to flash with the CAN bootloader and using a reset switch isn't ideal (8 boards on same bus and supply so can't just power cycle). So a way of resetting the device through software would be perfect.

Thanks!

 

 

0 Kudos
1,132 Views
mariuslucianand
NXP Employee
NXP Employee

Hello @Poley ,

I've seen that error before but I was unable to solve it because I cannot reproduce it on my end.

Regarding reading the UID, the other way s to use Data Read Mem block and type the direct address of the registers. Please see the attached example.

For the second request, restarting the MCU there are basically two ways. One of them is to use the watchdog, the other is to use the AIRCR register of the ARM Core. I tried the last one, and if you press the SW4 this should reset the MCU. Please see the attached exmaple. Also, the count variable is incremented every step time so once you press the button the value starts again from 0. 

Hope this helps,

Marius

1,128 Views
Poley
Contributor V

Hi @mariuslucianand 

Thank you very much for the help!

So it looks like if I use the reset function you have:

Poley_0-1625055325742.png

It looks like I can just change the GPI ISR to a CAN signal that when set to 1 triggers the subsystem containing the reset MCU matlab function, should this reset me all the way to the bootloader code? (Currently just using OpenSDA).

Also for UID do I need to read all 4 registers?:

Poley_1-1625055509599.png

How do I get a single value I can put onto CAN? or is that value too large? 

Thank you again!

 

0 Kudos