I have a nrf52840DK and try to modify SDK peripheral/uart example. I want to reboot nrf52840 device after getting uart communication errors. I put NVIC_SystemReset() function call to the wrong place that caused the device reboot continuously. The modification code is below. I cannot flash anymore by IDE tools or nRF Connect. Is there anyway to erase the flash or just throw it away?
void uart_error_handle(app_uart_evt_t * p_event)
{
if (p_event->evt_type == APP_UART_COMMUNICATION_ERROR)
{
APP_ERROR_HANDLER(p_event->data.error_communication);
}
else if (p_event->evt_type == APP_UART_FIFO_ERROR)
{
APP_ERROR_HANDLER(p_event->data.error_code);
}
NVIC_SystemReset();
}