Queue problem using struct

Im studying queue and Im with this problem. I created a method queueBoardSend() in file Utils.cpp/Utils.h and I call this method by tasks in Main.cpp. But this problem occurred:

[0;32mI (300) cpu_start: Starting scheduler on PRO CPU.e[0m
[0;32mI (0) cpu_start: Starting scheduler on APP CPU.e[0m
1 abort() was called at PC 0x40080f12 on core 0

ELF file SHA256: a466fbb15ca90d02cd6b43005dc86b48bfc8a4fa0ef5891d3b35375a504fd38a

Backtrace: 0x40085f25:0x3ffb7890 0x40086299:0x3ffb78b0 0x40080f12:0x3ffb78d0 0x40081035:0x3ffb7900 0x400da165:0x3ffb7920 0x400d6179:0x3ffb7be0 0x400d6108:0x3ffb7c30 0x40088e96:0x3ffb7c60 0x4008816f:0x3ffb7c80 0x400d0b7f:0x3ffb7cc0 0x400d0c61:0x3ffb7cf0 0x4008a209:0x3ffb7d50

Rebooting…

My code:

<Utils.h>
struct QueueItem
{
int Cmd, Param1, Param2 = 0;
};

void queueBoardSend();

<Utils.cpp>
void queueBoardSend()
{
if (boardQueue != NULL)
{
struct QueueItem x;
x.Cmd = 1;
x.Param1 = 2;
x.Param2 = 3;
xQueueSend(boardQueue, &x, portMAX_DELAY);
}
}

If I was to rephrase your post as “I tried to use a queue and it crashed, please help me identify why?” would I be correct?

If so, then I’m afraid you do not provide enough information for us to try and answer. For example.

Did you create the queue before trying to use it?
Did you check it was actually created, even if you think you did create it?
Does this happen the first time you use the queue?
What did you do to try and debug it?
As you seem to be using C++, how are you linking the C and C++ code?
Etc.

1 Like

I found the problem. The problem is the memory size. When I created the task, I used stack depth 1024. When I changed to 8196 my code works.