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

nrf queue NRF_ERROR_NOT_FOUND with NRF_QUEUE_MODE_OVERFLOW declared

Hi,

I am using nrf_queue to store data in queue which is inserted with time based interrupt at several milliseconds. Also same data from queue is fetched at bulk.

I am using NRF_QUEUE_MODE_OVERFLOW so that previous data is erased if data isn't fetched and queue is full.

The problem is I am getting NRF_ERROR_NOT_FOUND which occurs when element_count > queue utilization as in function nrf_queue_read.

Why is that problem occuring and how to prevent it. It is mentioned that "If NRF_QUEUE_MODE_NO_OVERFLOW mode is selected and there is not enough space, NRF_ERROR_NO_MEM will be returned." but since I have NRF_QUEUE_MODE_OVERFLOW mode, I shouldn't get this error.

In queue buffer docs it is mentioned "The queue library provides interrupt secure implementation of the circular buffer to store predefined objects." so I don't have to worry about it.

Below is the declaration and usage of my queue.

NRF_QUEUE_DEF(uint16_t, m_queue, 36, NRF_QUEUE_MODE_OVERFLOW);
NRF_QUEUE_INTERFACE_DEC(uint16_t, my_queue);
NRF_QUEUE_INTERFACE_DEF(uint16_t, my_queue, &m_queue)

err_code = my_queue_write(data_in, len_out);
APP_ERROR_CHECK(err_code);

if (!nrf_queue_is_empty())
{
    err_code = my_queue_read(data_out, len_out);
    APP_ERROR_CHECK(err_code);
}

SDK 15.2

Parents Reply Children
No Data
Related