Send strucuture using OSA_MsgQPut()

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Send strucuture using OSA_MsgQPut()

1,383 Views
utsavikalpesh
Contributor V

Hello,

I am working with KDS project and using processor expert mode. I am working with FreeRTOS. 

In my case, I want to pass a structure rather than uint32_t data throughOSA_MsgQPut() , but when I am passing stucture, my program behaves wrong. My variable values are changing and due to this, program stucks.

When I pass only uint32_t data then, it works correctly.

Why this is so? I packed my structure, but not solved yet. I also study xQueueCreate() function, in my case it is message size is multiply by uint32_t, I write message size * (uint8_t) instead of message size * (uint32_t) but program stucks on defaultISR().

What to do? Please suggest.

 Regards

Utsavi Bharuchwala

0 Kudos
Reply
3 Replies

1,150 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Utsavi Bharuchwala,

Could you please share a simple project with the code "xQueueCreate()" that can reproduce your

problem, then I can check it on my side.

BTW, which chip do you used ?

BR

Alice

0 Kudos
Reply

1,150 Views
utsavikalpesh
Contributor V

Hello Yang,

Thanks for reply. I am using MK60DN512VMD10.

Below are the small snippet. 

Task1: 

typedef struct
{
uint32_t data1;
void *ptr;
uint32_t data2;
uint32_t data3;
}Set_Struct;

Arr_Handler = OSA_MsgQCreate(&ArrayMsg, 20, sizeof(Set_Struct ));

Task2:

Set_Struct Structure; //define structure variable local

call_function_to_put_msg(&Structure); //call function which is put msg with structure pointer passed

Task3:

Set_Struct Structure; //define structure variable local

call_function_to_put_msg

{

OSA_MsgQPut(ArrayMsg, &Structure);

}

In these case local variable of Task2 is changing. Why this is happening?

regards

Utsavi Bharuchwala

0 Kudos
Reply

1,150 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Utsavi Bharuchwala,

- Sorry I was wondering there is API like OSA_MsgQCreate() ?

FreeRTOS API categories 

- There is FreeRTOS demo code under K60 in SDK package, I only test the function of xQueueCreate(),

it can work well .   You can download it from here : https://mcuxpresso.nxp.com/en/select      

pastedImage_2.png

BR

Alice

0 Kudos
Reply