esp8266 / Arduino

ESP8266 core for Arduino
GNU Lesser General Public License v2.1
16.01k stars 13.33k forks source link

Support for ESP8266 - Lolin D1 Mini v4.0.0 #8437

Closed 877dev closed 2 years ago

877dev commented 2 years ago

Basic Infos

Platform

Settings in IDE

image

Problem Description

I tried to swap a Wemos / Lolin D1 mini v3.1.0 out on one of my projects, and replace with the newer v4.0.0 which has USB C and I2C connector. Flashed same code and it did not work, was getting watchdog resets ( I now think due to the while loops when I2C sensors were not found).

So back to basics:

Tried Blink sketch - worked. Tried Lolin buzzer shield - worked. Tried Lolin DHT shield - does not work (I2C). Tried Lolin TFT screen shield - does not work (SPI I think).

Tried I2C scanner sketch as per below, no devices found. When flashing to v3.1.0 Lolin it finds the device immediately.

Not sure what the problem is...

MCVE Sketch


/*
 * Wire - I2C Scanner
 *
 * The WeMos D1 Mini I2C bus uses pins:
 * D1 = SCL
 * D2 = SDA
 */

#include <Wire.h>

const int sclPin = D1;
const int sdaPin = D2;

void setup()
{
  Wire.begin(sdaPin, sclPin);

  Serial.begin(74800);
  Serial.println("I2C Scanner");
}

void loop()
{
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for (address = 1; address < 127; address++)
  {
    // The i2c scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address < 16) {
        Serial.print("0");
      }
      Serial.print(address, HEX);
      Serial.println(" !");

      nDevices++;
    }
    else if (error == 4)
    {
      Serial.print("Unknown error at address 0x");
      if (address < 16) {
        Serial.print("0");
      }
      Serial.println(address, HEX);
    }
  }
  if (nDevices == 0) {
    Serial.println("No I2C devices found\n");
  }
  else {
    Serial.println("Done.\n");
  }

  delay(2000);
}

Debug Messages

No debug errors I saw, it compiles and flashes ok, just does not work. I am happy to produce debugs if told how.

877dev commented 2 years ago

Found the issue, it was a hardware fault of my own making. Working fine now...lesson learned.