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

NRF52840-DK ble_app_uart goes to app_error_fault_handler if i change baudrate in uart_init

Everything works fine if i use the default baudrate 

NRF_UARTE_BAUDRATE_115200
but if i change it to 250000 or something higher the applications starts and goes directly to app_error_fault_handler
when it receives a character on the uart.

I'm using a preview-dk board (I have six preview boards, they all act the same. )
We do have a product with release nRF52840 on which behaves the same way but that board does not have an lf xtal.

Is this a known issues on the preview nRF and are there any baudrate limitations when using internal oscillator ?

Regards
Tomas
  • Hi 

    Do you make sure you change the baudrate on both sides?

    If not the UART in the nRF52840 might receive a byte sent at a lower baudrate, and interpret it as a break condition. This will trigger the UART error handler, and from here you might fire off the app_error_handler. 

    Best regards
    Torbjørn

  • Thanks, the baudrate is the same on both sides.  I have tested on two MacBook pro's so I will dig up a windows pc and see if there's something wrong with the USB drivers. 

    I tried another uart example without ble with the same result. Quite puzzling. 

  • Hi

    You could try commenting out the calls to APP_ERROR_HANDLER inside the uart_event_handle(..) function, in this code snippet (line 559 of main.c):

    case APP_UART_COMMUNICATION_ERROR:
        APP_ERROR_HANDLER(p_event->data.error_communication);
        break;

    case APP_UART_FIFO_ERROR:
        APP_ERROR_HANDLER(p_event->data.error_code);
        break;

    Most likely it is the APP_UART_COMMUNICATION_ERROR event that occurs, and it is not strictly necessary to call the APP_ERROR_HANDLER in this case. If you comment out this call then the application should continue even if you have one or two corrupted bytes on the UART. 

    If you have logging enabled you can replace the call to APP_ERROR_HANDLER by an error or warning log message. 

    Best regards
    Torbjørn

Related