Can't connect to D1 Mini Board

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
GuyLevin
Posts: 6
Joined: Tue Dec 07, 2021 12:45 pm

Can't connect to D1 Mini Board

Post by GuyLevin » Tue Dec 07, 2021 12:52 pm

I'm using D1 Mini with micropython
It happens a lot that I upload some code that has a main loop in it, and afterwards I lose connection to the board
I can see the console output, but can't see the files, can't burn a new firmware, can't stop the code from running, anything...

Tried looking for an answer online, but couldn't find anything relevant
What can I do?
Last edited by GuyLevin on Tue Dec 07, 2021 2:00 pm, edited 1 time in total.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Can't connect to D1 Mini Board

Post by Roberthh » Tue Dec 07, 2021 1:20 pm

Micropython is not a common OS. While main.py is executing, there is no REPL.
You should always be able to stop a running main.py with Ctrl-C, unless main.py re-configures the UART or detaches UART from stdin. But in any case firmware upload is possible. But a new firmware will not clean out a main.py running wild. For that, you have to make a full erase of the flash, using the erase_flash option of esptool.py.

GuyLevin
Posts: 6
Joined: Tue Dec 07, 2021 12:45 pm

Re: Can't connect to D1 Mini Board

Post by GuyLevin » Tue Dec 07, 2021 1:34 pm

Thanks for your reply
I was not able to erase using esptool and ctrl+c seems to stop the program for a second, and then it returns

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Can't connect to D1 Mini Board

Post by Roberthh » Tue Dec 07, 2021 2:25 pm

Erase_flash is the sledge hammer approach. There is hardly a reason why is should fail. What is the error message when you try it?

esptool.py -p <port_name> -b 460800 --chip esp8266 erase_flash

GuyLevin
Posts: 6
Joined: Tue Dec 07, 2021 12:45 pm

Re: Can't connect to D1 Mini Board

Post by GuyLevin » Tue Dec 07, 2021 2:56 pm

See screenshot
Attachments
Screenshot 2021-12-07 165507.png
Screenshot 2021-12-07 165507.png (32.43 KiB) Viewed 4809 times

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Can't connect to D1 Mini Board

Post by Roberthh » Tue Dec 07, 2021 3:44 pm

OK. So there is a problem switching to bootloader mode. What happens it you try to switch to bootloader manually?
For that, connect GPIO0 (D3) to GND and push reset.
P.S.: You did not specify a baud rate.

GuyLevin
Posts: 6
Joined: Tue Dec 07, 2021 12:45 pm

Re: Can't connect to D1 Mini Board

Post by GuyLevin » Tue Dec 07, 2021 3:59 pm

Looks the same
Shorted the pins and added baud rate
Attachments
Screenshot 2021-12-07 165507.png
Screenshot 2021-12-07 165507.png (32.43 KiB) Viewed 4799 times

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Can't connect to D1 Mini Board

Post by Roberthh » Tue Dec 07, 2021 4:06 pm

You have to connect GPIO0 to GND and then push the reset button. So you are using a genuine Wemos D1 Mini?

GuyLevin
Posts: 6
Joined: Tue Dec 07, 2021 12:45 pm

Re: Can't connect to D1 Mini Board

Post by GuyLevin » Tue Dec 07, 2021 4:33 pm

I did connect them and pressed the reset button
Yes, I'm using a genuine one

GuyLevin
Posts: 6
Joined: Tue Dec 07, 2021 12:45 pm

Re: Can't connect to D1 Mini Board

Post by GuyLevin » Tue Dec 07, 2021 11:16 pm

Moved from pi to windows, I was able to delete and write the firmware again
The only thing is that now I have to press the reset button while connecting the USB so the computer will recognize the controller

Post Reply