lee-soter wrote on Thursday, May 26, 2016:
RTOSFree V8 on PIC32MX795F512L Ethernet Development Board Harmony 1.07.01
I opened the freertos basic project in harmony
It compiles and runs on the Ethernet development board
Main.c calls SYS_Tasks()
SYS_Tasks function is in the System_Tasks.c file
xTaskCreate function creates a list of tasks and then vTaskStartScheduler() is called.
One of the tasks created is _APP2_Tasks and this function is also in the System_Tasks.c file.
_APP2_Tasks calls APP2_Tasks in the app2.c file
The APP2_Tasks calls a macro xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );
The xQueueReceive macro is in the queue.h file
#define xQueueReceive( xQueue, pvBuffer, xTicksToWait ) xQueueGenericReceive( ( xQueue ), ( pvBuffer ), ( xTicksToWait ), pdFALSE )
As you can see it calls another macro xQueueGenericReceive
The implementation of the macro xQueueGenericReceive is in the queue.c file
BaseType_t xQueueGenericReceive( QueueHandle_t xQueue, void * const pvBuffer, TickType_t xTicksToWait, const BaseType_t xJustPeeking )
{
BaseType_t xEntryTimeSet = pdFALSE;
TimeOut_t xTimeOut;
int8_t *pcOriginalReadPosition;
Queue_t * const pxQueue = ( Queue_t * ) xQueue;
configASSERT( pxQueue );
configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) );
#if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
{
configASSERT( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) );
}
#endif
/* This function relaxes the coding standard somewhat to allow return
statements within the function itself. This is done in the interest
of execution time efficiency. */
for( ;; )
{
taskENTER_CRITICAL();
{
/* Is there data in the queue now? To be running the calling task
must be the highest priority task wanting to access the queue. */
if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 )
{
/* Remember the read position in case the queue is only being
peeked. */
pcOriginalReadPosition = pxQueue->u.pcReadFrom;
prvCopyDataFromQueue( pxQueue, pvBuffer );
if( xJustPeeking == pdFALSE )
{
traceQUEUERECEIVE( pxQueue );
/* Actually removing data, not just peeking. */
--( pxQueue->uxMessagesWaiting );
As I understand the operation of the RTOS Basic project from Microchip; is that the tasks that have been started are constantly querying the UART for specific values. I am assuming that somewhere else in the program there is a section of code that generates a specific UART output at specific intervals. Toward the end of the section of code above appears to be the last leg of the code (traceQUEUERECEIVE( pxQueue ) that actually reads the value from the UART but I lose track of the code at this point.
I have searched for traceQUEUE_RECEIVE in my project and there is only one other place that it shows up and it is the definition of the macro in the FreeRTOS.h file.
#ifndef traceQUEUE_RECEIVE
#define traceQUEUE_RECEIVE( pxQueue )
#endif
My goal is to understand how the pvBuffer variable in the xQueueReceive macro gets filled. I have my own board that is similar to the Ethernet Development board but instead of filling it with UART information I want have one task get filled with I2C information and another task get filled with SPI information.
Any help or direction would be greatly appreciated.