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

FIFO uart stops sending when inside app_error_handler (flush doesnt do it)

i'm using uart for debugging, works fine and dandy except when in app_error_handler. There only the first character is being printed before we go into an infinite loop. Inside the error handler, i2c and spi work fine, just not uart... odd.

void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name)
{
    printf("%lu %s:%lu  ", error_code, (const char*)p_file_name, line_num);
    app_uart_flush();

    for (;;) {
        nrf_delay_ms(500);
        LEDS_OFF(BSP_LED_1_MASK);
        nrf_delay_ms(500);
        LEDS_ON(BSP_LED_1_MASK);
    }
}

I suspect that fifo mode needs timers since printing only one char is exactly the behaviour when i ommit APP_TIMER_INIT. But from my perspective app_error_handler is just a regular function on the stack, and i have not disabled timers anywhere.

Parents
  • Hi

    This could be an interrupt issue, where the UART interrupts are blocked because the app_error_handler is running in a higher (or the same) interrupt context.

    Could you please try using the simple_uart driver instead? It doesn't use interrupts, and should work fine from any interrupt priority.

    I have attached the driver here for your convenience:

    Best regards
    Torbjørn

Reply
  • Hi

    This could be an interrupt issue, where the UART interrupts are blocked because the app_error_handler is running in a higher (or the same) interrupt context.

    Could you please try using the simple_uart driver instead? It doesn't use interrupts, and should work fine from any interrupt priority.

    I have attached the driver here for your convenience:

    Best regards
    Torbjørn

Children
No Data
Related