Problem with struct and int

Hi! I need a help with figuring out an error I get.
I created 3 tasks. Two tasks send theit data (struct, which contains int and float) to the third task, which must compare the received data and make some decision. With printf I’m checking in the senders the data they send and it looks just fine. But when I check the received data in the receiver, the data received from one sender looks weird. The float data is fine, but fot the int I get some weird very big negative number. I assume the problem could be because of the data type, but on the other side, there is no problem with the first sender, though the first and the second sender have exactly the same data types. Any help would be highly appreciated! Many thanks in advance!

I think that it would be helpful if you can show some code. I assume that you are using queues? How do you initialise them?
Please enclose source code between 2 lines that only contain 3 tildas:


void code_sample()
	printf( "Value = %d\n", value );

and you will see that it gets nicely formatted.

That sounds like the structs reside on the respective tasks stacks and you simply pass a pointer to the struct from one task to another. It’s straightforward to understand why that won’t work You need to pass the structure as a whole via IPC (FreeRTOS does that by itself, but only if you pass the entire structure, not a pointer to it)

As Hein wrote, some code would quickly reveal the problem.

Thank you very much for your reply! I’ve found the cause of the error as I was copying the code to send it here!!! The problem was because of the “sizeof” in the second queue, I used sizeof(float), instead of sizeof(struct).

I’m sorry for bothering you and thank you very much for your help and concern!