70 lines
1.6 KiB
C
70 lines
1.6 KiB
C
|
/*************************************
|
|||
|
* <EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>xxx.c
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡCPU<EFBFBD><EFBFBD>ID<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><EFBFBD>оƬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ψһ<EFBFBD><EFBFBD> 96_bit unique ID
|
|||
|
* ʵ<EFBFBD><EFBFBD>ƽ̨<EFBFBD><EFBFBD>MINI STM32<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>STM32F103C8T6
|
|||
|
* Ӳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD>汾 <EFBFBD><EFBFBD>ST3.0.0
|
|||
|
|
|||
|
**********************************************************************************/
|
|||
|
|
|||
|
|
|||
|
#include "chipid.h"
|
|||
|
|
|||
|
#include "led.h"
|
|||
|
|
|||
|
|
|||
|
u32 ChipUniqueID[3];
|
|||
|
#define UID_BASE 0x1FF80050
|
|||
|
/* <20><>ȡоƬID */
|
|||
|
void Get_ChipID(void)
|
|||
|
{
|
|||
|
ChipUniqueID[0] = *(__IO u32 *)(0X1FFFF7F0); // <20><><EFBFBD>ֽ<EFBFBD>
|
|||
|
ChipUniqueID[1] = *(__IO u32 *)(0X1FFFF7EC); //
|
|||
|
ChipUniqueID[2] = *(__IO u32 *)(0X1FFFF7E8); // <20><><EFBFBD>ֽ<EFBFBD>
|
|||
|
|
|||
|
if(ChipUniqueID[0]==0xFFFFFFFF)
|
|||
|
{
|
|||
|
|
|||
|
ChipUniqueID[0] = (uint32_t)(*((uint32_t *)UID_BASE));
|
|||
|
ChipUniqueID[1] = (uint32_t)(*((uint32_t *)(UID_BASE + 0x04)));
|
|||
|
ChipUniqueID[2] = (uint32_t)(*((uint32_t *)(UID_BASE + 0x14)));
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
u32 ChipUniqueIDdecodeflag;
|
|||
|
uint8_t ChipUniqueIDCompare(void)
|
|||
|
{
|
|||
|
if((SysParaPileD.ChipUniqueID[0] == ChipUniqueID[0])&&(SysParaPileD.ChipUniqueID[1] == ChipUniqueID[1])
|
|||
|
&& (SysParaPileD.ChipUniqueID[2] == ChipUniqueID[2]))
|
|||
|
{
|
|||
|
return 1;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
MCU_LED(1);
|
|||
|
while (1)
|
|||
|
{
|
|||
|
MCU_LED(1);
|
|||
|
IWDG_Feed();
|
|||
|
ChipUniqueIDdecodeflag =1;
|
|||
|
if(ChipUniqueIDdecodeflag==1)
|
|||
|
{
|
|||
|
ChipUniqueIDdecodeflag =0;
|
|||
|
SysParaPileD.ChipUniqueID[0] = ChipUniqueID[0];
|
|||
|
SysParaPileD.ChipUniqueID[1] = ChipUniqueID[1];
|
|||
|
SysParaPileD.ChipUniqueID[2] = ChipUniqueID[2];
|
|||
|
Delay_MS(5);
|
|||
|
SysParaPileD.bluetooth_passward[4]=0x35;
|
|||
|
SysParaPileD.bluetooth_passward[5]=0x36;
|
|||
|
SysWriteSysParm();
|
|||
|
Delay_MS(5);
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|