Error with xQueueCreate

Posted by Diamel Sarmiento on June 26, 2012
Hi, I'm ussing FreeRTOS and when i try to create a quoue the MPLAB Compiler give me the next error:

MPLINK 4.1, Linker
Copyright (c) 2006 Microchip Technology Inc.
Error - could not find definition of symbol 'xQueueCreate' in file 'Objects\main.o'.
Errors : 1

i'm doing as the Reference Manual says:



#define QUEUE_LENGHT 5
#define QUEUE_ITEM_SIZE sizeof( AMessage )


typedef struct A_Message
{
char ucMessageID;
char ucData[20];

} AMessage;



void main( void ){

xQueueHandle xQueue;

xQueue = xQueueCreate(QUEUE_LENGHT, QUEUE_ITEM_SIZE);



I hope someone can helpme, thanks.

RE: Error with xQueueCreate

Posted by Richard on June 27, 2012
I presume you have #include "FreeRTOS.h" and #include "queue.h" in you source file? Are you building queue.c as part of your project?

I suggest taking the demo project details on this page http://www.freertos.org/port_PIC32_MIPS_MK4.html as a start. There are both MPLAB 8 and MPLAB X project, and it includes a simple blinky demo that uses a couple of tasks and a queue. When that compiles (and runs) you can take the demo code out, leaving the FreeRTOS source files in, and add in your own code.

Regards.

RE: Error with xQueueCreate

Posted by Diamel Sarmiento on June 28, 2012
thanks richard!! i can create a queue now, my misstake was the queue.c that i didnt have in the project..

Now my problem is when i try to use xQueueReceive, the reading is 0x66 ever, i put send and receive in the same task to find the problem:


static xQueueHandle xQueueUART;




void main( void ){



xQueueUART = xQueueCreate( 10, sizeof( portCHAR ) );


vPortInitialiseBlocks();

Configure_Ports();



xTaskCreate( vtaskA, ( const char * const ) "T1", configMINIMAL_STACK_SIZE, NULL, PRIORITY_taskA, NULL );


vTaskStartScheduler();


}




static void vtaskA( void *pvParameters ){


int Data='A';
int Data2;



for(;;)
{


xQueueSend(xQueueUART,&Data,( portTickType ) 0);


xQueueReceive(xQueueUART,&Data2,portMAX_DELAY);


putcUSART(Data2);
while(BusyUSART());


}





}[/quote




RE: Error with xQueueCreate

Posted by Diamel Sarmiento on June 28, 2012
but write in USART 0x66 that is the Data2 valor.

RE: Error with xQueueCreate

Posted by Richard on June 29, 2012
Your queue is created to hold 8 bit types, and when you send data to the queue you pass it a pointer to a 32 bit type.

You are sending the letter 'A', which is ascii 65, so I would expect to receive decimal 65, not hex 66, but that might be something to do with the mismatch in types.

Regards.

RE: Error with xQueueCreate

Posted by Diamel Sarmiento on July 6, 2012
you was right richard!! I changed the variable to char and now is working.