Asynchronous uart rx issues on nrf52832 using Zephyr. Constantly receive UART_RX_DISABLED event

I am using an nrf528232 based BLE module, the Taiyo Yuden EYSHSNZWZ: https://www.digikey.com/en/products/detail/kaga-fei-america-inc/EYSHSNZWZ/7104534

Running BLE and uart using Zephyr. I am using an example that has worked on other hardware, including the nrf52840 development kit, which is why I thought my code was solid

I am having issues with the asynchronous uart api in Zephyr: https://docs.zephyrproject.org/latest/hardware/peripherals/uart.html#uart-async-api.

In my uart interrupt callback function I observe that the interrupt is being toggled repeatedly about every 560us even though there is no data being sent on the UART RX line. Debugging shows I receive the same sequence of events in the uart callback function - events of type UART_RX_BUF_RELEASED, UART_RX_BUF_REQUEST, UART_RX_DISABLED repeatedly in that order. Using the same code on the nrf52840 dev kit I only receive a single UART_RX_BUF_REQUEST event when the asynchronous rx is started with uart_rx_enable(), and then no events until data is actually sent on the line.

Any ideas of what is wrong here? What is causing these repeated events and UART interrupts?

My callback function code is below:

/**
 * @brief UART callback function. Format specified by zephyr uart driver
 * @param dev UART device instance.
 * @param evt Pointer to uart_event instance.
 * @param user_data Pointer to data specified by user.
*/
static void uart_callback(const struct device *dev, struct uart_event *evt, void *user_data)
{
    //debug code
    gpio_pin_toggle_dt(&dbg0_pin);

    if(dbg_events_idx < DBG_NUM_EVENTS)
    {
        dbg_events[dbg_events_idx++] = *evt;
    }
    else
        dbg_events_idx = DBG_NUM_EVENTS;

    //handle interrupt event
    switch (evt->type)
    {
    case UART_RX_RDY:
        if ((evt->data.rx.len != 0) && (evt->data.rx.len < sizeof(rx_buf))) // Do nothing if buffer is full.
        {
            memset(&(rx_buf[0]), 0, sizeof(rx_buf));
            rx_buf_size = evt->data.rx.len;
            memcpy(&(rx_buf[0]), &(rx_dma_buf[0]), rx_buf_size);
            new_rx = true;
        }
        uart_rx_disable(dev); // Use this to reset DMA input to the RX buffer
        break;
    case UART_RX_DISABLED:
        memset(&(rx_dma_buf[0]), 0, sizeof(rx_dma_buf));
        uart_rx_enable(dev, &(rx_dma_buf[0]), sizeof(rx_dma_buf), RECEIVE_TIMEOUT_US);
        break;

    case UART_TX_DONE:
        tx_in_progress = false;
        break;

    case UART_TX_ABORTED:
        tx_in_progress = false;
        break;

    default:
        break;
    }
}
Parents Reply Children
No Data
Related