AP_IOMCU: output mcuid on f103 if able to

This commit is contained in:
Andy Piper 2023-06-26 15:39:23 +01:00 committed by Andrew Tridgell
parent 9ac683a350
commit af256f4b1b
1 changed files with 5 additions and 4 deletions

View File

@ -287,11 +287,12 @@ void AP_IOMCU_FW::init()
// old NuttX based firmwares
config.protocol_version = IOMCU_PROTOCOL_VERSION;
config.protocol_version2 = IOMCU_PROTOCOL_VERSION2;
#if defined(STM32F103xB) || defined(STM32F103x8)
// Errata 2.2.2 - Debug registers cannot be read by user software
config.mcuid = 0x20036410; // STM32F10x (Medium Density) rev Y
#else
config.mcuid = (*(uint32_t *)DBGMCU_BASE);
#if defined(STM32F103xB) || defined(STM32F103x8)
if (config.mcuid == 0) {
// Errata 2.2.2 - Debug registers cannot be read by user software
config.mcuid = 0x20036410; // STM32F10x (Medium Density) rev Y
}
#endif
config.cpuid = SCB->CPUID;