RT-Thread / mpy-snippets

snippets code for mPython
26 stars 13 forks source link

The connected device may not be in repl state or may not be a micropython device. #59

Open chrissyast opened 3 years ago

chrissyast commented 3 years ago

Device - ESP32 DEVKIT COM connection - Silicon Labs CP210x USB to UART Bridge System - Windows 10

I have already flashed this device with micropython on a Mac via the following commands.

esptool.py --chip esp32 --port /dev/cu.usbserial-0001 erase_flash
esptool.py --chip esp32 --port /dev/cu.usbserial-0001 --baud 460800 write_flash -z 0x1000 esp32-idf4-20210202-v1.14.bin

and was able to sync and run micropython fine.

I'm now trying to use the same device on my PC. I can find and connect to the device ok, and the Run button works, but when I try to sync the device it fails with.

The connected device may not be in repl state or may not be a micropython device.

chrissyast commented 3 years ago

On disconnecting the usb I get a stack trace

Traceback (most recent call last):
  File "cli.py", line 800, in <module>
  File "site-packages\click\core.py", line 764, in __call__
  File "site-packages\click\core.py", line 717, in main
  File "site-packages\click\core.py", line 1137, in invoke
  File "site-packages\click\core.py", line 956, in invoke
  File "site-packages\click\core.py", line 555, in invoke
  File "cli.py", line 551, in repl
  File "ampy\pyboard.py", line 239, in read_until_hit
  File "ampy\pyboard.py", line 162, in read_until
  File "site-packages\serial\serialutil.py", line 590, in inWaiting
  File "site-packages\serial\serialwin32.py", line 257, in in_waiting
serial.serialutil.SerialException: ClearCommError failed (PermissionError(13, 'Access is denied.', None, 5))
[33844] Failed to execute script cli
chrissyast commented 3 years ago

I found the cause of this problem. I had created a git repository so that I could work on this project between two computers.

This created a .git folder in the project directory which RT-Thread was then trying to sync to the device. This must have caused some kind of problem or conflict for the board. Is there a way for RT thread to ignore this folder when syncing?

SummerGift commented 3 years ago

It seems that you have solved the problem :)