Problem with OTA using attachinterrupt

Hardware: Esp32 Devkitv1 + WiFi
Blynk Server Region: NY3
Blynk Library version: 1.3.2

Hello, Blynkers.

I´m facing problems with OTA since I implemented external interrupt in my code.
All funcions is ok and data is flowing to Blynk perfectly. Just the firmware update is returning error.

Anyone already passed through this?

Bellow is debug messages from serial monitor.

Every attempt of firmware download return error until reach maximum attempts and stop the shipment at the server.

17:00:49.274 ->     ___  __          __
17:00:49.274 ->    / _ )/ /_ _____  / /__
17:00:49.274 ->   / _  / / // / _ \/  '_/
17:00:49.274 ->  /____/_/\_, /_//_/_/\_\
17:00:49.274 ->         /___/ v1.3.2 on ESP32
17:00:49.274 -> 
17:00:49.274 ->  #StandWithUkraine    https://bit.ly/swua
17:00:49.274 -> 
17:00:49.274 -> 
17:00:49.274 -> ----------------------------------------------------
17:00:49.274 ->  Device:    Blynk Hidrometro-UYA7
17:00:49.274 ->  Firmware:  0.3.0 (build Feb 21 2024 14:21:31)
17:00:49.274 ->  Token:     gQcf - •••• - •••• - ••••
17:00:49.274 ->  Platform:  ESP32 @ 240MHz
17:00:49.274 ->  Chip rev:  1
17:00:49.321 ->  SDK:       v4.4.6-dirty
17:00:49.321 ->  Flash:     4096K
17:00:49.321 ->  Free mem:  249300
17:00:49.321 -> ----------------------------------------------------
17:00:49.321 -> 
17:00:49.321 -> >[267] INIT => CONNECTING_NET
17:00:49.321 -> [267] Connecting to WiFi: LucaeLuma
17:00:49.982 -> [953] Using Dynamic IP: 192.168.0.20
17:00:49.982 -> [953] CONNECTING_NET => CONNECTING_CLOUD
17:00:49.982 -> [964] Connecting to blynk.cloud:443
17:00:51.104 -> [2065] Certificate OK
17:00:51.290 -> [2267] Ready (ping: 200ms).
17:00:52.974 -> [3920] CONNECTING_CLOUD => RUNNING
17:00:53.535 -> [4483] Disconnected
17:00:53.535 -> [4484] RUNNING => OTA_UPGRADE
17:00:53.535 -> [4484] Firmware update URL: http://ny3.blynk.cloud/static/fw_4273093479089423345_-838595071.bin?token=axgxdXvHbzVKnWlCjTpTNmP_nttSaib8
17:00:53.723 -> [4666] HTTP response should be 200
17:00:53.723 -> [4666] OTA_UPGRADE => ERROR
````
Thanks in advance.

Have you tried adding a noInterrupts() command at the beginning of your OTA code, and if necessary an interrupts() in the branch of the code that’s executed if OTA fails?

Pete.

Hey, Pete.
Thanks for the reply.
I followed your idea but with no success.
Then, I remembered that couple weeks ago I updated the esp32 Arduino Core to v2.0.14.
I tried a rollback to v2.0.6 and now I can run firmware update through OTA again.
Seems to be a problem of compatibility of esp32 core newer versions and nothing to do with interrupts.
:slight_smile:

I’ve just done a test with the standard ESP32 Edgent example and version 2.0.14 and it works perfectly…

05:03:09.323 -> [226984] Disconnected
05:03:09.323 -> [226984] RUNNING => OTA_UPGRADE
05:03:09.323 -> [226984] Firmware update URL: http://lon1.blynk.cloud/static/fw_13689972180156911003_-838595071.bin?token=KHuOtZBLJTPilfgXTnKzf4KtSPNBrnWi
05:03:09.393 -> [227037] Expected MD5: 1d8935a3763a3c21a4f0da21c8e387ed
05:03:16.815 -> [234485] === Update successfully completed. Rebooting.
05:03:16.918 -> ets Jun  8 2016 00:22:57

The issue must be with some change that you’ve made to the code that’s incompatible with the latest 2.0.x version of the ESP32 core.

Pete.

Pete.
I tested other template I have here and same issue when I compile with v2.0.14.
Even when not using attachinterrupt.
What is strange is that the error appers to occour in the http response of firmaware update url call.

[4484] Firmware update URL: http://ny3.blynk.cloud/static/fw_4273093479089423345_-838595071.bin?token=axgxdXvHbzVKnWlCjTpTNmP_nttSaib8
[4666] HTTP response should be 200
[4666] OTA_UPGRADE => ERROR

Compiling with v1.0.6 I can run updates smoothly.

It’s nothing to do with the template, it the code you’re uploading.
Do what I did and take the standard Blynk Edgent ESP32 template, add in the two line of template ID and name, compile and upload via USB, provision teg device then do a Blynk.Air update.

Pete.

Hey, Pete.

I did what you recommended now.
Updated esp32 arduino core to v2.0.14 and uploaded Egent example with template id and name to my esp32.
Compiled new Edgent example with new version number and send a new shipment.
Got same error.

11:19:20.169 -> [246] 
11:19:20.169 ->     ___  __          __
11:19:20.169 ->    / _ )/ /_ _____  / /__
11:19:20.169 ->   / _  / / // / _ \/  '_/
11:19:20.169 ->  /____/_/\_, /_//_/_/\_\
11:19:20.217 ->         /___/ v1.3.2 on ESP32
11:19:20.217 -> 
11:19:20.217 ->  #StandWithUkraine    https://bit.ly/swua
11:19:20.217 -> 
11:19:20.217 -> 
11:19:20.217 -> ----------------------------------------------------
11:19:20.217 ->  Device:    Blynk Level Meter-UYA7
11:19:20.217 ->  Firmware:  0.1.5 (build Feb 22 2024 11:04:12)
11:19:20.217 ->  Token:     gQcf - •••• - •••• - ••••
11:19:20.217 ->  Platform:  ESP32 @ 240MHz
11:19:20.217 ->  Chip rev:  1
11:19:20.217 ->  SDK:       v4.4.6-dirty
11:19:20.217 ->  Flash:     4096K
11:19:20.217 ->  Free mem:  251632
11:19:20.217 -> ----------------------------------------------------
11:19:20.217 -> 
11:19:20.217 -> >[288] INIT => CONNECTING_NET
11:19:20.217 -> [288] Connecting to WiFi: LucaeLuma
11:19:21.904 -> [1983] Using Dynamic IP: 192.168.0.20
11:19:21.904 -> [1983] CONNECTING_NET => CONNECTING_CLOUD
11:19:21.951 -> [1993] Connecting to blynk.cloud:443
11:19:23.221 -> [3300] Certificate OK
11:19:23.453 -> [3513] Ready (ping: 211ms).
11:19:23.500 -> [3581] CONNECTING_CLOUD => RUNNING
11:19:25.748 -> [5813] Disconnected
11:19:25.748 -> [5814] RUNNING => OTA_UPGRADE
11:19:25.748 -> [5814] Firmware update URL: http://ny3.blynk.cloud/static/fw_6340442205449863548_-838595071.bin?token=cJWx-0QJ36CSZAJBEqn58E5P_MLknn0P
11:19:25.933 -> [5984] HTTP response should be 200
11:19:25.933 -> [5984] OTA_UPGRADE => ERROR

I´m using NY3 server. And you?

Att.

Pete.