Confusion about CubeCell FLASH

Hello,
I am confused about how to use the flash. I extended the UserFlash code like so

image

I am doing the following actions

  1. Writing 100 to the 1st byte
  2. Reading the 1st byte to confirm it is 100
  3. Writing 50 to the 2nd byte
  4. Reading the 2nd byte to confirm it is 50
  5. Reading the 1st byte to confirm that it is still 100

As you can see in the logs. I read 50 in step 5. So i am confused. Any help? Thanks!
image

Hi @jackyruth,

well, you are always reading and writing to the same address… so this is the behaviour I would expect. In step 3, writing to the 2nd byte, you should use something like FLASH_update(addr+1, &data3,1) because the parameters are the address where to write, the pointer to the data you want to write, and then the numbers of bytes you want to write.

Regards, Edi

1 Like