I've spent several days reading all the support tickets regarding this issue but I cannot find a resolution.
I am running the ble_central_uart example with SD 132, SES 4.30, SDK 15.3 on an nRF52 DK dev board.
I have been unable to erase flash consistently or to write flash at all. It appears that I am having problems with both erasing and writing flash. I implemented the sd_flash_page_erase() function as follows:
This code executes but it does not check for the flash erase function to complete. In debugging the problem, I found that the write function sd_flash_write() was erroring out on err_code == NRF_ERROR_BUSY. So I figured the erase function required more time to complete. I added a delay nrf_delay_ms(100) and tried a timer as well. Neither did any good. So I added an error check on the sd_flash_page_erase() function, like this:
Line 11 never evaluates as true. So the code gets stuck in this loop.
The other problem I have is that even when I put a delay in the erase code and let it pass through the erase function to the write function, I get an NRF_BUSY_ERROR in the write flash function. See code below:
The code always hangs on line 18 - if (err_code == NRF_ERROR_BUSY) while (1);
I make sure that my writes are word aligned as shown:
and my flash writes always begin at the start of the flash page which happens to be 7e000.
Finally, I tried to supply my own event handler with this code:
But it seems that this code isn't supported by SDK 15.3. I get compile errors.
Where am I going wrong?