From af256f4b1b96db57dfd73d03d60692e027899c82 Mon Sep 17 00:00:00 2001 From: Andy Piper Date: Mon, 26 Jun 2023 15:39:23 +0100 Subject: [PATCH] AP_IOMCU: output mcuid on f103 if able to --- libraries/AP_IOMCU/iofirmware/iofirmware.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libraries/AP_IOMCU/iofirmware/iofirmware.cpp b/libraries/AP_IOMCU/iofirmware/iofirmware.cpp index 51f7d6236a..b757c92cc1 100644 --- a/libraries/AP_IOMCU/iofirmware/iofirmware.cpp +++ b/libraries/AP_IOMCU/iofirmware/iofirmware.cpp @@ -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;