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 SYSTasks()
Tasks function is in the SystemTasks.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 SystemTasks.c file.
Tasks calls APP2Tasks in the app2.c file
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
BaseTypet xQueueGenericReceive( QueueHandle
t xQueue, void * const pvBuffer, TickTypet xTicksToWait, const BaseType
t xJustPeeking )
BaseTypet xEntryTimeSet = pdFALSE;
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 ) ) );
/* 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( ;; )
/* 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
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.
#define traceQUEUE_RECEIVE( pxQueue )
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.