Replies: 2 comments 1 reply
-
your task stack is too small. Maybe try 2K or 4K stack size for the tasks instead of 512B |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks I figured it out last night. I kept reading thing about running out
of memory so I interpreted it as main memory and kept reducing the stack
size. First time trying freeRTOS.
Thanks!
…On Mon, Oct 17, 2022, 4:24 AM Me No Dev ***@***.***> wrote:
your task stack is too small. Maybe try 2K or 4K stack size for the tasks
instead of 512B
—
Reply to this email directly, view it on GitHub
<#7358 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAYE6HUSWI6VDYK7O7UWTCDWDUELFANCNFSM6AAAAAARFWF5YQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to implement the Wire Scan example in a freeRTOS task. and as soon as the code hits Wire.beginTransmission(address); the ESP32 gives me a
"Guru Meditation Error: Core 1 panic'ed (Unhandled debug exception).
Debug exception reason: Stack canary watchpoint triggered (Task1) " and reboots.
Arduino IDE 1.8.18 (also tried 2.0.0), esp32 version 2.0.5. Hardware is a DFRobot Firebeetle ESP32-E DFR0654.
Any Help would be appreciated.
`#include <Wire.h>
#if CONFIG_FREERTOS_UNICORE
#define ARDUINO_RUNNING_CORE 0
#else
#define ARDUINO_RUNNING_CORE 1
#endif
#ifdef ARDUINO_ARCH_ESP32
#include "esp32-hal-log.h"
#endif
#ifndef LED_BUILTIN
#define LED_BUILTIN 2
#endif
// define two tasks for Blink & AnalogRead
void Task1(void *pvParameters);
void Task2(void *pvParameters);
// the setup function runs once when you press reset or power the board
void setup() {
Serial.begin(115200);
// Wait a moment to start (so we don't miss Serial output)
vTaskDelay(1000 / portTICK_PERIOD_MS);
Serial.println();
Serial.println("--- FreeRTOS Example ---");
Serial.println(" Start Task Creation ");
Wire.begin(21,22);
Wire.setClock(400000);
//Wire.begin();
/***************************************************************************
Creating Task
In the setup() function we will use xTaskCreatePinnedToCore() function to
create the task for core0 and core1 respectively. This function takes in
seven parameters. They are listed in order below:
lowest priority.
is core0 and 1 is core1.
****************************************************************************/
xTaskCreatePinnedToCore(Task1, "Task1", 512, NULL, 1, NULL, ARDUINO_RUNNING_CORE);
xTaskCreatePinnedToCore(Task2, "Task2", 512, NULL, 1, NULL, ARDUINO_RUNNING_CORE);
Serial.print("Setup Finished, running on core ");
Serial.println(xPortGetCoreID());
// Now the task scheduler, which takes over control of scheduling individual tasks, is automatically started.
}
void loop()
{
// Empty. Things are done in Tasks.
}
/--------------------------------------------------/
/---------------------- Tasks ---------------------/
/--------------------------------------------------/
void Task1(void *pvParameters) // This is a task.
{
(void) pvParameters;
Serial.print("Task1, running on core ");
Serial.println(xPortGetCoreID());
// initialize digital LED_BUILTIN on pin 13 as an output.
pinMode(LED_BUILTIN, OUTPUT);
for (;;) // A Task shall never return or exit.
{
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
vTaskDelay(500 / portTICK_PERIOD_MS); // one tick delay (15ms) in between reads for stability
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
vTaskDelay(500 / portTICK_PERIOD_MS); // one tick delay (15ms) in between reads for stability
Serial.print("Blink! ");
}
}
void Task2(void *pvParameters) // This is a task.
{
(void) pvParameters;
byte error, address;
int nDevices = 0;
Serial.print("Task2, running on core ");
Serial.println(xPortGetCoreID());
while (1) {
Serial.println("Task2");
Serial.println("Scanning for I2C devices ...");
for (address = 0x01; address < 0x7f; address++) {
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0) {
Serial.printf("I2C device found at address 0x%02X\n", address);
nDevices++;
} else if (error != 2) {
Serial.printf("Error %d at address 0x%02X\n", error, address);
}
}
if (nDevices == 0) {
Serial.println("No I2C devices found");
}
vTaskDelay(6000/ portTICK_PERIOD_MS); // one tick delay (15ms) in between reads for stability
}
}`
'
--- FreeRTOS Example ---
Start Task Creation
Setup Finished, running on core 1
Guru Meditation Error: Core 1 panic'ed (Unhandled debug exception).
Debug exception reason: Stack canary watchpoint triggered (Task1)
Core 1 register dump:
PC : 0x4008ab07 PS : 0x00060136 A0 : 0x80088f81 A1 : 0x3ffb94d0
A2 : 0x3ffb8f00 A3 : 0xb33fffff A4 : 0x0000cdcd A5 : 0x00060123
A6 : 0x00060120 A7 : 0x0000abab A8 : 0xb33fffff A9 : 0xffffffff
A10 : 0x00000003 A11 : 0x00060123 A12 : 0x00060120 A13 : 0x00000004
A14 : 0x007b8f00 A15 : 0x003fffff SAR : 0x00000000 EXCCAUSE: 0x00000001
EXCVADDR: 0x00000000 LBEG : 0x400865b9 LEND : 0x400865c9 LCOUNT : 0xfffffff9
Backtrace:0x4008ab04:0x3ffb94d00x40088f7e:0x3ffb9510 0x400d6056:0x3ffb9550 0x400d6865:0x3ffb95a0 0x400d27c8:0x3ffb95d0 0x400d1b95:0x3ffb95f0 0x400d1f57:0x3ffb9610 0x400d2005:0x3ffb9630 0x400d11a3:0x3ffb9650
ELF file SHA256: 0000000000000000
Rebooting...
ets Jul 29 2019 12:21:46
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1184
load:0x40078000,len:13160
load:0x40080400,len:3036
entry 0x400805e4'
Beta Was this translation helpful? Give feedback.
All reactions