← index #9117Issue #2116
Related · high · value 0.242
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: wifi scan and ^C Keyboard Interrupt causes reboot

closedby MarkR42opened 2016-05-27updated 2016-05-29
port-esp8266

Steps to reproduce:

import network
sta_if = network.WLAN(network.STA_IF)                  
sta_if.scan()

Then press ctrl-C before scan is finished.

Expected result:

REPL command line continues working normally

Actual result:

after a few seconds, a crash & reboot:

>>> sta_if.scan()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyboardInterrupt: 
>>> 
 ets Jan  8 2013,rst cause:2, boot mode:(3,3)

load 0x40100000, len 31364, room 16 
tail 4
chksum 0x8e
load 0x3ffe8000, len 1040, room 4 
tail 12
chksum 0x8a
ho 0 tail 12 room 4
load 0x3ffe8410, len 804, room 12 
tail 8
chksum 0xb5
csum 0xb5

Followed by garbage, then resets into the normal command-line.

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