ESP32 and DHT22 abort() crashes

Posted 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:

    WARNING: jshI2CSetup: driver installed, sda: 21 sdl: 22 freq: 50000,
    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!
    ets Jun 8 2016 00:22:57
    rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0x00
    mode:DIO, clock div:1
    ho 0 tail 12 room 4
    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:

    var g = require("SSD1306").connect(I2C1, start,{
      contrast: 255 
    function start(){
      log("Booting up...");
      var ssid = "SSID";
      var pw = "PW";
      if(connectWifi(ssid, pw)){
          log("Let's get started!"); 
    function connectWifi(ssid, password){
      var wifi = require('Wifi');
      var ip = wifi.getIP().ip;
      if(ip != "" && ip){
        log("IP: "+ip);
        return true;
        wifi.connect(ssid, {password: password}, function(err) {
          if (err) {
            log("Connection error: "+err);
            return false;
          log('Connected to Wifi: '+ ip);
          //; // Next reboot will auto-connect
          return true;
    function startWebserver(port){
      log("Starting Webserver...");
      var http = require("http");
      http.createServer(function (req, res) {
        res.end("Hello World");
      return true;
    function readTemp(pin){
      //log("Reading temp and RH");
      //pinMode(D15, input_pullup);
      var dht = require("DHT22").connect(pin);
      setInterval(function(){ (a) {
            log("Error | checksumError: "+a.checksumError);
            log("Temp: "+a.temp.toFixed(2).toString()+"°C | RH: "+a.rh.toFixed(2).toString()+"%", 8);
    function log(text, fs = 5){
      console.log("[" +"]: " +text);
      // write to the screen

    Does anybody of you have a clue?

    1 Attachment

    • ESP32_DHT22.png
  • Sorry, there is an issue with setwatch and that is probably what the DHT module is using.

    It has been raised on GitHub, however no one has sorted it out.

  • ^^ this - DHT11 and DHT22 definitely use setWatch (and also clearWatch)

  • You mean this issue on github?­ues/643

    Is there any ETA to fix this?

  • It's this one:­ues/1176

    setWatch works fine on ESP8266.

    I'm afraid there's no ETA. Nobody makes anything off the ESP8266 or ESP32 ports, so it's very much a free-time project by members of the Espruino community like @Wilberforce. It'll get fixed when they feel like it or have a need for it in one of their own projects :)

    If you need something where someone takes an active role in fixing issues then get an official Espruino board - they're a little more expensive, but that directly pays my salary so I can work full-time to make sure things get fixed in a timely manner :)

  • Ah okay :) Sorry! I guess I have to switch to another solution in the meanwhile. But that projects is very promising!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

ESP32 and DHT22 abort() crashes

Posted by Avatar for Disane87 @Disane87