Queues copy data into the queue buffer. If the message you are inserting into the queue, is bigger than the queue, it won’t work. Your pointer to mess is only 4 byes. Your first queue_message_passing_struct is over 2004 bytes not including the overhead used by FreeRTOS. Your second queue_message_passing_struct is only 8 bytes.
//Structure to pass to a queue
typedef struct
{
char mess[2000];
int id;
}queue_message_passing_struct
// Creating an instance of a struct
queue_message_passing_struct mess;
//Creating a queue handle
QueueHandle_t xQueue1;
//Some function in which queue is created
void some_function_to_create_queue()
{
xQueue1 = xQueueCreate(1,sizeof(mess));
}
Do you check that the value of xQueue1 is not 0 after the create. If your heap doesn’t have enough spare room to make that big of a structure, it will return 0, and if you don’t detect and report that, when you use that 0 as a queue handle problems will occur.
xQueueCreate does NOT return a status flag, but a queue handle, so xQueue1 could NOT be pdPASS (which is the value 1). If by ‘pdPASS’, you mean it was not 0, then that is good.
That doesn’t answer the question then. When creating the queue, did you check that the queue handle was not 0 aftger the create? (your shown code doesn’t have a test)
A second issue also could be do the sending and receiving task have enough stack space. If the structure is stored on their stack, it will require 2004 bytes of statck space, and if that is not available you could be overruning it and corrupting something else in memory.