uPyCraft looses connection to ESP32
Re: uPyCraft looses connection to ESP32
upycraft, rshell and ampy and maybe others assume that the device is in the REPL state. They do not work if the device is running a code. They try to break running code by issuing Ctrl-D. But if after reboot again code is started, that mechanism fails.
Re: uPyCraft looses connection to ESP32
It does appear that the while True: loop ties up the serial port and won't allow uPyCraft to reconnect to ESP32 boards. For the time being, a work around involves using a break statement in the while True: loop. For example:
The above is code for simple dimmer. In the above code, pin 23 can be triggered with an external push button. Once triggered the break will allow reconnection of uPyCraft to the ESP32 board.
What seems to work best is, from uPyCraft: select Tools -->Serial-->Select COM Port. After selecting COM Port (you'll have about 3 seconds) press the external pin interrupt to break out of the while True: loop and allow uPyCraft to reconnect.
Code: Select all
from machine import Pin, ADC, PWM
from time import sleep
button = Pin(23, Pin.IN, Pin.PULL_DOWN)
frequency=5000
led=PWM(Pin(5), frequency)
pot = ADC(Pin(34))
pot.atten(ADC.ATTN_11DB)
while True:
pot_value=pot.read()
percent_value=(pot_value/4095)
print(percent_value)
led.duty(int(1023*percent_value))
sleep(0.1)
if button.value()==True:
break
What seems to work best is, from uPyCraft: select Tools -->Serial-->Select COM Port. After selecting COM Port (you'll have about 3 seconds) press the external pin interrupt to break out of the while True: loop and allow uPyCraft to reconnect.
-
- Posts: 13
- Joined: Sat Oct 06, 2018 1:57 pm
Re: uPyCraft looses connection to ESP32
Hi All,
I have this annoying problem as well, it happen on some ESP8266 and all the ESP32 boards that i have.
My solution is to solder a push button between reset/enable pin and 3.3V Pin, just before you connect to the serial port, press and hold the push button, after you see ">>>" from the upycraft, you can release the push button, you need to press this push button every time you connect to upycraft, it works 100% on all my esp8266 and esp32 boards.
I have this annoying problem as well, it happen on some ESP8266 and all the ESP32 boards that i have.
My solution is to solder a push button between reset/enable pin and 3.3V Pin, just before you connect to the serial port, press and hold the push button, after you see ">>>" from the upycraft, you can release the push button, you need to press this push button every time you connect to upycraft, it works 100% on all my esp8266 and esp32 boards.
Re: uPyCraft looses connection to ESP32
I have the same issue, and it's driving me nuts too.
However, Thonny IDE is working, while uPyCraft is not. So, I just flash the firmware with uPyCraft and do everything else with Thonny IDE. It's not perfect either, but you don't have flasto h firmware every time if you unplug ESP32 -board from your computer.
However, Thonny IDE is working, while uPyCraft is not. So, I just flash the firmware with uPyCraft and do everything else with Thonny IDE. It's not perfect either, but you don't have flasto h firmware every time if you unplug ESP32 -board from your computer.