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

Erasing flash when there is a BLE Connection

Hi! I'm running the Espruino JavaScript interpreter on a Nordic nRF51 (actually the BBC micro:bit), and I am finding it will totally reset itself when trying to erase a page of flash memory while also connected to BLE

BLE is enabled by default, and erasing the page works (via nrf_nvmc_page_erase(addr);) just fine normally (while the device is advertising). However if I connect to the Nordic UART service, and then execute the exact same code in the exact same way, the chip just resets.

Do you have any ideas what could be causing this or how to fix it?

thanks!

Parents
  • Seems like there is some error returned in one of the functions in your code. You know that APP_ERROR_CHECK default behavior is that it if the condition inside it does not pass, then it will reset you chip. Try to look at this thread. First try to find exact place where the system resets.

  • Ahh, thanks! I'd got a ble_app_error_handler but not a app_error_fault_handler. Adding that definitely changes the behaviour, but it isn't able to print anything - which makes me think it is being called from within an IRQ (which would be something to do with BLE, since at that point I don't have any active IRQs).

    Any idea what could actually be causing this, or how it could be avoided? Unfortunately I don't have debugging set up. Presumably the BLE stack interrupts in the middle of a flash write, and doesn't like it for some reason?

Reply
  • Ahh, thanks! I'd got a ble_app_error_handler but not a app_error_fault_handler. Adding that definitely changes the behaviour, but it isn't able to print anything - which makes me think it is being called from within an IRQ (which would be something to do with BLE, since at that point I don't have any active IRQs).

    Any idea what could actually be causing this, or how it could be avoided? Unfortunately I don't have debugging set up. Presumably the BLE stack interrupts in the middle of a flash write, and doesn't like it for some reason?

Children
No Data
Related