Using the new Arduino IDE for ESP8266 and found bugs, report them here

Moderator: igrr

User avatar
By Jean-Luc
#46302 Hello everyone,
I'm new to this site I am happy to use.
My problem, I try to use a Lolin ESP8266 to drive 5 x Funduino and I can not run the wire properly.
With another Arduino all is well and functioning properly.
Then I tried a utility to test the wire, and I get nothing constant.
The addresses are between 5 and 9

Code: Select all#include <Wire.h>

#define VERSION           "6.0"

#define MODE_WRITE_QUICK   true // Takes precedence over read-byte mode
#define MODE_READ_BYTE    false
#define SERIAL_BAUD_RATE   9600
#define REPEAT_DELAY       5000 // milliseconds

// By default use write-quick mode, but for these use read-byte mode
#define SCAN_ADDRESS_START       0x00
#define SCAN_ADDRESS_END         0x7F

#define I2C_RANGE_START          0x00
#define I2C_RANGE_END            0x7F
#define READ_HINT_RANGE_1_START  0x30
#define READ_HINT_RANGE_1_END    0x37
#define READ_HINT_RANGE_2_START  0x50
#define READ_HINT_RANGE_2_END    0x5f

uint8_t deviceStatus[128]; // global

#ifdef DEBUG_ESP_PORT
#define DEBUG_MSG(...) DEBUG_ESP_PORT.printf( __VA_ARGS__ )
#else
#define DEBUG_MSG(...)
#endif

void setup() {
  Serial.begin(SERIAL_BAUD_RATE);

  Serial.println();
  Serial.print("Arduino I2C Bus Scanner v");
  Serial.println(VERSION);

  if (MODE_READ_BYTE || !MODE_WRITE_QUICK) {
    Serial.println();
    Serial.println("Note: Read-byte mode on Arduino may block indefinitely");
    Serial.println("      if a device is not capable of that mode.");
  }

  Wire.begin(5, 4); // D1/D2
  Wire.setClock(400000);
}

void loop() {
  DEBUG_MSG("Start search...\n");
  Serial.println();
  Serial.println("Scanning: ");

  for(uint8_t addr = SCAN_ADDRESS_START; addr <= SCAN_ADDRESS_END; addr++ ) {
    // Address the device
    Wire.beginTransmission(addr);
    // Read-byte mode: Request one byte from the device
    if (!MODE_WRITE_QUICK) {
      if ((MODE_READ_BYTE) ||
          (addr >= READ_HINT_RANGE_1_START && addr <= READ_HINT_RANGE_1_END) ||
          (addr >= READ_HINT_RANGE_2_START && addr <= READ_HINT_RANGE_2_END))
      {
        uint8_t throwaway = Wire.requestFrom(addr, (uint8_t)1);
      }
    }

    // Check for ACK (detection of device), NACK or error
    deviceStatus[addr] = Wire.endTransmission();

    Serial.print(".");
  }
  Serial.println();

  displayResults();

  Serial.println();
  Serial.print("Pausing for ");
  Serial.print(REPEAT_DELAY/1000.0, 2);
  Serial.println(" seconds");
  DEBUG_MSG("End search...\n");

  delay(REPEAT_DELAY); // Pause between scans
}

void displayResults() {
  char textbuffer[128];
  char tmpstr[128];

  Serial.println();

  strcpy(textbuffer, "   ");

  for (int i = 0; i < 0x10; i++) {
    sprintf(tmpstr, " %2x", i);
    strcat(textbuffer, tmpstr);
  }

  Serial.println(textbuffer);

  textbuffer[0] = 0; // Clear the buffer

  // Aligning display output to 16 byte intervals via integer math
  for(uint8_t addr = (I2C_RANGE_START) / 0x10 * 0x10;
      addr < (I2C_RANGE_END+1) / 0x10 * 0x10;
      addr++) {
    if (!(addr % 0x10)) { // Start of a line
      sprintf(textbuffer, "%02x:", addr / 0x10);
    }

    if (addr < SCAN_ADDRESS_START || addr > SCAN_ADDRESS_END) {
      sprintf(tmpstr, " %02s", "  ");
    } else if (deviceStatus[addr] == 0) {
      sprintf(tmpstr, " %02x", addr);
    } else if (deviceStatus[addr] == 4) {
      sprintf(tmpstr, " %02s", "??");
    } else {
      sprintf(tmpstr, " %02s", "--");
    }

    strcat(textbuffer, tmpstr);

    if (!((addr+1) % 0x10) && textbuffer[0] != 0) {
      Serial.println(textbuffer);
      textbuffer[0] = 0;
    }
  }
}

And this is what I get.
Code: Select all
Arduino I2C Bus Scanner v6.0
Start search...

Scanning:
................................................................................................................................

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
01: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
02: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
03: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
04: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
05: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
06: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
07: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Pausing for 5.00 seconds
End search...
scandone
state: 0 -> 2 (b0)
Start search...

Scanning:
................................................................................................................................

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
01: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
02: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
03: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
04: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
05: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
06: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
07: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Pausing for 5.00 seconds
End search...
state: 2 -> 3 (0)
Start search...

Scanning:
................................................................................................................................

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- -- -- -- 05 06 -- -- -- -- -- -- -- -- --
01: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
02: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
03: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
04: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
05: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
06: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
07: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Pausing for 5.00 seconds
End search...
state: 3 -> 5 (10)
add 0
aid 3
cnt
Start search...

Scanning:
................................................................................................................................

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- -- -- -- 05 06 07 -- -- ?? -- -- -- -- --
01: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
02: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
03: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
04: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
05: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
06: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
07: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Pausing for 5.00 seconds
End search...
chg_B1:-40
Start search...

Scanning:
................................................................................................................................

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- -- -- -- 05 -- -- 08 09 -- -- -- -- -- --
01: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
02: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
03: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
04: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
05: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
06: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
07: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Pausing for 5.00 seconds
End search...

connected with WIFI_GEMI, channel 6
dhcp client start...
Start search...

Scanning:
................................................................................................................................

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- -- -- -- 05 06 07 08 -- ?? -- -- -- -- --
01: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
02: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
03: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
04: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
05: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
06: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
07: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Pausing for 5.00 seconds
End search...
ip:192.168.0.65,mask:255.255.255.0,gw:192.168.0.254
Start search...

Scanning:
................................................................................................................................

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- -- -- -- 05 06 07 08 09 -- ?? ?? ?? ?? ??
01: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
02: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
03: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
04: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
05: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
06: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
07: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??

Pausing for 5.00 seconds
End search...
Start search...

Scanning:
................................................................................................................................

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
01: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
02: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
03: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
04: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
05: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
06: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
07: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??

Pausing for 5.00 seconds
End search...
Start search...

Scanning:
................................................................................................................................

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
01: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
02: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
03: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
04: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
05: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
06: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
07: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??

Pausing for 5.00 seconds
End search...
Start search...

Scanning:
................................................................................................................................

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
01: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
02: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
03: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
04: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
05: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
06: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
07: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??

Pausing for 5.00 seconds
End search...
Start search...

Scanning:
................................................................................................................................

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
01: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
02: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
03: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
04: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
05: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
06: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
07: ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??

Pausing for 5.00 seconds
End search...
User avatar
By Jean-Luc
#46378 Hello,
I forgot to say that I have also used a 3.3V / 5V interface and no change, the wire does not work. A DS18B20 (OneWire) works fine with or without interface. I deduce that the problem comes from the library Wire.h
Thanks.