2017-05-16 10:54 PM
Hi, I have chosen STM32F072RB for our project and I have use it in design. But now we must store about 128-byte data for the calibration of our device. STM32F072RB�s flash is 128K. it is too big for this application. So, I want to use its spare space to store these calibration data (128 bytes) and save an extern flash.
Now my issue is, how could this MCU store the data to its own flash?
Thanks.
#stm32f0 #calibration #flashSolved! Go to Solution.
2017-05-16 11:16 PM
You should have look at these examples you can find inside the HAL library package:
STM32Cube_FW_F0_Base_Folder\Projects\STM32F072RB-Nucleo\Examples\FLASH
STM32Cube_FW_F0_Base_Folder
\Projects\STM32F072B-Discovery\Examples\FLASHSTM32Cube_FW_F0_Base_Folder
\Projects\STM32072B_EVAL\Examples\FLASHand let us know if it does fit your needs or not.
2017-05-16 11:16 PM
You should have look at these examples you can find inside the HAL library package:
STM32Cube_FW_F0_Base_Folder\Projects\STM32F072RB-Nucleo\Examples\FLASH
STM32Cube_FW_F0_Base_Folder
\Projects\STM32F072B-Discovery\Examples\FLASHSTM32Cube_FW_F0_Base_Folder
\Projects\STM32072B_EVAL\Examples\FLASHand let us know if it does fit your needs or not.
2017-05-17 11:38 PM
The processor can directly read the flash memory, there is no special procedure.
Something like:
MyIntVariable = ( int *) 0x0801FFC0;
will copy an int from address 0x0801FFC0 (in flash) into MyIntVariable.
Of course it could be any other type and address...
2017-05-18 01:29 AM
Hi Max, thank you for your response. The examples you offered are so helpful.
And I have another question based on this application.
I use the STM32F072RB with 128k flash. And the program flash address is from 0x08000000 to 0x0801FFFFF. It has 64 pages, 2K bytes per page.
If my code just need 10K bytes, is that mean the flash is empty or not used after 0x08002800?
Start ->0x08000000
…(My code)
My code ->0x08002800
…(Empty?)
End ->0x0801FFFF
If it’s true the flash after 0x08002800 is not used, I plan to use the last few pages to store my calibration data.
2017-05-18 01:44 AM
You should check with your compiler/linker map file to see what is actually used.
But basically, you are correct.
You should keep some margin in case you want to add features/correct some bugs in your program.