方法一:
char * GetChipUniqueID_Str_STM32F10x(char* stm32id_StrBuf_32char )
{
uint32_t chipUniqueID32[3];
chipUniqueID32[2] = *(__IO uint32_t*)(0X1FFFF7F0);
chipUniqueID32[1] = *(__IO uint32_t*)(0X1FFFF7EC);
chipUniqueID32[0] = *(__IO uint32_t*)(0X1FFFF7E8);
snprintf(stm32id_StrBuf_32char,32,"0x%X-%X-%X", chipUniqueID32[0],chipUniqueID32[2],chipUniqueID32[2]);
return stm32id_StrBuf_32char;
}
读得的UID是:0x5DBFF30-43084562-43084562
方法二:
uint32_t * GetSTM32MCUIDPMing(uint32_t *id,MCUTypedef type)
{
// type =1, idAddr[type] =0x1FFFF7E8;
if(id!=NULL)
{
id[0]=*(uint32_t*)(idAddr[type]);
id[1]=*(uint32_t*)(idAddr[type]+4);
id[2]=*(uint32_t*)(idAddr[type]+8);
}
//printf("
STM32_ID_Str(inside):0X%X-%X-%X
",id[0],id[1],id[2]);
return id;
}
读得的UID是:0x20009068-8000165-800016D;
为何 不相同呢??
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>