AnsweredAssumed Answered

STM32L151CB writing variables to flash

Question asked by fog.kenneth_blaabjer on Jul 2, 2014
Latest reply on Jul 2, 2014 by fog.kenneth_blaabjer
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)
     FLASHStatus = FLASH_ErasePage(Flash_Address);     
     FLASHStatus = FLASH_FastProgramWord(Flash_Address, Data);

I must have missed something important, so please help me if you have any ideas.