OTA fails when BLE is enabled

gregstewart90
Posts: 59
Joined: Thu Jan 19, 2017 5:17 pm

OTA fails when BLE is enabled

Postby gregstewart90 » Tue May 02, 2017 4:44 pm

I've recently starting using the BLE on my application. OTA updates were working just fine before I starting using BLE. Now, if I try to run an OTA update with the BLE code running, I get the following errors:

Code: Select all

I (15703) ota: Connected to server
I (15703) ota: Connected to http server
I (15703) ota: Send GET request to server succeeded
Task watchdog got triggered. The following tasks did not feed the watchdog in time:
Tasks currently running:
CPU 0: ota_update_star
CPU 1: ipc1
The ESP resets, and I capture this core dump.

Code: Select all

==================== CURRENT THREAD STACK =====================
#0  0x401704b0 in rcUpdateRxDone ()
#1  0x40094605 in ppRxProtoProc ()
#2  0x40094bf0 in ppRxPkt ()
#3  0x40096c6a in ppTask ()

======================== THREADS INFO =========================
  Id   Target Id         Frame 
  19   process 18        0x4008458f in xQueueGenericReceive (xQueue=0x0, pvBuffer=0x0, xTicksToWait=<unavailable>, xJustPeeking=0) at /path/to/folder/esp-idf-v2.0/components/freertos/./queue.c:1594
  18   process 17        0x4008458f in xQueueGenericReceive (xQueue=0x1, pvBuffer=0x40081dd8 <spi_flash_op_block_func>, xTicksToWait=<unavailable>, xJustPeeking=0) at /path/to/folder/esp-idf-v2.0/components/freertos/./queue.c:1594
  17   process 16        0x4008458f in xQueueGenericReceive (xQueue=0x3ffc7d80, pvBuffer=0x3ffc7cdd, xTicksToWait=<unavailable>, xJustPeeking=0) at /path/to/folder/esp-idf-v2.0/components/freertos/./queue.c:1594
  16   process 15        0x4008458f in xQueueGenericReceive (xQueue=0x3ffeea38, pvBuffer=0x3ffd5490, xTicksToWait=2148957620, xJustPeeking=0) at /path/to/folder/esp-idf-v2.0/components/freertos/./queue.c:1594
  15   process 14        0x4008458f in xQueueGenericReceive (xQueue=0x0, pvBuffer=0x40081dd8 <spi_flash_op_block_func>, xTicksToWait=<unavailable>, xJustPeeking=0) at /path/to/folder/esp-idf-v2.0/components/freertos/./queue.c:1594
  14   process 13        0x4008458f in xQueueGenericReceive (xQueue=0x3ffeefb0, pvBuffer=0x3ffbd0c0, xTicksToWait=2148956440, xJustPeeking=0) at /path/to/folder/esp-idf-v2.0/components/freertos/./queue.c:1594
  13   process 12        0x4008458f in xQueueGenericReceive (xQueue=0x0, pvBuffer=0x0, xTicksToWait=<unavailable>, xJustPeeking=0) at /path/to/folder/esp-idf-v2.0/components/freertos/./queue.c:1594
  12   process 11        0x4008458f in xQueueGenericReceive (xQueue=0x0, pvBuffer=0x0, xTicksToWait=<unavailable>, xJustPeeking=0) at /path/to/folder/esp-idf-v2.0/components/freertos/./queue.c:1594
  11   process 10        0x4008458f in xQueueGenericReceive (xQueue=0x3ffc4598, pvBuffer=0x3f403f70, xTicksToWait=<unavailable>, xJustPeeking=0) at /path/to/folder/esp-idf-v2.0/components/freertos/./queue.c:1594
  10   process 9         0x4008458f in xQueueGenericReceive (xQueue=0x0, pvBuffer=0x0, xTicksToWait=<unavailable>, xJustPeeking=0) at /path/to/folder/esp-idf-v2.0/components/freertos/./queue.c:1594
  9    process 8         0x40085f3a in prvProcessTimerOrBlockTask (xNextExpireTime=<optimized out>, xListWasEmpty=<optimized out>) at /path/to/folder/esp-idf-v2.0/components/freertos/./timers.c:487
  8    process 7         0x4008458f in xQueueGenericReceive (xQueue=0x3ffddb58, pvBuffer=0xa, xTicksToWait=2148929590, xJustPeeking=0) at /path/to/folder/esp-idf-v2.0/components/freertos/./queue.c:1594
  7    process 6         0x4008458f in xQueueGenericReceive (xQueue=0x3ffc6764 <mbox>, pvBuffer=0x3ffb7e70, xTicksToWait=2148480633, xJustPeeking=0) at /path/to/folder/esp-idf-v2.0/components/freertos/./queue.c:1594
  6    process 5         0x40085288 in vTaskDelay (xTicksToDelay=<optimized out>) at /path/to/folder/esp-idf-v2.0/components/freertos/./tasks.c:1412
  5    process 4         0x400d1ca8 in esp_vApplicationIdleHook () at /path/to/folder/esp-idf-v2.0/components/esp32/./freertos_hooks.c:52
  4    process 3         0x400d1ca8 in esp_vApplicationIdleHook () at /path/to/folder/esp-idf-v2.0/components/esp32/./freertos_hooks.c:52
  3    process 2         0x4010a64e in app_main () at /path/to/folder/workspace/cp25g1/main/./main.c:149
  2    process 1         0x4008565d in xTaskResumeAll () at /path/to/folder/esp-idf-v2.0/components/freertos/./tasks.c:2193
