Error with xQueueCreate

diamel wrote on Tuesday, 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 © 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;

} AMessage;

void main( void ){

xQueueHandle xQueue;


I hope someone can helpme, thanks.

rtel wrote on Wednesday, 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 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.


diamel wrote on Thursday, 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 ) );



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



static void vtaskA( void *pvParameters ){

int Data=‘A’;
int Data2;



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



diamel wrote on Thursday, June 28, 2012:

but write in USART 0x66 that is the Data2 valor.

rtel wrote on Friday, 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.


diamel wrote on Friday, July 06, 2012:

you was right richard!! I changed the variable to char and now is working.