2024-02-12 04:04 PM
Hello! I am experimenting with a STM32F030F4P6. When I connect it to STM32CubeProgrammer via bootoader (UART), there is an info saying the micro has 32Kb of flash, instead of the expected 16Kb for this part.
Is it possible that this microcontroller really have 32Kb of memory? Anyone had similar experiences?
Thank you.
Solved! Go to Solution.
2024-02-12 05:37 PM
The same die is used for multiple chips. It is possible, even likely, that the chip contains the full FLASH available on other packages, however only the 16 kB the datasheet specifies is tested and guaranteed to work. You use the rest at your own risk.
Using the same die for multiple chips cuts down on production costs. Only guaranteeing a portion of the FLASH actually on the chip cuts down on testing costs.
2024-02-12 05:37 PM
The same die is used for multiple chips. It is possible, even likely, that the chip contains the full FLASH available on other packages, however only the 16 kB the datasheet specifies is tested and guaranteed to work. You use the rest at your own risk.
Using the same die for multiple chips cuts down on production costs. Only guaranteeing a portion of the FLASH actually on the chip cuts down on testing costs.
2024-02-12 10:13 PM - edited 2024-02-12 10:21 PM
The actual meaning of this chip marking is:
STM32F030F4
F - the chip has 20-pin case and 32 KiB of Flash
4 - you paid for 16 KiB
It's similar for STM32F103C8 vs. CB.
The decoding of the 2nd character after the base number is different in different STM32 famlilies. For L4+ series the interpretation extends to: "you paid for one half only so we disabled the second half".
:)
2024-02-14 09:06 AM
Thank you! Well, if I can really use all 32Kb of memory for the price of 16Kb, then great! I´m using this chip to learn how to program 32 bit micros. Let us see how fast I´m going to reach the 16Kb limit of flash.
2024-02-14 09:37 AM
Use floating point, and you'll probably get there very quickly
This is the Reference Manual for your part, you can read the tested flash size via a memory location.
STM32Cube_FW_F0_V1.11.4\Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_ll_utils.h
/**
* @brief Get Flash memory size
* @note This bitfield indicates the size of the device Flash memory expressed in
* Kbytes. As an example, 0x040 corresponds to 64 Kbytes.
* @retval FLASH_SIZE[15:0]: Flash memory size
*/
__STATIC_INLINE uint32_t LL_GetFlashSize(void)
{
return (uint16_t)(READ_REG(*((uint32_t *)FLASHSIZE_BASE_ADDRESS)));
}
#define FLASHSIZE_BASE 0x1FFFF7CCUL /*!< FLASH Size register base address */
#define UID_BASE 0x1FFFF7ACUL /*!< Unique device ID register base address */
2024-02-14 10:20 AM
return (uint16_t)(READ_REG(*((uint32_t *)FLASHSIZE_BASE_ADDRESS)));
That couldn't have been written by a sober person. ;)
2024-02-14 10:31 AM
I guess if it makes the compiler and compliance tools happy..
2024-02-14 10:44 AM
Maybe a Whiskey helps to understand...
2024-02-16 11:36 AM
You mean the compiler would be unhappy if it wasn't forced with volatile to read the 32-bit data it has to read anyway, cast it to 16 bits than again to 32. ;)
Another fun piece: boolean type has yet to be discovered by HAL programmers