TTGO LoRa32-OLED V1 not working with Blynk

I’m using the above TTGO board which has build in LoRa and ESP32
It works all fine when using LoRa radio alone and even WiFi together its all fine BUT when I compile with Blynk it continually crashes…logs below might provide a clue to experts; any help would be great :wink:


Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, 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:928
ho 0 tail 12 room 4
load:0x40078000,len:8424
ho 0 tail 12 room 4
load:0x40080400,len:5868
entry 0x4008069c
 ....Waiting to connect to Wifi:
..WL_CONNECTED = 3
WiFi status = 3
WiFi connected
IP address: 
192.168.0.51
 
[1183] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on ESP32

[1192] Connecting to blynk.-----.com:80
[1235] <[1D|00|01|00] xxxxxxxxx
[1264] >[00|00|01|00|C8]
[1264] Ready (ping: 28ms).
[1331] <[11|00|02|00]Fver[00]0.6.1[00]h-beat[00]10[00]buff-in[00]1024[00]dev[00]ESP32[00]build[00]Aug  2 2019 15:02:58[00]
Blynk connected !
LoRa init succeeded.

LoRa Simple Gateway
Only receive messages from nodes
Tx: invertIQ enable
Rx: invertIQ disable

0 : RECEIVED FROM: relay1 => Guru Meditation Error: Core  1 panic'ed (Interrupt wdt timeout on CPU1)
Core 1 register dump:
PC      : 0x4008bc92  PS      : 0x00060334  A0      : 0x8008addb  A1      : 0x3ffbdf50  
A2      : 0x3ffc81f0  A3      : 0x3ffb8074  A4      : 0x00000001  A5      : 0x00000001  
A6      : 0x00060323  A7      : 0x00000000  A8      : 0x3ffb8074  A9      : 0x3ffb8074  
A10     : 0x00000018  A11     : 0x00000018  A12     : 0x00000001  A13     : 0x00000001  
A14     : 0x00060321  A15     : 0x00000000  SAR     : 0x00000019  EXCCAUSE: 0x00000006  
EXCVADDR: 0x00000000  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff  
Core 1 was running in ISR context:
EPC1    : 0x401030d8  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x4008bc92

Backtrace: 0x4008bc92:0x3ffbdf50 0x4008add8:0x3ffbdf70 0x40089863:0x3ffbdf90 0x40103055:0x3ffbdfd0 0x400f1e8f:0x3ffbdff0 0x4010358d:0x3ffbe020 0x401039ed:0x3ffbe040 0x400f0cd6:0x3ffbe080 0x400f1791:0x3ffbe100 0x400f180e:0x3ffbe130 0x400d3586:0x3ffbe150 0x400d35f1:0x3ffbe170 0x400d36b5:0x3ffbe190 0x4013fd5a:0x3ffbe1b0 0x400d49e9:0x3ffbe1e0 0x400d4a15:0x3ffbe200 0x400d1f63:0x3ffbe220 0x400d25d7:0x3ffbe280 0x400d2818:0x3ffbe2b0 0x400d29d1:0x3ffbe2f0 0x400d2b7b:0x3ffbe730 0x400d312f:0x3ffbe760 0x400d313a:0x3ffbe780 0x40081355:0x3ffbe7a0 0x40081b59:0x3ffbe7c0 0x40083870:0x3ffb1ef0 0x400835df:0x3ffb1f10 0x4008162f:0x3ffb1f30 0x400d1b2f:0x3ffb1f50 0x400d1b55:0x3ffb1f70 0x400d613d:0x3ffb1fb0 0x40088b49:0x3ffb1fd0

Core 0 register dump:
PC      : 0x4008a25a  PS      : 0x00060634  A0      : 0x8008b439  A1      : 0x3ffb3d20  
A2      : 0x3ffbeca0  A3      : 0x0000cdcd  A4      : 0xb33fffff  A5      : 0x00000001  
A6      : 0x00060623  A7      : 0x0000abab  A8      : 0x0000abab  A9      : 0x3ffbe140  
A10     : 0x00000003  A11     : 0x00060023  A12     : 0x00060021  A13     : 0x00000000  
A14     : 0x00000000  A15     : 0x00000000  SAR     : 0x00000019  EXCCAUSE: 0x00000006  
EXCVADDR: 0x00000000  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff  

