本帖最后由 lilijin1995 于 2022-6-17 15:45 编辑
#define UID_BASE 0x1FFFF7E8UL /*!< Unique device ID register base address */
#define DEVICE_ID1 (UID_BASE)
#define DEVICE_ID2 (UID_BASE + 0x4)
#define DEVICE_ID3 (UID_BASE + 0x8)
static void Get_SerialNum(void)
{
uint32_t deviceserial0, deviceserial1, deviceserial2;
deviceserial0 = *(uint32_t *) DEVICE_ID1;
deviceserial1 = *(uint32_t *) DEVICE_ID2;
deviceserial2 = *(uint32_t *) DEVICE_ID3;
deviceserial0 += deviceserial2;
if (deviceserial0 != 0)
{
IntToUnicode(deviceserial0, &USBD_StringSerial[2], 8);
IntToUnicode(deviceserial1, &USBD_StringSerial[18], 4);
}
}
跟STM32的地址一样的,https://www.bilibili.com/video/BV17r4y1z758/?vd_source=2bbde87de845d5220b1d8ba075c12fb0
可以参考我们的Eg3和Eg4
|