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

Odd parity

We have been supplied with a module that sends SpO2 data but it uses 8bit, plus odd parity. I have seen the many questions on this subject and only pose this question to add to the obvious frustration that a chip manufacturer could not implement both even and odd parity as the world has many examples of both, with odd probably being more prevalent. Unbelievable.

Parents
  • Commenting out the error code in nrf_uarte.c is a workaround that is working for me as I only need RX, as below.

    static void uarte_irq_handler(NRF_UARTE_Type *        p_uarte,
                                  uarte_control_block_t * p_cb)
    {
        if (nrf_uarte_event_check(p_uarte, NRF_UARTE_EVENT_ERROR))
        {
    //        nrfx_uarte_event_t event;

            nrf_uarte_event_clear(p_uarte, NRF_UARTE_EVENT_ERROR);

    //        event.type                   = NRFX_UARTE_EVT_ERROR;
    //        event.data.error.error_mask  = nrf_uarte_errorsrc_get_and_clear(p_uarte);
    //        event.data.error.rxtx.bytes  = nrf_uarte_rx_amount_get(p_uarte);
    //        event.data.error.rxtx.p_data = p_cb->p_rx_buffer;
    //
    //        // Abort transfer.
    //        p_cb->rx_buffer_length = 0;
    //        p_cb->rx_secondary_buffer_length = 0;
    //
    //        p_cb->handler(&event, p_cb->p_context);
    //

    //                /* MC ignore the error */
    //        size_t amount = nrf_uarte_rx_amount_get(p_uarte);
    //        // If the transfer was stopped before completion, amount of transfered bytes
    //        // will not be equal to the buffer length. Interrupted transfer is ignored.
    //        if (amount == p_cb->rx_buffer_length)
    //        {
    //            if (p_cb->rx_secondary_buffer_length != 0)
    //            {
    //                uint8_t * p_data = p_cb->p_rx_buffer;
    //                nrf_uarte_shorts_disable(p_uarte, NRF_UARTE_SHORT_ENDRX_STARTRX);
    //                p_cb->rx_buffer_length = p_cb->rx_secondary_buffer_length;
    //                p_cb->p_rx_buffer = p_cb->p_rx_secondary_buffer;
    //                p_cb->rx_secondary_buffer_length = 0;
    //                rx_done_event(p_cb, amount, p_data);
    //            }
    //            else
    //            {
    //                p_cb->rx_buffer_length = 0;
    //                rx_done_event(p_cb, amount, p_cb->p_rx_buffer);
    //            }
    //        }
            }
        else if (nrf_uarte_event_check(p_uarte, NRF_UARTE_EVENT_ENDRX))
        {

  • Good to hear. Yes, for an nRF UART TX situation, that workaround would not work. Please note that this will also ignore any other errors in the UART. You may want to look into ignoring only the parity error.

    BR,

    Edvin

Reply Children
No Data
Related