Problem stack size SET_LOOP_TASK_STACK_SIZE

Hello, good morning everyone,

I was developing my program in Arduino and when running my program I got the following errors:
Guru Meditation Error: Core 1 panic'ed (Unhandled debug exception)
Debug exception reason: Stack canary watchpoint triggered (loopTask)
After a search on the internet, most users agreed on the problem of the stack and the increase of its size, so I added the command: SET_LOOP_TASK_STACK_SIZE( 16*1024 );

This was done by researching here:
#6025

#7824

However when I added the command and compiled, I got this error:

"Compilation error: expected constructor, destructor, or type conversion before '((' token"

I compile with the ESP32 Wrover module support board, and all the ESP32 libraries are added as I saw in various tutorials. I attach the code in case it might help.

If anyone knows why this error occurs and what I should change I would be very grateful.

Thanks and best regards

#include <SPI.h>
#include <LoRa.h>
#include <Arduino.h>

//define the pins used by the transceiver module
#define ssl 5
#define rst 14
#define dio0 2

SET_LOOP_TASK_STACK_SIZE(12*1024);


void setup() {

}


void loop() {

}

Please indicate the line where this token is flagged. A full error message were nice.
Perhaps one of the #defines is defective?

You want to stop your program without feeding the watchdog?

Attached is the complete error

error: expected constructor, destructor, or type conversion before '(' token
SET_LOOP_TASK_STACK_SIZE(12*1024);
^

exit status 1

Compilation error: expected constructor, destructor, or type conversion before '(' token

Is the line where I call SET_LOOP_TASK_STACK_SIZE just before void setup

The program is designed to execute the loop only once, since you want to generate variables only once, not repeatedly.

How is that declared?

Such things should go into setup(), not loop(). You only replace the outer loop() loop by an inner while() loop.

I have no knowledge, Imooerate here on pattern matching and I note in case it means anything that

// This sets Arduino Stack Size - comment this line to use default 8K stack size
SET_LOOP_TASK_STACK_SIZE(16*1024); // 16KB

is the very very first thing that gets appears in the code in the example.

a7

Try moving that line into setup().

And

to before the very first # include…

a7

Where will it be defined then?

The same place it gets defined in the example. Somewhere.

It looks like something that is known. The structure of the example is

SET_LOOP…

void setup(){}

void loop(){}

a7

From what I have read from the various sources I have posted, I believe it would be like a function to increase the stack size and would be included in the ESP32 board manager done by Espressif. That board manager is already added and installed.

Yes, from there I have based it, but I have put it before the includes and the same error comes out, if I put it in the setup this error:

error: 'SET_LOOP_TASK_STACK_SIZE' was not declared in this scope.
SET_LOOP_TASK_STACK_SIZE(12*1024);
^

exit status 1

Compilation error: 'SET_LOOP_TASK_STACK_SIZE' was not declared in this scope

I also downloaded the example you mention and I get the same Compilation error I mentioned above: expected constructor, destructor, or type conversion before '(' token

To me that is progress. At least you are looking through someone else's lunch, not your own.

a7

An #include is missing or you don't use the required firmware. MightyCore or FreeRTOS or ...

Where did you find the hint on using SET_LOOP_TASK_STACK_SIZE?

I found the suggestion in these files that I attach below

Also in this thread of this same page it is suggested to use SET_LOOP_TASK_STACK_SIZE

I'd look into the source code of that task.

did you try the example sketch??

ESP32 Change Stack Size..

good luck.. ~q

The example does not work, at least with my version of arduino and my ESP32 board.

I've already done some research on that but without much success, I'll try to check it out again and see. Thank you very much

The example in the Arduino IDE works as expected.

In my case I do not see this stack issue. I have Arduino IDE 2.1.0 and ESP32 version 2.0.9.