← index #9117Issue #8876
Duplicate · high · value 0.589
QUERY · ISSUE

Calling i2c.scan() causes restart on Wemos D1 mini pro

openby jose1711opened 2022-08-26updated 2026-03-19
bugport-esp8266proposed-close

The following code copied to REPL

from machine import Pin, I2C
i2c = I2C(sda=Pin(4), scl=Pin(5))
i2c.scan()

..results in device restart:

>>> i2c.scan()

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 30716, room 16 
tail 12
chksum 0xc8
ho 0 tail 12 room 4
load 0x3ffe8000, len 996, room 12 
tail 8
chksum 0x06
load 0x3ffe83f0, len 1080, room 0 
tail 8
chksum 0x11
csum 0x11
���2�N�{��N|�
             l
              d$l`B���
                      ��r�l�N�
                              �n�
                                 d ��{�p��l
                                           l`�n�l�l�

                                                    l`��s�l
                                                           ���
                                                              d$ rl��rl��"�|��B$b��B|����$$b��o�no��lo���$�ll����
                                                                                                                 d �o����cc
                                                                                                                           ld䌎�B���c
      l�bsd{$r�o����|���c�܄$�r����
MicroPython v1.19.1-337-gbd4e45fd6 on 2022-08-26; ESP module with ESP8266
Type "help()" for more information.

Issue observed with the latest stable (v1.19.1 (2022-06-18) .bin) and also nightly build (v1.19.1-337-gbd4e45fd6 (2022-08-26) .bin).

The problem goes away when board is flashed with v.1.18 or when using Arduino IDE to scan I2C bus. Here's an example after flashing with 1.18:

MicroPython v1.18 on 2022-01-17; ESP module with ESP8266
Type "help()" for more information.
>>> 
>>> from machine import Pin, I2C
>>> i2c = I2C(sda=Pin(4), scl=Pin(5))
>>> i2c.scan()
[]

HW info:

  • Wemos D1 mini pro (clone), all pins unconnected
  • connected via microUSB to a PC

Command used for flashing:

esptool.py --port /dev/ttyUSB0 --baud 1000000 write_flash --flash_size=4MB -fm dio 0 FILENAME.bin
CANDIDATE · ISSUE

ESP8266 IC2 Crash

closedby tintin10qopened 2022-07-06updated 2022-08-31
bugport-esp8266

I am getting the same error as in this issue: https://github.com/micropython/micropython/issues/1996

from machine import I2C, Pin
i2c = machine.I2C(freq=9600,sda=Pin(4), scl=Pin(5))
i2c.scan()

This code causes a crash.

 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 30720, room 16 
tail 0
chksum 0x90
load 0x3ffe8000, len 996, room 8 
tail 12
chksum 0x80
ho 0 tail 12 room 4
load 0x3ffe83f0, len 1080, room 12 
tail 12
chksum 0xf5
csum 0xf5

There is also this garbage text see the image:

image

  • firmware file name: v1.19.1 (2022-06-18) .bin
  • version information shown in the REPL: MicroPython v1.19.1 on 2022-06-18; ESP module (1M) with ESP8266

Does anyone know what is going on? I have nothing connected to pin 4 and 5.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied