I'm working on a NRF52832 project with SDK V15.2, using S132 Softdevice. before connecting, nrf_fstorage_write/nrf_fstorage_erase/sd_flash_write/sd_flash_page_erase all are work perfectly. But once connected with a device, all the operations to flash can't work. it'll stuck in wait_for_flash_ready, return of nrf_fstorage_write & nrf_fstorage_erase are NRF_SUCCESS. If I call nrf_sdh_disable_request() before nrf_fstorage_write & nrf_fstorage_erase, the operations can be done correctly. Never goes into fstorage_evt_handler() after connected to a device.
Please help me figure out this issue, thanks in advanced.
What connection parameters are using in the BLE link? As you can see from Flash API timing in the SoftDevice specification:
Flash timing-activity may not get a timing-event at all if other timing-events occupy most of the time and use priority higher than flash timing-activity.
If this is the problem, which seems likely, then it could be fixed by for instance using longer connection intervals.
I changed the parameters to below, the result is same as before.
#define MIN_CONN_INTERVAL MSEC_TO_UNITS(20, UNIT_1_25_MS) #define MAX_CONN_INTERVAL MSEC_TO_UNITS(1600, UNIT_1_25_MS)
I'll change something more to verify if this is caused by the CI, will get back to you once I get a conclusion.
Assuming you are making a peripheral, this just sets the desired advertising interval for the nRF, and it is still the phone (central) who decides. Increasing the MIN_CONN_INTERVAL significantly should probably help. What connection interval is actually being used on the link?
Just now, we set Android phone's connection _priority from connetion_priority_balabced to connetion_priority_low_power, It means the CI is from 100ms to 125ms. The result is same.
Please check below debug information from our Android APP. The connection interval is 100ms.
I see. It should not be a problem then, at least not with writes. Page erase might be tough, though (maximum time to erase a flash page is 89.7 ms, and there needs to be some margin when scheduling).
Do you see problems with only writes also, when the connection interval is 100 ms? Can you upload your code so that I can look at it?
Can I have your Email pleasse? I'll send the project to you via Email. Thanks.