Serial port code exception on Devkitc rev. 1

plantgrower
Posts: 1
Joined: Tue Jul 18, 2017 10:06 am

Serial port code exception on Devkitc rev. 1

Postby plantgrower » Tue Jul 18, 2017 10:39 am

I am trying to get a Cozir CO2 sensor running on the Esp32 (a Devkitc board Rev. 1 silicon). I have previously got this working on a Leonardo using a hardware serial port after I had modified the library to allow using a hardware serial, as it usually uses softwareserial. The library I modified is this one.
https://github.com/RobTillaart/Arduino/ ... ries/Cozir
With the following sketch the code throws an exception after "Setup" is printed. I am new to the ESP32 and I am not sure the best way to use a serial port. What are the default pins Arduino uses for serial ports ?

Code: Select all

#include <cozir.h>

HardwareSerial Serial2(2);

COZIR czr(Serial2);

void setup() {
  Serial.begin(115200);
  Serial.println("Setup");
}

void loop() {

  float temp = czr.Celsius();
  float hum = czr.Humidity();
  float co2 = czr.CO2();
  
  Serial.print("t = ");
  Serial.print(temp);
  Serial.print(" ");

  Serial.print("h = ");
  Serial.print(hum);
  Serial.print(" ");

  Serial.print("CO2 = ");
  Serial.println(co2);
  delay(200);

}

Code: Select all

⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0008,len:8
load:0x3fff0010,len:160
load:0x40078000,len:10632
load:0x40080000,len:252
entry 0x40080034
Setup
Guru Meditation Error of type StoreProhibited occurred on core  1. Exception was unhandled.
Register dump:
PC      : 0x400dee6e  PS      : 0x00060530  A0      : 0x800d0a08  A1      : 0x3ffc78f0  
A2      : 0xa1bf0608  A3      : 0x00000000  A4      : 0x00000038  A5      : 0x00000000  
A6      : 0x25c203f8  A7      : 0x00000037  A8      : 0x8c3851a1  A9      : 0x3ffc7900  
A10     : 0x3ffc7900  A11     : 0x3f400ead  A12     : 0x00000001  A13     : 0x0000ff00  
A14     : 0x00ff0000  A15     : 0xff000000  SAR     : 0x0000001d  EXCCAUSE: 0x0000001d  
EXCVADDR: 0xa1bf0608  LBEG    : 0x4000c349  LEND    : 0x4000c36b  LCOUNT  : 0xffffffff  

Backtrace: 0x400dee6e:0x3ffc78f0 0x400d0a08:0x3ffc7910 0x400d06f8:0x3ffc7930 0x400d074a:0x3ffc7950 0x400d07e3:0x3ffc7970 0x400d0646:0x3ffc7990 0x400db624:0x3ffc79c0

CPU halted.

Who is online

Users browsing this forum: No registered users and 134 guests