* 1    <main task>       0x401704b0 in rcUpdateRxDone ()
The ESP constantly resets after this, and it doesn't produce a core dump. I erased the flash and uploaded the code with the BLE code commented out. OTA worked just fine. I then recompiled the code with the BLE enabled, ran the OTA. It downloads all of the code to the ESP32, but then fails at the end with

Code: Select all

I (38923) ota: Have written image length 1048367
E (62473) ota: Error: esp_ota_write failed! err=104
E (62473) ota: Exiting task due to fatal error...
Is the image to big with the BLE code? If so, is there an easy way to reduce the size of the BLE code?

gregstewart90
Posts: 59
Joined: Thu Jan 19, 2017 5:17 pm

Re: OTA fails when BLE is enabled

Postby gregstewart90 » Wed May 03, 2017 10:32 pm

I think my problem is the size of the code when I'm using bluetooth. When I just compile the bluetooth code with everything else commented out (basically the example code from the idf), the size is 872224. When I compile my project without the bluetooth code the size is 591472. Compiling my project with the bluetooth code enabled, the size is 1123616.

Is there anyway to make the bluetooth code compile to a smaller image? Just the simple gatt_server example is bigger than my entire project (which is quite large).

Ideas???

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: OTA fails when BLE is enabled

Postby WiFive » Thu May 04, 2017 3:11 am

Yes there are kconfig options to reduce BT code and ram size. But also did you make the ota partitions bigger?

gregstewart90
Posts: 59
Joined: Thu Jan 19, 2017 5:17 pm

Re: OTA fails when BLE is enabled

Postby gregstewart90 » Thu May 04, 2017 8:46 pm

Thank you. I updated the IDF, and make menuconfig gave me the options to disable the gatt client. It cut down the code enough for OTA to work.

THANKS!

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: OTA fails when BLE is enabled

Postby ESP_Angus » Fri May 05, 2017 1:52 am

If you eventually find you can't shrink your code size below 1MB, the other option is to edit the partition table to make the app partitions bigger. 1MB is the default, but they can be larger.

Relevant docs: http://esp-idf.readthedocs.io/en/latest ... ables.html

burkulesomesh43
Posts: 132
Joined: Tue Aug 14, 2018 6:21 am
Location: India

Re: OTA fails when BLE is enabled

Postby burkulesomesh43 » Fri Aug 31, 2018 6:54 am

Hi,
I want to ask you that if many tasks are running in my esp32. and if I start my ota task in between them then is there a possibility to crash the firmware?? or esp32 gives only priority to ota update of firmware??
--
Somesh Burkule

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: OTA fails when BLE is enabled

Postby fly135 » Fri Aug 31, 2018 2:29 pm

burkulesomesh43 wrote:Hi,
I want to ask you that if many tasks are running in my esp32. and if I start my ota task in between them then is there a possibility to crash the firmware?? or esp32 gives only priority to ota update of firmware??
I have a bunch of user created tasks (~10) running in my app when performing OTA, and have no problems. I also get the WD timeout. When OTA erases the flash it holds the cpu and trips that warning. I don't think it matters what priority you run OTA, it won't task switch while erasing.

John A

burkulesomesh43
Posts: 132
Joined: Tue Aug 14, 2018 6:21 am
Location: India

Re: OTA fails when BLE is enabled

Postby burkulesomesh43 » Sat Sep 01, 2018 5:52 am

fly135 wrote:
burkulesomesh43 wrote:Hi,
I want to ask you that if many tasks are running in my esp32. and if I start my ota task in between them then is there a possibility to crash the firmware?? or esp32 gives only priority to ota update of firmware??
I have a bunch of user created tasks (~10) running in my app when performing OTA, and have no problems. I also get the WD timeout. When OTA erases the flash it holds the cpu and trips that warning. I don't think it matters what priority you run OTA, it won't task switch while erasing.

John A
Ok thank you.
--
Somesh Burkule

Who is online

Users browsing this forum: Bing [Bot] and 150 guests