Backtrace: 0x4008a25a:0x3ffb3d20 0x4008b436:0x3ffb3d50 0x400897c3:0x3ffb3d70 0x40102f7e:0x3ffb3db0 0x4010325a:0x3ffb3dd0 0x40104ea7:0x3ffb3df0 0x400f1ce9:0x3ffb3e10 0x40088b49:0x3ffb3e40

Rebooting...
ets Jun  8 2016 00:22:57

1 Like

For what its worth I narrowed down the issue. I.e. the TTGO used DIO0 pin (as optional), it is only needed for receive callback mode. If DIO0 pin is used, it must be interrupt capable via attachInterrupt(...) . [ref: https://github.com/sandeepmistry/arduino-LoRa]

If I use this interrupt to conflicts with Blynk and I get the crash as per the serial output in previous post — would anyone know why ?

Workaround is not use this interrupt call back function in LoRa library.

Hi, Mars. I have exactly the same problem but I don’t know how to apply the workaround you refer. Can you please give more details on where have touch to solve the problem?

what i did is stop using in setup() the following below function call i.e. do not setup automatic callback of onRecieve as this creates a panic conflict interrupt with Blynk :frowning: hopefully Blynk V2 fixes this ?

  LoRa.onReceive(onReceive);  // THIS DOES NOT WORK WHEN USING BLYNK as well

instead in your loop() function call the function directly using another function call, e.g. I created a function called check_onReceive() and in loop() I call it as per below:

void loop()
{
// all your other code
 check_onReceive();
}

My check_onReceive function is below… theres extra stuff here that I’m using for debugging but it will give you a good idea how it works:

void check_onReceive()
{
  static int relay1_counter, relay2_counter, relay3_counter, inner_counter;
  String message;

  int packetSize = LoRa.parsePacket();

  if (packetSize == 0)
    return; // if theres no pack, return
 
   if (packetSize > 10)  // want to ensure there is enough info the buffer before we process it
  {
    byte sender = LoRa.read();    // sender address
    byte recipient = LoRa.read(); // recipient address

    if (sender == localAddress1)
    {
      Serial.print(relay1_counter++);
      Serial.print(F(" : RECEIVED FROM: relay1 => "));
      relay1_received = true;
#ifdef blynkon
      Blynk.virtualWrite(V4, relay1_counter);
#endif
    }
    else if (sender == localAddress2)
    {
      Serial.print(relay2_counter++);
      Serial.print(F(" : RECEIVED FROM: relay2 => "));
      relay2_received = true;

#ifdef blynkon
      Blynk.virtualWrite(V5, relay2_counter);
#endif
    }
    else if (sender == localAddress3)
    {
      Serial.print(relay3_counter++);
      Serial.print(F(" : RECEIVED FROM: relay3 => "));
      relay3_received = true;

#ifdef blynkon
      Blynk.virtualWrite(V6, relay3_counter);
#endif
    }
    while (LoRa.available())
    {
      message += (char)LoRa.read();
    }

    const int MAX_DOC_SIZE = 2000;
    int msg_length = message.length();
    Serial.print(F("334 - Message length received = "));
    Serial.println(message.length());
    DynamicJsonDocument doc(1024); 

    if (msg_length * 2 > MAX_DOC_SIZE)
    {
      Serial.println(F("328 - ERROR: JSON message recieved too large !"));
    }
    else
    {
      DeserializationError error = deserializeMsgPack(doc, message);

      Serial.print(F("Zone = "));
      serializeJson(doc["z"], Serial);
    }

    Serial.print("  => Gateway Receive: ");
    serializeJson(doc, Serial);
    Serial.println(F(""));
  }
}
1 Like