STM32/GD32芯片信息(转)

时间:2022-04-03 05:04:11

源:STM32/GD32芯片信息

因为需要自动适配芯片进行系统配置,所以我们有必要通过读取一些系统寄存器来获取必要信息。
我们的代码需要兼容STM32F1/GD32F1/STM32F0/STM32F4

代码如下:

#ifdef STM32F0XX
void* p = (void*)0x1FFFF7AC;
#else
void* p = (void*)0x1FFFF7E8;
#endif
memcpy(ID, p, ArrayLength(ID)); CPUID = SCB->CPUID;
uint MCUID = DBGMCU->IDCODE; // MCU编码。低字设备版本,高字子版本
RevID = MCUID >> ;
DevID = MCUID & 0x0FFF; _Index = ;
#ifdef STM32F0XX
FlashSize = *(__IO ushort *)(0x1FFFF7CC); // 容量
#else
FlashSize = *(__IO ushort *)(0x1FFFF7E0); // 容量
#endif

各常见芯片信息如下:

STM32F030C8T6

SmartOS STM32F030C8 48MHz Flash:64k RAMSTM32/GD32芯片信息(转)k
DevID:0x0440 RevID:0x2000
CPUID:0x410CC200 ARM ARMv6-M Cortex-M0 R0p0
ChipID:55-00-3E-00-04-57-32-4D-39-35-34-20
Heap STM32/GD32芯片信息(转)0x200009a0, 0x200011a0) = 0x800
StackSTM32/GD32芯片信息(转)0x200011a0, 0x20002000) = 0xe60

GD32F130C8T6

SmartOS GD32F130C8 48MHz Flash:64k RAMSTM32/GD32芯片信息(转)k
DevID:0x0410 RevID:0x1303
CPUID:0x412FC231 ARM ARMv7-M Cortex-M3 R1p2
ChipID:26-49-31-39-31-33-30-32-32-32-33-32 &I1913022232
Heap STM32/GD32芯片信息(转)0x200009a0, 0x200011a0) = 0x800
StackSTM32/GD32芯片信息(转)0x200011a0, 0x20002000) = 0xe60

STM32F051C8T6

SmartOS STM32F030C8 48MHz Flash:64k RAMSTM32/GD32芯片信息(转)k
DevID:0x0440 RevID:0x2000
CPUID:0x410CC200 ARM ARMv6-M Cortex-M0 R0p0
ChipID:22-00-21-00-11-57-36-41-36-33-32-20
Heap STM32/GD32芯片信息(转)0x200009a0, 0x200011a0) = 0x800
Stack:(0x200011a0, 0x20002000) = 0xe60

GD32F150C8T6

SmartOS GD32F150C8 72MHz Flash:64k RAMSTM32/GD32芯片信息(转)k
DevID:0x0410 RevID:0x1303
CPUID:0x412FC231 ARM ARMv7-M Cortex-M3 R1p2
ChipIDSTM32/GD32芯片信息(转)F-14-31-39-31-33-30-32-32-32-33-32    8F141913022232
Heap :(0x20000678, 0x20000e78) = 0x800 (2k)
Stack:(0x20000e78, 0x20002000) = 0x1188 (4k)

STM32F103VET6

SmartOS STM32F103VE 72MHz Flash:512k RAM:64k
DevID:0x0414 RevID:0x1001
CPUID:0x411FC231 ARM ARMv7-M Cortex-M3 R1p1
ChipID:38-FF-D4-FB-31-4E-36-30-36-66-01-43
Heap :(0x20000a30, 0x20004a30) = 0x4000
Stack:(0x20004a30, 0x20010000) = 0xb5d0

GD32F103VET6

SmartOS GD32F103VE 120MHz Flash:512k RAM:64k
DevID:0x0414 RevID:0x1309
CPUID:0x412FC231 ARM ARMv7-M Cortex-M3 R1p2
ChipID:46-86-31-36-38-37-30-31-01-02-03-04 F�168701
Heap :(0x20000a30, 0x20004a30) = 0x4000
Stack:(0x20004a30, 0x20010000) = 0xb5d0

GD32F103VKT6

SmartOS GD32F103VK 120MHz Flash:3072k RAM:96k
DevID:0x0430 RevID:0x1309
CPUID:0x412FC231 ARM ARMv7-M Cortex-M3 R1p2
ChipID:2A-58-36-35-34-31-31-33-32-30-32-34 *X6541132024
Heap :(0x20000a30, 0x20004a30) = 0x4000
Stack:(0x20004a30, 0x20018000) = 0x135d0

未解决问题:
1,有人说F0的ID只有32位,这个没有找到确切资料
2,GD芯片F130/F150没有读取得到DevID和RevID,而同为F0固件库的F030可以
3,STM32F103和GD32F103还有GD32F130/F150都可以通过0x1FFFF7E0读取得到内置闪存大小,而STM3F030不行,是不是因为这个是M3地址,而M0地址不同?如果130/150使用F0库缺使用M3地址,使用起来就麻烦了。
4,GD32F130/GD32F150上中断向量表映射到RAM的0x20000000失败,调用SYSCFG_MemoryRemapConfig配置SYSCFG->CFGR1为SYSCFG_MemoryRemap_SRAM后再读取发现没有生效,系统仍然使用Flash上的中断向量表。