FreeRtos problems in ADC task and Streaming Task

andreahmed wrote on Friday, May 25, 2018:

I have an ADC task that uses 4 channels and uses the DMA for transfer I also have a streaming client which streams the ADC data thur the TCP socket I made the ADS Task lower priority than the streaming client.

I’m sending an integer that selects which ADC channel is selected as a message queue to the streaming client.

The problem is I get queue overflow when sending that adc channel integer.

ADC TASK

if(bufferSelect != BUFFERS_NOT_READY)
        {
            if(xQueueSend(g_adcQueue, &bufferSelect,  0) != pdPASS)
            {
                throwError(ERROR_MESSAGE_QUEUE_FULL);
                PRINTF("%s\r\n", getErrorMessage(ERROR_MESSAGE_QUEUE_FULL));
            }
            bufferSelect = BUFFERS_NOT_READY;
        }

Streaming client task

/* obtain next buffer ready event */
        if(xQueueReceive(g_adcQueue, &bufferSelect, 0) == pdFALSE)
        {
            g_stopStreaming = true;
            continue;
        }

rtel wrote on Friday, May 25, 2018:

In both the queue read and queue write case you have a block time of 0.
If you add a block time you will get a natural flow control as the queue
becomes full (or empty as the case may be). Also if you only have one
reader and one writer consider a stream or message buffer as a more
efficient means of sending the data.