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).

  • You need to wait until you get NRF_EVT_FLASH_OPERATION_SUCCESS event which means that flash operation was processed. Only then you can continue (e.g. do another flash operation or go and verify the content). Are you sure that you read all 4 bytes from address 0x7FFFC when verifying? Are you doing it in nrfjprog or SEGGER J-Flash or something else?

Reply Children
No Data
Related