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

Assertions in uarte driver due to framing and parity errors can't be overridden.

Hi,

I'm seeing frequent assertions the uarte driver (sdk/components/libraries/experimental_libuarte/nrf_libuarte_async.c) due to framing and parity errors.  These are expected since the pin is not always connected so I need to be able to handle them gracefully.  At the moment they hit the default condition in uart_evt_handler() and assert, there needs to be a user callback available so they can be handled gracefullly.

I'm using S132 and SDK 15.2 on an nrf52832.

Thanks,
Tom

Parents
  • Hello,

    Is the assert that you speak of the APP_UART_COMMUNICATION_ERROR in uart_event_handle() in main.c?

    If so, as you say, they are expected if you have some floating pins. What you can do is to not pass the p_event->data.error_communication into the APP_ERROR_HANDLER().

    If it is something else, can you please describe what sort of default condition you are speaking of?

    Best regards,

    Edvin

  • Hi Edvin,

    It's in nrf_libuarte_async.c in uart_evt_handler() at line 158.  The callback handles all the event types except NRF_LIBUARTE_EVT_ERROR.  I see framing errors assert here.

    Thanks,

    Tom

  • Hi Edvin,

    It's a bit further down in that function, the event  NRF_LIBUARTE_EVT_ERROR ends up in the default case and asserts right there in the line I've highlighted in grey.

    Thanks,
    Tom

  • Ok. I see.

    To be honest, I haven't played around with any examples using this library. Is there a particular reason that you use this, and not the regular uart/uarte library that is used in e.g. the ble_app_uart example? This example will handle all UART events in main.c.

    However, if you want to use this library, you can remove the APP_ERROR_CHECK_BOOL(false); and replace it with your own handling. You can even add a separate event for the NRF_LIBUARTE_EVT_ERROR event, which is probably what you are receiving, since the only four possible event types for this handler are:

    typedef enum
    {
        NRF_LIBUARTE_EVT_RX_DATA,    ///< Data received.
        NRF_LIBUARTE_EVT_RX_BUF_REQ, ///< Requesting new buffer for receiving data.
        NRF_LIBUARTE_EVT_TX_DONE,    ///< Requested TX transfer completed.
        NRF_LIBUARTE_EVT_ERROR       ///< Error reported by the UARTE peripheral.
    } nrf_libuarte_evt_type_t;

    just add a:

    case NRF_LIBUARTE_EVT_ERROR:
        // do nothing
        break;

    before the default event.

    Best regards,

    Edvin

  • Hi Edvin,

    I'm using this library as it is the one supported by the cli.  The library is still experimental, is it possible to add error handler support?  I don't want to make local copies of Nordic code if possible.

    Thanks,

    Tom

  • As you say, this is an experimental library. The error handler is currently what is causing the resets, because the APP_ERROR_BOOL_CHECK(value) will reset the device if "value" is not 1.

    I am not sure what changes our developers will do to this file, but as of now, I suggest you just add the error event that I described in the previous reply. Alternatively, you can change the callback function in nrf_libuarte_async_init()

    And point it to a function in main.c, or wherever you like it.

    Either way, if you don't want it to reset at this point in time, your only option is to do some modifications in this file.

    Best regards,

    Edvin

  • Edvin,

    Please provide this feedback to the developers.  I sure you understand it's not sustainable for developers to update local copies each time an SDK is released.

    Thanks,
    Tom

Reply Children
Related