This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

how to use sd_flash_write? SDK13

I want to write at the end of memory ROM data in address 0x7FFFF

uint8_t tst_arr[1] = {6};
sd_flash_write((uint32_t*)0x7FFFF, (uint32_t*) &tst_arr, 1);

Is it correct?

But if I made it, in a memory watch I can't see any changes from 0xFF to my data (6).

Parents
  • No you cannot do it like this, flash writes should be 32-bit aligned. So if you want to write 8-bits to address 0x7FFFF then you should read 24-bits from address 0x7FFFC, concatenate it with your 8-bits and write resulting 32-bits back to address 0x7FFFC. Alternatively you can skip reading and put 0xFFFFFF at the beginning if you are sure that flash is erased before your write (or if you simply don't care about these preceding 3 bytes).

Reply
  • No you cannot do it like this, flash writes should be 32-bit aligned. So if you want to write 8-bits to address 0x7FFFF then you should read 24-bits from address 0x7FFFC, concatenate it with your 8-bits and write resulting 32-bits back to address 0x7FFFC. Alternatively you can skip reading and put 0xFFFFFF at the beginning if you are sure that flash is erased before your write (or if you simply don't care about these preceding 3 bytes).

Children
Related