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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
2,403 次查看
Poley
Contributor V

Hi,

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

Thanks!

0 项奖励
回复
1 解答
2,353 次查看
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

在原帖中查看解决方案

4 回复数
2,393 次查看
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 项奖励
回复
2,389 次查看
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 项奖励
回复
2,354 次查看
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

2,350 次查看
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 项奖励
回复