Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

Problem with the Item post in the queue

Posted by Nobody/Anonymous on February 14, 2007
Hi, Hope all is great there...

I´m trying to make 2 easy tasks with send and received function:

I defined the send function like this :

if( cQueueSend( ParamEvento.xQueueEvento,( void * ) &mensaje_e, pParamEvento->xBlockTime ) != pdPASS )

and the received like :

if(cQueueReceive( ParamEvento.xQueueEvento, &usDataRxEvento, ParamEvento.xBlockTime ) == pdPASS)

where mensaje_e and usDataRxEvento are signed portSHORT;

Tasks are running well but when I try to see wich is the value sent (in this case mensaje_e) the tasks doesn´t work.


These are the definitions:

typedef struct PARAMETROS_DE_EVENTO
{
xQueueHandle xQueueEvento;
portTickType xBlockTime;
char mensaje;
portTickType DelayTime;
}Param_evento;

static void Task_Ruedas( void *pvParameters );
static void Task_Encoder( void *pvParameters );

and the problem is when i´m trying to make something like:

if(ParamEvento.mensaje==usDataRxEvento){
DUTY_PWM1=400;
DUTY_PWM2=400;
direccion=1;
Configuracion_PWM();
PORTBbits.RB4=direccion;
PORTBbits.RB5=direccion;
}

Thanks so much for your help, i´ll waiting all your good ideas i don´t know what else can i do find a solution for this problem.

Thanks again and have a nice day!!!

Best Regards,


Lilian



RE: Problem with the Item post in the queue

Posted by Nobody/Anonymous on February 14, 2007
I cannot see anything wrong with your queue send or receive calls provided your mensaje and usDataRxEvento are just unsigned shorts, not pointers to unsigned shorts.

Is your problem simply that the value you send to the queue is not the value received?

Dave.

RE: Problem with the Item post in the queue

Posted by Nobody/Anonymous on February 14, 2007
Hello Dave! thanks so much for your help...

yeah my problem is that...the value sent is not the value received..... Do you know what is probably the reason ?

Thanks again for your help...i´ll waiting good news!!

Regards,


Lilian

RE: Problem with the Item post in the queue

Posted by Nobody/Anonymous on February 15, 2007

Hi,

Can you tell the statement for creating the queue?

Are you using the same structure for sending in queue , which you used in creating the queue??

It is very obvious that you would have done so, but just trying to find out the problem.

-regards

RE: Problem with the Item post in the queue

Posted by Nobody/Anonymous on February 15, 2007
Hi! thanks for your help this is the statement where I created the queue, and i´m using the same structure Param_Evento to send and receive:

typedef struct PARAMETROS_DE_EVENTO
{
xQueueHandle xQueueEvento;
portTickType xBlockTime;
char mensaje;
portTickType DelayTime;
}Param_evento;



pParamEvento1 = ( Param_evento * )pvPortMalloc( sizeof(Param_evento ) );
pParamEvento1->xQueueEvento = xQueueCreate(LONG_COLA,TAM_MENSAJE );
pParamEvento1->xBlockTime = xDontBlock;
pParamEvento1->mensaje = 1;
pParamEvento1->DelayTime = ( portTickType ) 200 / portTICK_RATE_MS;

The creation of the task are:

sTaskCreate( Task_Ruedas, ( const portCHAR * const ) "Ruedas", portMINIMAL_STACK_SIZE, ( void * ) pParamEvento1,mainTASK_RUEDAS, NULL );
sTaskCreate( Task_Encoder, ( const portCHAR * const ) "Encoder", portMINIMAL_STACK_SIZE, ( void * ) pParamEvento1,mainTASK_ENCODER, NULL );


and the function send and receive are:

cQueueSend( ParamEvento.xQueueEvento,( void * ) &mensaje_e, pParamEvento->xBlockTime ) != pdPASS )

cQueueReceive( ParamEvento.xQueueEvento, &usDataRxEvento, ParamEvento.xBlockTime ) == pdPASS)

thanks again for your help!

Hope we find the mistake soon i don´t what else change to make it works well....

Best Regards,

Lilian


RE: Problem with the Item post in the queue

Posted by Nobody/Anonymous on February 16, 2007

Hi,

It seems the problem is not in the calling of functions. problem is somewhere in using pointers.

So we can recheck everything related to pointers (again obvious things but its better to recheck):

1.Queue handle is in pParamEvento1 but you are using pParamEvento to access the queue. Then pParamEvento1 should be assigned to pParamEvento, "pParamEvento = *pParamEvento1;". IS it??

2. You should check whether the pvPortMalloc was successfull in alloacting the memory or not.

3. Also it is good to check whether queue was created successfully or not

-regards


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists