Send strucuture using OSA_MsgQPut()

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Send strucuture using OSA_MsgQPut()

1,057 次查看
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 项奖励
3 回复数

824 次查看
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 项奖励

824 次查看
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 项奖励

824 次查看
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 项奖励