Closed eswarkeshav2001 closed 3 years ago
There is no obvious issue, because code seem to not use semaphore before it is created, but just in case move that code into top of setup():
bin_sem = xSemaphoreCreateBinary();
bin_sem2 = xSemaphoreCreateBinary();
if(bin_sem==NULL||bin_sem2==NULL)
{
Serial.println("Could not create semaphore");
ESP.restart();
}
The other issue i can see is that both task stack size is too small. Try 3-4kB.
There is no obvious issue, because code seem to not use semaphore before it is created, but just in case move that code into top of setup():
bin_sem = xSemaphoreCreateBinary(); bin_sem2 = xSemaphoreCreateBinary(); if(bin_sem==NULL||bin_sem2==NULL) { Serial.println("Could not create semaphore"); ESP.restart(); }
The other issue i can see is that both task stack size is too small. Try 3-4kB.
No man it didn't help when i move the semaphore above the setup i getting an error "bin_sem doesn't name a type" and i also increased stack size to 4096 but still i got the same xqueuegenericreceive error. But i appreciate your help brother.
when i move the semaphore above the setup
Not above, just before other code in setup:
void setup()
{
Serial.begin(115200);
bin_sem = xSemaphoreCreateBinary();
bin_sem2 = xSemaphoreCreateBinary();
if(bin_sem==NULL||bin_sem2==NULL)
{
Serial.println("Could not create semaphore");
ESP.restart();
}
when i move the semaphore above the setup
Not above, just before other code in setup:
void setup() { Serial.begin(115200); bin_sem = xSemaphoreCreateBinary(); bin_sem2 = xSemaphoreCreateBinary(); if(bin_sem==NULL||bin_sem2==NULL) { Serial.println("Could not create semaphore"); ESP.restart(); }
Still same error buddy
The BUFF_SIZE
is 1000, but:
char Reading[4];
You have memory corruption, which leads to that weird error.
The
BUFF_SIZE
is 1000, but:char Reading[4];
You have memory corruption, which leads to that weird error.
Damn man! it worked .very thanks for your help brother .But i still don't get how it worked. let me explain what i thought was happening I have an array of 1000 values and i am taking value one by one from that array and i am storing that single value in char array then after sending the value i am overwriting the 4 bits of char array for next value. now here why the size of char should be 1000.however i just gonna store only one number in char array and overwrite the array for the next value right? i think for a single number size of 1000 is very big. So could you please explain me how you figured it out what my mistake is .because my curiosity is killing me here. Sorry man i couldn't able to reply you earlier
It is simple, just read code.
You want to do what you described, but there is issue. Maybe i am mistaken too and 100 is wrong value, because i didnt read code very carefully.
The clue was log output when all values are printed. I thought you create full json and then send it, but maybe you just missing trailing 0
in char string. In that case char array size is 5.
Important is to read log output, thats why you add it to code. When last log before crash is array, then something after that is causing crash.
got it buddy. Thanks for helping me out.it really means a lot
Hardware:
Description:
Describe your problem here Hey guys i have been working on a project in which the analog values sampled at a particular frequency and stored in array. Then the value will be sent to user application ESP32 BLE. But I got stuck in this error (xQueueGenericReceive)- assert failed! abort(). I am Using Esp32arduino and Free Rtos for programming i error is in the semaphore from the interrupt but i couldn't able to find out exact solution. Please help me out guys. Thanks in advance
Sketch: (leave the backquotes for code formatting)
Debug Messages:
/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c:1443 (xQueueGenericReceive)- assert failed! abort() was called at PC 0x4008e1d5 on core 1
Backtrace: 0x40091b38:0x3ffe0b20 0x40091d69:0x3ffe0b40 0x4008e1d5:0x3ffe0b60 0x400d1a2d:0x3ffe0ba0 0x4008e525:0x3ffe0be0
Rebooting... 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:1 load:0x3fff0018,len:4 load:0x3fff001c,len:1044 load:0x40078000,len:8896 load:0x40080400,len:5816 entry 0x400806ac
D][FreeRTOS.cpp:189] take(): Semaphore taking: name: RegisterAppEvt (0x3ffde180), owner: <N/A> for registerApp [D][FreeRTOS.cpp:198] take(): Semaphore taken: name: RegisterAppEvt (0x3ffde180), owner: registerApp [D][BLEDevice.cpp:102] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 4] ... Unknown [D][FreeRTOS.cpp:189] take(): Semaphore taking: name: CreateEvt (0x3ffde3d8), owner: <N/A> for createService [D][FreeRTOS.cpp:198] take(): Semaphore taken: name: CreateEvt (0x3ffde3d8), owner: createService [D][FreeRTOS.cpp:189] take(): Semaphore taking: name: CreateEvt (0x3ffde63c), owner: <N/A> for executeCreate [D][FreeRTOS.cpp:198] take(): Semaphore taken: name: CreateEvt (0x3ffde63c), owner: executeCreate [D][BLEDevice.cpp:102] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 4] ... Unknown [D][BLEService.cpp:225] addCharacteristic(): Adding characteristic: uuid=6e400003-b5a3-f393-e0a9-e50e24dcca9e to service: UUID: 6e400001-b5a3-f393-e0a9-e50e24dcca9e, handle: 0x0028 [D][BLECharacteristic.cpp:90] executeCreate(): Registering characteristic (esp_ble_gatts_add_char): uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e, service: UUID: 6e400001-b5a3-f393-e0a9-e50e24dcca9e, handle: 0x0028 [D][FreeRTOS.cpp:189] take(): Semaphore taking: name: CreateEvt (0x3ffdf058), owner: <N/A> for executeCreate [D][FreeRTOS.cpp:198] take(): Semaphore taken: name: CreateEvt (0x3ffdf058), owner: executeCreate [D][BLEDevice.cpp:102] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 4] ... Unknown [D][FreeRTOS.cpp:189] take(): Semaphore taking: name: CreateEvt (0x3ffdf26c), owner: <N/A> for executeCreate [D][FreeRTOS.cpp:198] take(): Semaphore taken: name: CreateEvt (0x3ffdf26c), owner: executeCreate [D][BLEDevice.cpp:102] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 4] ... Unknown [D][FreeRTOS.cpp:189] take(): Semaphore taking: name: StartEvt (0x3ffde6fc), owner: <N/A> for start [D][FreeRTOS.cpp:198] take(): Semaphore taken: name: StartEvt (0x3ffde6fc), owner: start [D][BLEDevice.cpp:102] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 4] ... Unknown [I][BLEDevice.cpp:554] getAdvertising(): create advertising [D][BLEDevice.cpp:556] getAdvertising(): get advertising [D][BLEAdvertising.cpp:196] start(): - no services advertised Waiting a client connection to notify... [D][BLEDevice.cpp:556] getAdvertising(): get advertising [D][BLEAdvertising.cpp:491] handleGAPEvent(): handleGAPEvent [event no: 0] [D][BLEDevice.cpp:556] getAdvertising(): get advertising [D][BLEAdvertising.cpp:491] handleGAPEvent(): handleGAPEvent [event no: 1] [D][BLEDevice.cpp:556] getAdvertising(): get advertising [D][BLEAdvertising.cpp:491] handleGAPEvent(): handleGAPEvent [event no: 6]