2015-03-10 06:57 AM
Hi,
Is there a way to determine which MCU is being used on a board? We are developing software for an STM32F4 and some of our tools are using the 407 and others are using a 429. I would like to know when our code is running on a given MCU.Thanks,Bob2015-03-10 07:39 AM
There's DBGMCU_IDCODE and you can read the flash size from it's location in the System ROM
2015-03-10 10:25 AM
I notice that the values are the same in the header for both chips. Is this like some sort of address that contains the chip part number if I read it correctly?
2015-03-10 11:15 AM
printf(''IDCODE:%08X FLASH:%04X\n'', *((uint32_t *)0xE0042000), *((uint16_t *)0x1FFF7A22));
2015-03-10 01:08 PM
Two places for CPU info. Look at the SCB->CPUID register for general Cortex processor info. This will tell you if it's an M0, M3 or M4 (and presumably M7).
ST has two library routines: DBGMCU_getDevID() and DBGMCU_GetRevID() for ST specific models. Those help with errata that are rev specific. Jack Peacock2015-03-10 01:39 PM
Thanks for the information. I am using ST Cube v1.4 and I looked up the call, it now called ''HAL_GetDEVID()'' and returns a 32 bit unsigned integer. There is also ''HAL_GetREVID()'' call as well. The functions are found in stm32f4xx_hal.c.
2015-03-10 03:56 PM
> I notice that the values are the same in the header for both chips.
What header? What values? JW2015-03-10 07:31 PM
The header files:
stm32f407xx.h
stm32f429xx.hThe values:#define DBGMCU_IDCODE_DEV_ID ((uint32_t)0x00000FFF)
#define DBGMCU_IDCODE_REV_ID ((uint32_t)0xFFFF0000)2015-03-11 01:17 AM
The values:
#define DBGMCU_IDCODE_DEV_ID ((uint32_t)0x00000FFF)
#define DBGMCU_IDCODE_REV_ID ((uint32_t)0xFFFF0000) Ah, I see. These are only masks, indicating the dev ID and rev ID fields in the 32-bitDBGMCU_IDCODE
register. Have you already read the content of DBGMCU_IDCODE? Does it match the values from RM0090? JW