FreeRtos problems in ADC task and Streaming Task
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 != BUFFERSNOTREADY)
{
if(xQueueSend(gadcQueue, &bufferSelect, 0) != pdPASS)
{
throwError(ERRORMESSAGEQUEUEFULL);
PRINTF(“%srn”, getErrorMessage(ERRORMESSAGEQUEUEFULL));
}
bufferSelect = BUFFERSNOT_READY;
}
~~~
Streaming client task
~~~
/* obtain next buffer ready event */
if(xQueueReceive(g_adcQueue, &bufferSelect, 0) == pdFALSE)
{
g_stopStreaming = true;
continue;
}
~~~
FreeRtos problems in ADC task and Streaming Task
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.