Question
STM32L151CB writing variables to flash
Posted on July 02, 2014 at 11:21
Hi all,
I try to write some variables to the internal flash memory of the STM32L151CB processor, but it apparantly only works with some addresses? When I write to the address 0x0801FE00 it works, but when I write to the address 0x0801F145 (for example) the SIZERR flag is set?? I have tried to allocate the memory for user defined variables in the Keil development invironmemt by defining the startup address to 0x0800000 with size 0x1F000, so that the remaining ROM is free. Here is my code:void Flash_Write(uint8_t Data, uint32_t Flash_Address){ FLASH_Unlock(); FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPTVERR | FLASH_FLAG_WRPERR ); FLASHStatus = FLASH_ErasePage(Flash_Address); FLASHStatus = FLASH_FastProgramWord(Flash_Address, Data); FLASH_Lock();}I must have missed something important, so please help me if you have any ideas. #stm32-flash