ESP32 & Weather board

Hi

I have the weather Micromod board with the ESP32 processor board. All working OK except for the lightning.powerDown(); command. If I use this, the processor panics with the below :-

ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, 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:0x3fff0030,len:1344
load:0x40078000,len:13924
ho 0 tail 12 room 4
load:0x40080400,len:3600
entry 0x400805f0
SD initialization done.
SD Card Type: SDSC
SD Card Size: 1886MB
File opened
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x400d30f8  PS      : 0x00060a30  A0      : 0x800d4862  A1      : 0x3ffb21b0  
A2      : 0x00000000  A3      : 0x000f4240  A4      : 0xffffffff  A5      : 0x0000ff00  
A6      : 0x00ff0000  A7      : 0xff000000  A8      : 0x800d4d90  A9      : 0x3ffb21a0  
A10     : 0x3ffbdbf8  A11     : 0x3f403871  A12     : 0x00000002  A13     : 0xffffffff  
A14     : 0x3ffb833c  A15     : 0x00000000  SAR     : 0x00000020  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x0000001c  LBEG    : 0x40087525  LEND    : 0x40087535  LCOUNT  : 0xfffffffd  


Backtrace: 0x400d30f5:0x3ffb21b0 0x400d485f:0x3ffb21e0 0x400d48fe:0x3ffb2200 0x400d4981:0x3ffb2220 0x400d1aa8:0x3ffb2240 0x400d779a:0x3ffb2290




ELF file SHA256: 297f2010606eb043

Rebooting...

The code that causes this is the following, it never gets to the “Got Here!” line :-

#include "RTClib.h"  //Adafruit PCF8523 RTC
#include "FS.h"
#include <SPI.h>
#include <SD.h>
#include "SparkFunBME280.h"                     //Temp/Humid sensor
#include "SparkFun_AS3935.h"                    //Lightening detector to powerdown to save battery
#include <SparkFun_VEML6075_Arduino_Library.h>  //UV Detector

File myFile;
BME280 aht;
SparkFun_AS3935 lightning;
VEML6075 uv;
RTC_PCF8523 rtc;


const int chipSelect = 5;

String tem = "";

void setup() {
  Serial.begin(115200);
  while (!Serial) {}

  if (!SD.begin(chipSelect)) {
    Serial.println("SD initialization failed!");
    while (1)
      ;
  }

  uint8_t cardType = SD.cardType();

  Serial.println("SD initialization done.");

  Serial.print("SD Card Type: ");
  if (cardType == CARD_MMC) {
    Serial.println("MMC");
  } else if (cardType == CARD_SD) {
    Serial.println("SDSC");
  } else if (cardType == CARD_SDHC) {
    Serial.println("SDHC");
  } else {
    Serial.println("UNKNOWN");
  }

  uint64_t cardSize = SD.cardSize() / (1024 * 1024);
  Serial.printf("SD Card Size: %lluMB\n", cardSize);

  if (SD.exists("/Humid.csv")) {
    SD.remove("/Humid.csv");
    Serial.println("Deleted Humid.csv");
  }

  myFile = SD.open("/Humid.csv", FILE_WRITE);

  if (!myFile) {
    Serial.println("Problem opening file, stopping");
    while (1)
      ;
  }

  Serial.println("File opened");

   lightning.powerDown();  //Make sure detector powered down
   Serial.println("Got Here!");

The reason I want to turn it off is that I won’t be using it within the program so want to save power use.

Any ideas?

Steve Gray

My only guess is that the original library and the MM Weather pin mapping are arguing about SPI or CS…the schematics are very similar, except the MM version has SI tied to GND https://cdn.sparkfun.com/assets/6/c/2/e … ematic.pdf and the standalone board https://cdn.sparkfun.com/assets/2/0/7/d … or-v20.pdf does not…perhaps un-tying that to GND will behave more appropriately? It’s a little weird :-/

That being said, if you’re sure you’ll never use the lightning detector you could just cut the power traces or de-solder the IC, and then just delete/comment-out the references to it in your code.

Also be sure to sever the jumper traces for all of the LEDs for more power savings if you haven’t already

OK, thanks. If I don’t use the lightning chip will it be in sleep mode anyway?

Bipman