espressif / arduino-esp32

Arduino core for the ESP32
GNU Lesser General Public License v2.1
13.57k stars 7.4k forks source link

ESP32 with Matrix, IR and BLE: Guru Meditation Error #2520

Closed StevenCellist closed 5 years ago

StevenCellist commented 5 years ago

Hardware:

Board: ESP32 Dev Module Core Installation/update date: most recent IDE name: Arduino IDE Flash Frequency: 80Mhz PSRAM enabled: no Upload Speed: 115200 Computer OS: Windows 10

Description:

I want to add BLE to my ESP32. If a device connects, a variable is changed so that the matrix displays certain texts etc. But once I added the BLE coding, my ESP went on a Guru Meditation Error, because Core 1 panic'ed. I removed all excess coding but still it won't work. Only once I comment out the BLE descriptors in the void setup(), it runs. How can I change my code so it won't crash?

Sketch:


#include <Adafruit_GFX.h>   // Core graphics library
#include <P3RGB64x32MatrixPanel.h>
#include <IRremote.h> //this is a special one for ESP32, it won't work with Arduino
#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>

P3RGB64x32MatrixPanel matrix;

#define receiver 34
IRrecv irrecv(receiver);
decode_results results;

int var = 0;

#define SERVICE_UUID        "4fafc201-1fb5-459e-8fcc-c5c9c331914b"
#define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8"
BLEServer* pServer = NULL;
BLECharacteristic* pCharacteristic = NULL;
bool deviceConnected = false;

void setup() 
{
  Serial.begin(115200);
  matrix.begin();

  irrecv.enableIRIn();
  matrix.println();

  delay(100);

  BLEDevice::init("ESP32");
  pServer = BLEDevice::createServer();
  //pServer->setCallbacks(new MyServerCallbacks());
  BLEService *pService = pServer->createService(SERVICE_UUID);
  pCharacteristic = pService->createCharacteristic(
                      CHARACTERISTIC_UUID,
                      BLECharacteristic::PROPERTY_READ   |
                      BLECharacteristic::PROPERTY_WRITE  
                    );
  pCharacteristic->setValue("");
  pService->start();
  BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
  pAdvertising->addServiceUUID(SERVICE_UUID);
  pAdvertising->setScanResponse(false);
  pAdvertising->setMinPreferred(0x0);  // set value to 0x00 to not advertise this parameter
  BLEDevice::startAdvertising();
  Serial.println("Waiting a client connection to notify...");
}//setup

void loop() 
{
    if (irrecv.decode(&results)) 
    {
        translateIR(); 
        irrecv.resume(); 
    }//if

    if (deviceConnected) {
        var = 1;
    }
    delay(200);
}//loop

void translateIR() 
{    
    switch(results.value)
    {      
        case 0xFF10EF:  
            Serial.println(" 4              ");
            matrix.fillScreen(matrix.color444(0,0,0));
            if(var==0) {
              matrix.setCursor(0,0);
              matrix.print("Disconnected");
            }
            if(var==1) {
              matrix.drawRect(15, 0, 47, 31, matrix.color444(15,15,15));
            }
        break;
    }//switch
    delay(200);
}//translateIR

Debug Messages:

Rebooting...
Guru Meditation Error: Core  1 panic'ed (Interrupt wdt timeout on CPU1)
Core 1 register dump:
PC      : 0x4008112e  PS      : 0x00060034  A0      : 0x800811f6  A1      : 0x3ffbea30  
A2      : 0x3ffc4e50  A3      : 0x00020000  A4      : 0x00000017  A5      : 0x3ffba438  
A6      : 0x3ffc4eac  A7      : 0x3ffc4eac  A8      : 0x0000000b  A9      : 0x00000280  
A10     : 0x3ff44004  A11     : 0x00000005  A12     : 0x00000000  A13     : 0x00000000  
A14     : 0x00000046  A15     : 0x00000040  SAR     : 0x00000009  EXCCAUSE: 0x00000006  
EXCVADDR: 0x00000000  LBEG    : 0x40081086  LEND    : 0x40081141  LCOUNT  : 0x0000001d  
Core 1 was running in ISR context:
EPC1    : 0x4000bff0  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x4008112e

Backtrace: 0x4008112e:0x3ffbea30 0x400811f3:0x3ffbea60 0x40081611:0x3ffbea90 0x40081a9d:0x3ffbeab0 0x4000bfed:0x00000000

Core 0 register dump:
PC      : 0x40082cd9  PS      : 0x00060c34  A0      : 0x800840fa  A1      : 0x3ffb9d80  
A2      : 0x00000000  A3      : 0x00000000  A4      : 0x3ffb7dbc  A5      : 0x00000000  
A6      : 0x00000000  A7      : 0x00000002  A8      : 0x00000000  A9      : 0x00000001  
A10     : 0x00000000  A11     : 0x130003e8  A12     : 0x00000000  A13     : 0x00000001  
A14     : 0x00060c20  A15     : 0x00000000  SAR     : 0x00000000  EXCCAUSE: 0x00000006  
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  

Backtrace: 0x40082cd9:0x3ffb9d80 0x400840f7:0x3ffb9da0 0x40093099:0x3ffb9dc0
chegewara commented 5 years ago

https://github.com/me-no-dev/EspExceptionDecoder

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

This stale issue has been automatically closed. Thank you for your contributions.