Hi all,
I'm new to FreeRTOS.
Try to use version 7.6.0 ported to atmega128 atxmega128A1 and CodevisionAVR.
The demo does not work. I managed to reduce the problem to a simple program:
When creating a reading queue task, the program fails, the LEDs stop flashing. Without reading queue task, the led4 flashes 5 times and then stops because the queue is full and led0 toggle every 1 sec.
If I set priority 0 for the task vReadQueue, led4 and led5 light up and stay lit and led0 not flashes. Timer intrerrupt is triggering, and program is stuck in file list.c, function: void vListInsert( xList * const pxList, xListItem * const pxNewListItem ) in the for loop.
~~~~~~
for( pxIterator = ( xListItem * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
{
/* There is nothing to do here, we are just iterating to the
wanted insertion position. */
// here it loops forever
}
~~~~~~~
I tried demo port AVRATMega323WinAVR modified for ATmega128 and WinAVR and it does not work to.
~~~~~~
//definitii prototipuri static void vLed0( void *pvParameters );
void vWriteQueue( void *pvParameters ); void vReadQueue( void *pvParameters ); void setTestQueue(char prioritate);
static xQueueHandle xCoada; //xSemaphoreHandle xSemaphore;
void main(void) { vParTestInitialise();
/* Create the tasks defined within this file. */
xTaskCreate( vLed0, ( signed char * )"led0", configMINIMALSTACKSIZE, NULL, mainLEDTASKPRIORITY, NULL );
//vStartPolledQueueTasks( mainQUEUEPOLLPRIORITY ); //vAltStartComTestTasks( mainCOMTESTPRIORITY, 38400, led6 );
setTestQueue(mainTESTQUEUEPRIORITY);
vTaskStartScheduler();
while (1) { ; //nu trebuie sa ajunga aici; } }
void setTestQueue(char prioritate) { xCoada=xQueueCreate(5, sizeof(char)); //xSemaphore=xSemaphoreCreateBinary();
xTaskCreate( vWriteQueue, ( signed char * ) "QProdNB", configMINIMALSTACKSIZE, NULL, prioritate - 1, ( xTaskHandle * ) NULL );
/* -- next task, if it is created, block all program -- / xTaskCreate( vReadQueue, ( signed char * ) "QConsNB", configMINIMALSTACKSIZE, NULL, prioritate, ( xTaskHandle * ) NULL ); / --------------------------- */ }
void vWriteQueue( void *pvParameters ) { portTickType xLastWakeTime; char c=0; // Initialise the xLastWakeTime variable with the current time. xLastWakeTime = xTaskGetTickCount();
for( ;; )
{
c++;
//if( xSemaphoreGive( xSemaphore ) == pdPASS )
if( xQueueSend(xCoada, &c, mainNODELAY ) == pdPASS )
{
vParTestToggleLED(led4);
}
vTaskDelayUntil( &xLastWakeTime, ( portTickType ) 333 / portTICKRATE_MS );
}
}
void vReadQueue( void *pvParameters ) { char c=0; for( ;; ) { //if( xSemaphoreTake( xSemaphore, ( portTickType ) 10 / portTICKRATEMS ) == pdPASS ) if( xQueueReceive(xCoada, &c, portMAX_DELAY ) == pdPASS ) // <-- Here get stuck { vParTestToggleLED(led5); } } }
static void vLed0( void *pvParameters ) { portTickType xLastWakeTime;
// Initialise the xLastWakeTime variable with the current time. xLastWakeTime = xTaskGetTickCount();
for( ;; )
{
vTaskDelayUntil( &xLastWakeTime, mainTIMP0 );
vParTestToggleLED(led0);
}
}
~~~~~~~
my FreeRTOSconfig.h file:
~~~~~~~~ /* Call stack size for 1 task */
/* Co-routine definitions. */
/* Hook function related definitions. */
/* Run time and task stats gathering related definitions. */
/* Software timer related definitions. */
/* Interrupt nesting behaviour configuration. */
/* Set the following definitions to 1 to include the API function, or zero to exclude the API function. */
/* Optional functions - most linkers will remove unused functions anyway. */
~~~~~~~~
Any help is appreciated.
Thanks in advance, Adrian
Note there is no official XMega port (there is an AVR and a MegaAVR, but not an XMega), so the first thing to ask is, where did you get the code from?
If you wrote it yourself or obtained it from somebody else then it is difficult for us to support you directly. There are however some XMega ports in the FreeRTOS Interactive site, which is where contributed code lives: http://interactive.freertos.org if you got the code from there then it is possible the contributor will be able to help you.
If on the other hand you are trying to use the AVR or MegaAVR code from the FreeRTOS distribution, then that is not going to work on an XMega part.
Regards.
Sorry, I meant ATmega128.
I try to port also on atxmega128A and I mistyped.