Error while trying to create task from other tasks
Posted: Mon Jan 04, 2021 10:59 am
I am trying to create one task pub_sub inside a task aws_connect but I am getting error.
Below is the outline of my code :
But i get below error when xTaskCreate(&pub_sub_task, "pub_sub_task", 9216, NULL, 4, NULL) is called :
can someone please help with this error? What am i doing wrong here?
Below is the outline of my code :
Code: Select all
//Global variables
struct Params
{
IoT_Error_t result;
AWS_IoT_Client awsClient;
}taskParam;
Code: Select all
//Inside aws_connect_task with priority 5
ESP_LOGI(TAG, "AWS connected");
taskParam.result = rc;
taskParam.awsClient = client;
ESP_LOGI(TAG, "Starting pub sub");
if (xTaskCreate(&pub_sub_task, "pub_sub_task", 9216, NULL, 4, NULL) != pdPASS) {
ESP_LOGE(TAG, "Couldn't create cloud task\n");
}
vTaskDelete(NULL);
Code: Select all
//inside pub_sub_task
struct Params* taskParams = params;
IoT_Error_t rc = taskParams->result;
AWS_IoT_Client client = taskParams->awsClient;
//setting pub sub variables
while(rc ==SUCESSS)
{
//publishing to aws iot core
}
vTaskDelete(NULL);
Code: Select all
I (5459) AWS Connect: Starting pub sub
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x4000c2e0 PS : 0x00060030 A0 : 0x800d8729 A1 : 0x3ffd5a80
A2 : 0x3ffd5aa0 A3 : 0x00000008 A4 : 0x00000c00 A5 : 0x3ffd5aa0
A6 : 0x00000001 A7 : 0x000000c0 A8 : 0x00000000 A9 : 0x00060423
A10 : 0x00000001 A11 : 0x00000001 A12 : 0x00000000 A13 : 0x3ffb4294
A14 : 0x00000003 A15 : 0x00060023 SAR : 0x00000000 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000008 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x000000bf
Backtrace:0x4000c2dd:0x3ffd5a80 0x400d8726:0x3ffd5a90 0x4008adc9:0x3ffd68e0
0x400d8726: pub_sub_task at /home/anubhav/esp/projects/AWS_IoT_Thing_Shadow/build/../main/aws_connect.c:56
0x4008adc9: vPortTaskWrapper at /home/anubhav/esp/esp-idf/components/freertos/port/xtensa/port.c:168