Hi all, After receiving data from my host app, I am trying to write to write the data to flash with the sd_flash_write command. I have 3 pages of data to write, so need to make sure the last write has finished by waiting for NRF_EVT_FLASH_OPERATION_SUCCESS. I do not receive this however while the ble is running. I placed the sd_evt_get in the interrupt handler:
void SWI2_IRQHandler(void)
{
uint error;
uint event;
word length;
bool softEvent = true;
bool bleEvent = true;
while (1)
{
if (softEvent)
{
error = sd_evt_get(&event);
if (error == NRF_ERROR_NOT_FOUND)
softEvent = false;
else if (error != NRF_SUCCESS)
{
// Error
}
else
{
BluetoothSystemEventHandler(event); // Doesn't get called
}
}
if (bleEvent)
{
length = bleBufferSize;
error = sd_ble_evt_get(bleEventBufferOffset, &length);
if (error == NRF_ERROR_NOT_FOUND)
bleEvent = false;
else if (error != NRF_SUCCESS)
{
// Error
}
else
BluetoothEventHandler((ble_evt_t *) bleEventBufferOffset);
}
if (!softEvent && !bleEvent)
break;
}
}
And in my main() I have just:
while(1)
{
__wfi();
}
However, the BluetoothSystemEventHandler() never gets called. Is this the correct way to do it? Thanks again.