2015-12-08 02:30 AM
I need to find out the sector and page size on my particular SOC, which is STM32F072C8T6. According to the part number information from the data sheet (DM00090510), this is a 64 kB flash memory version. From the reference manual (DM00031936), section 3.2.1, Table 5, it seems that on this system I have a total of 16 sectors with each sector containing two pages of 2kB size each. Thus making each sector 4kB long. I'm referring the IAP program that was provided by ST for STM32F051R8 based evaluation board and this software (STSW-STM32116) assumes the page size of 1kB. I believe I need to update this and some other information in the IAP driver to use it for my target board (STM32F072C8T6) and hence I'm wondering if this can be done by reading some configuration register to find out the internal memory layout (sector and page layout) . I guess that incorrect sector and page size etc setting might be the reason that I'm getting into
/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/IAP%20Multiple%20application%20firmware%20in%20main%20flash%20memory&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=41
problem.Thanks. #stm322015-12-08 06:55 AM
Well you tend have to customize for your specific part choice. As I recall there's a chip id register, and the size of the flash (total) is in the System ROM at a specific location. The Flash Loader Demonstrator has a file which describes IDs, and memory locations, which it uses to infer details it needs. The USB DfuSe stuff comes back with a set of descriptors.
The F2/F4 parts have generally had fewer die, so are more uniform in configuration. The F1's had a whole array of die which went from low to high end with slightly different sector sizes to account for the larger memories in the top end devices.2015-12-08 07:30 AM
I'm not sure, If I have understood you correctly, however what I've understood is that, I should be able to read some descriptors and be able to figure out the memory layout. I'll investigate more on this. In the meantime, based on the information in reference manual and what I've understood for this particular SOC, the main flash memory layout for STM32F072C8T6 is as below:
</colgroup>
Start address
0x08000000
End address
0x08010000
Size
0x10000 (64 kB)
Page size
2 kB
Number of pages
32
Erase sector size
4kB
Initial content of the memory
0xFF
Memory Endianess
Little
Processor address space
4GB
Erase granularity
Page level
The last one was a surprise to me, as sometime back I interfaced a serial NOR external flash memory with this same SOC over SPI bus and it had sector-wise erase granularity.2015-12-08 08:38 AM
Honestly not a part I've spent a lot of time on.
There do seem to be a number of discrepancies in the software and documentation. STM32F072B-Discovery_FW_V1.0.1\Projects\Peripheral_Examples\FLASH_Program\main.c Infers 1KB pages The data sheet mentions 4K pages, and provides erase times for 2K ones,http://www.st.com/web/en/resource/technical/document/datasheet/DM00090510.pdf
The parts themselves can be 64KB or 128KB, might be a single die. I think the actuality could be deduced fairly quickly with a simple fill/erase test in the 32KB region.