FreeRTOS task is rebooting my ESP32 (using espnow)
I have my ESP32 device using FreeRTOS.
I have a task that uses espnow to request data from another ESP32 device. This was working perfectly outside of a FreeRTOS task, but when I move the code into the Task function the device is rebooting continuously.
This is my Task function code:
void requestData(void *params){
struct_message data = *((struct_message*)params);
for(;;){
// send request temp espnow
data.request_type = 1;
strcpy(data.message, "Request Data");
esp_err_t result = esp_now_send(broadcastAddress, (uint8_t *) &data, sizeof(data));
if (result == ESP_OK) {
Serial.println("Sent with success");
}
else {
Serial.println("Error sending the data");
}
vTaskDelay(10000 / portTICK_PERIOD_MS);
}
}
And this is how I create the task inside the Setup() function:
xTaskCreate(requestData,"Request Data",2048, (void*)&send_Data, 1, NULL);
I don't know what Im doing wrong. If I comment the following line everything works fine, no rebooting.
esp_err_t result = esp_now_send(broadcastAddress, (uint8_t *) &data, sizeof(data));
** UPDATE **
send_Data is defined as follows:
// Must match with ESP32 paired.
typedef struct struct_message {
int request_type;
char message[100];
float thermal_data[NUMBER_OF_THERMALCOUPLE];
} struct_message;
This is the excpetion:
ets Jun 8 2016 00:22:57
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:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:10124
load:0x40080400,len:5828
entry 0x400806a8
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x40138494 PS : 0x00060030 A0 : 0x800d08bb A1 : 0x3ffd3b10
A2 : 0x3ffbdbb4 A3 : 0x3ffd3b48 A4 : 0x00000074 A5 : 0x3ffbdd54
A6 : 0x3ffc6d78 A7 : 0x00000000 A8 : 0x61540061 A9 : 0x00000020
A10 : 0x00000000 A11 : 0x3ffbbd3c A12 : 0x80081ec5 A13 : 0x3ffbc0e0
A14 : 0x3ffb9a20 A15 : 0x3ffbbcd4 SAR : 0x00000000 EXCCAUSE: 0x0000001c
EXCVADDR: 0x0000003c LBEG : 0x400013f9 LEND : 0x4000140d LCOUNT : 0xfffffffb
ELF file SHA256: 0000000000000000
Backtrace: 0x40138494:0x3ffd3b10 0x400d08b8:0x3ffd3b40 0x4008a2fa:0x3ffd3be0
Rebooting...
Any clue?
from Recent Questions - Stack Overflow https://ift.tt/3zN0NLc
https://ift.tt/eA8V8J
Comments
Post a Comment