2014-08-27 8:19 AM
Hello Everyone,
I am working on an STM32L152 based platform and trying place some data inside internal flash. As you may know, when a page is erased, in stm32L1, each bit is set to 0x00 instead of 0xFF. After erasing a page, I am trying to set each bit of a flash word respectively. Here is my test code:void
*dest = (
void
*) 0x08030000;
uint32_t max = (uint32_t) ~0;
uint32_t value = 0;
HAL_FlashErase(dest, 1); /* STM32 Lib Function Wrapper */
while
(value < max) {
value = (value << 1) | 1;
HAL_FlashWriteWord(dest, value); /* Yet another wrapper function */
printf
(
''value: %u | flash: %u\n''
, value , *(
volatile
uint32_t *) dest); 
}2014-08-27 8:27 AM
What could be the underlying reason for this?
''Up to 128 KB Flash with ECC''2014-08-27 8:38 AM
Hello clive1,
In the datasheet, I see this instead: ''256 KB Flash with ECC''. Regards2014-08-27 8:44 AM
Depends on the part you're talking about, and you weren't insufficiently specific.
The flash line is wider than you think it is, and it's not designed to be written a bit at a time. You might see similar ''odd'' behaviour with MLC flash too.