arduino-LoRa icon indicating copy to clipboard operation
arduino-LoRa copied to clipboard

LoRa.end(); to detatch interupt ? Lora + ArduinoOTA , OTA update Sometime Crash

Open T1j3ff opened this issue 3 years ago • 0 comments

Had issue were OTA update would often crash

Sending invitation to 192.168.1.191 
Uploading: [                                                            ] 0% 
07:37:03 [ERROR]: Error Uploading
07:37:03 [ERROR]: Error Uploading

This begun happening after enabling interrupt with LoRa.onReceive() LoRa.onTxDone()

Serial trace on the ESP32:

07:37:02.769 -> Start updating sketch
07:37:02.769 -> Progress: 0%
07:37:02.769 -> Progress: 0%
07:37:02.769 -> Progress: 0%
07:37:02.769 -> Progress: 0%
07:37:02.816 -> Progress: 0%
07:37:02.863 -> 
07:37:02.863 -> assert failed: xQueueSemaphoreTake queue.c:1554 (!( ( xTaskGetSchedulerState() == ( ( BaseType_t ) 0 ) ) && ( xTicksToWait != 0 ) ))
07:37:02.863 -> 
07:37:02.863 -> 
07:37:02.863 -> Backtrace:0x40083739:0x3ffbedfc |<-CORRUPTED
07:37:02.863 -> 
07:37:02.863 -> 
07:37:02.863 -> 
07:37:02.863 -> 
07:37:02.863 -> ELF file SHA256: 0000000000000000
07:37:02.863 -> 
07:37:02.863 -> Rebooting...

I've resolved the issue with adding code to disable lora interrupts when starting an OTA update

.onStart([]() {
      LoRa.end(); //added to stop interrupts disrupting the OTA 
      detachInterrupt(digitalPinToInterrupt(2));  //added to stop interrupts disrupting the OTA  

Might not be the cleanest way to do it

Not a big deal on the Lora code itself But I would Have expected LoRa.end(); to detach the interrupt pin itself :)

T1j3ff avatar Aug 26 '22 11:08 T1j3ff