Libuarte - RX fullbuffer event

Hi, 
How can I detect or using a flag to indicatate that RX buffer was full ? 
I follow this thread of Edvin thread

But i got this problem


Thank you !

  • Hi,
    My problem was solved

    There is some difference from Edvin thread I follow

    in main.c

    if (p_evt->data.rxtx.src == 0)
    {
    NRF_LOG_INFO("triggered by full buffer");
    } else if (p_evt->data.rxtx.src == 1)
    {
    NRF_LOG_INFO("Triggered by timeout");
    }


    typedef struct
    {
    uint8_t * p_data; ///< Pointer to memory used for transfer.
    size_t length; ///< Number of bytes transfered.
    uint8_t src;
    } nrf_libuarte_async_data_t;
    
    
    
    


    case NRF_LIBUARTE_DRV_EVT_RX_DATA:
    {
    
    uint32_t rx_amount = p_evt->data.rxtx.length - p_libuarte->p_ctrl_blk->sub_rx_count;
    if (rx_amount)
    {
    p_libuarte->p_ctrl_blk->rx_count += rx_amount;
    nrf_libuarte_async_evt_t evt = {
    .type = NRF_LIBUARTE_ASYNC_EVT_RX_DATA,
    .data = {
    .rxtx = {
    .p_data = &p_evt->data.rxtx.p_data[p_libuarte->p_ctrl_blk->sub_rx_count],
    .length = rx_amount,
    .src = 0,
    }
    }
    };
    
    void nrf_libuarte_async_timeout_handler(const nrf_libuarte_async_t * p_libuarte)
    {
    NRFX_IRQ_DISABLE((IRQn_Type)NRFX_IRQ_NUMBER_GET(p_libuarte->p_libuarte->uarte));
    
    uint32_t capt_rx_count = p_libuarte->p_libuarte->timer.p_reg->CC[3];
    
    if (capt_rx_count > p_libuarte->p_ctrl_blk->rx_count)
    {
    uint32_t rx_amount = capt_rx_count - p_libuarte->p_ctrl_blk->rx_count;
    nrf_libuarte_async_evt_t evt = {
    .type = NRF_LIBUARTE_ASYNC_EVT_RX_DATA,
    .data = {
    .rxtx = {
    .p_data = &p_libuarte->p_ctrl_blk->p_curr_rx_buf[p_libuarte->p_ctrl_blk->sub_rx_count],
    .length = rx_amount,
    .src = 1,
    }
    }
    };

  • Hi,

    I am glad to hear that the problem is solved.

    Best regards,
    Dejan

Related