thank you for this great project! Currentyl I'm just playing around with some sensors with my ESP32. I'm pretty new to microcontrollers.
I just got a SSD1306 working with espruino on my ESP32, it works flawless. Yesterday I had to connect a DHT22 and my ESP32 keeps crashing after a few measurements of the temp. This code isn't that spectacular, but I really don't know why its crashing. I always get that message:
WARNING: jshI2CSetup: driver installed, sda: 21 sdl: 22 freq: 50000,
=undefined
Booting up...
Temp: 22.1°C | RH: 40%
Temp: 22.1°C | RH: 39.7%
abort() was called at PC 0x4008280b on core 0
Backtrace: 0x40087818:0x3ffb04a0 0x40087917:0x3ffb04c0 0x4008280b:0x3ffb04e0 0x400828f9:0x3ffb0510 0x400d3256:0x3ffb0530 0x400829d4:0x3ffb0550 0x40116595:0x3ffb0570 0x40082c9e:0x3ffb0590 0x40082b78:0x3ffb05c0 0x40082c73:0x3ffb05e0 0x40081711:0x3ffb0600
================= CORE DUMP START =================
After the core dump I see:
E (29281) esp_core_dump: Skipped 1 tasks with bad TCB!
E (29326) esp_core_dump: Crashed task has been skipped!
Rebooting...
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_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:1932
ho 0 tail 12 room 4
load:0x40078000,len:10012
load:0x40080000,len:252
entry 0x40080034
It doesn't matter how often I read the DHT. It crashes after two measurements and after none.
The DHT is connected to GPIO15 with a pullup resistor (10k). It keeps crashing even without WiFi and a webserver. You can see my wiring (without the oled) attached.
My code:
I2C1.setup({scl:D22,sda:D21});
var g = require("SSD1306").connect(I2C1, start,{
contrast: 255
});
require("FontDennis8").add(Graphics);
g.setFontDennis8();
function start(){
log("Booting up...");
var ssid = "SSID";
var pw = "PW";
readTemp(D15);
if(connectWifi(ssid, pw)){
if(startWebserver(8080)){
log("Let's get started!");
}
}
}
function connectWifi(ssid, password){
var wifi = require('Wifi');
//wifi.setHostname("Disane_ESP32");
var ip = wifi.getIP().ip;
if(ip != "0.0.0.0" && ip){
log("IP: "+ip);
return true;
}else{
wifi.connect(ssid, {password: password}, function(err) {
if (err) {
log("Connection error: "+err);
return false;
}
log('Connected to Wifi: '+ ip);
//wifi.save(); // Next reboot will auto-connect
return true;
});
}
}
function startWebserver(port){
log("Starting Webserver...");
var http = require("http");
http.createServer(function (req, res) {
res.writeHead(200);
res.end("Hello World");
}).listen(port);
return true;
}
function readTemp(pin){
//log("Reading temp and RH");
//pinMode(D15, input_pullup);
var dht = require("DHT22").connect(pin);
setInterval(function(){
dht.read(function (a) {
if(a.err){
log("Error | checksumError: "+a.checksumError);
}else{
log("Temp: "+a.temp.toFixed(2).toString()+"°C | RH: "+a.rh.toFixed(2).toString()+"%", 8);
}
});
},5*1000);
}
function log(text, fs = 5){
g.clear();
console.log("["+Date.now() +"]: " +text);
//g.setFontVector(fs);
g.drawString(text,2,2);
// write to the screen
g.flip();
}
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hey guys,
thank you for this great project! Currentyl I'm just playing around with some sensors with my ESP32. I'm pretty new to microcontrollers.
I just got a SSD1306 working with espruino on my ESP32, it works flawless. Yesterday I had to connect a DHT22 and my ESP32 keeps crashing after a few measurements of the temp. This code isn't that spectacular, but I really don't know why its crashing. I always get that message:
After the core dump I see:
It doesn't matter how often I read the DHT. It crashes after two measurements and after none.
The DHT is connected to GPIO15 with a pullup resistor (10k). It keeps crashing even without WiFi and a webserver. You can see my wiring (without the oled) attached.
My code:
Does anybody of you have a clue?
1 Attachment