Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello everyone, I am having a problem trying to connect with my m5stickC, someone knows how to start it, thanks in advance and for all the help you can give me ... #1509

Closed
fraramon opened this issue Jan 2, 2021 · 29 comments
Milestone

Comments

@fraramon
Copy link

fraramon commented Jan 2, 2021

The configuration that I am using is the following:

  • Thonny 3.3.1 (MicroPython (ESP32))
  • M5StickC Plus Firware v1.7.0-plus (App Mode with temp.py)
  • Windows 10.

The error that is occurring is the following:

MicroPython 7e31c2ada-dirty on 2020-12-04; M5StickC-Plus with ESP32
Type "help()" for more information.
ERROR thonny.plugins.micropython.backend: Crash in backend
Traceback (most recent call last):
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\connection.py", line 44, in read
self._read_buffer.extend(self._read_queue.get(True, timer.time_left))
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\queue.py", line 178, in get
raise Empty
_queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 130, in init
self._prepare(clean)
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 149, in _prepare
self._prepare_helpers()
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 196, in _prepare_helpers
self._execute_without_output(script)
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 544, in _execute_without_output
out, err = self._execute(script, capture_output=True)
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 518, in _execute
self._execute_with_consumer(script, consume_output)
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\bare_metal_backend.py", line 548, in _execute_with_consumer
self._submit_code(script)
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\bare_metal_backend.py", line 524, in _submit_code
self._connection.read_all_expected(expected_echo, timeout=WAIT_OR_CRASH_TIMEOUT)
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\connection.py", line 115, in read_all_expected
actual = self.read(len(expected), timeout=timeout)
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\connection.py", line 49, in read
raise TimeoutError("Reaction timeout. Bytes read: %s" % self._read_buffer)
TimeoutError: Reaction timeout. Bytes read: bytearray(b'method\n def print_mgmt_value(obj):\n print('', repr(obj), '', sep='', end='')\n\n @staticmethod\n def repr(obj):\n try:\n s = repr(obj)\n if en(s) > 1000:\n s = s[:1000] + "..."\n ')
Traceback (most recent call last):
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\connection.py", line 44, in read
self._read_buffer.extend(self._read_queue.get(True, timer.time_left))
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\queue.py", line 178, in get
raise Empty
_queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 130, in init
self._prepare(clean)
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 149, in _prepare
self._prepare_helpers()
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 196, in _prepare_helpers
self._execute_without_output(script)
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 544, in _execute_without_output
out, err = self._execute(script, capture_output=True)
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 518, in _execute
self._execute_with_consumer(script, consume_output)
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\bare_metal_backend.py", line 548, in _execute_with_consumer
self._submit_code(script)
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\bare_metal_backend.py", line 524, in _submit_code
self._connection.read_all_expected(expected_echo, timeout=WAIT_OR_CRASH_TIMEOUT)
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\connection.py", line 115, in read_all_expected
actual = self.read(len(expected), timeout=timeout)
File "C:\Users\fran2\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\connection.py", line 49, in read
raise TimeoutError("Reaction timeout. Bytes read: %s" % self._read_buffer)
TimeoutError: Reaction timeout. Bytes read: bytearray(b'method\n def print_mgmt_value(obj):\n print('', repr(obj), '', sep='', end='')\n\n @staticmethod\n def repr(obj):\n try:\n s = repr(obj)\n if en(s) > 1000:\n s = s[:1000] + "..."\n ')

Backend terminated or disconnected. Use 'Stop/Restart' to restart.

@fraramon
Copy link
Author

fraramon commented Jan 2, 2021

I've already tried a thousand ways and there's no way to make it work. If anyone knows how to help me, I would appreciate it. Thanks in advance.

@aivarannamaa
Copy link
Member

Do you get error messages? If yes, then please copy them here, together with stacktraces.

@aivarannamaa
Copy link
Member

Oh, sorry, I didn't notice your stacktraces before. Your problems looks similar to #1461. I have some remedy planned for next Thonny version. In the meanwhile you could try an older Thonny version: https://github.com/thonny/thonny/releases/tag/v3.2.7

@aivarannamaa aivarannamaa added this to the 3.3.2 milestone Jan 2, 2021
@fraramon
Copy link
Author

fraramon commented Jan 2, 2021

I think the problem is one of the echoes, they do not match.

@fraramon
Copy link
Author

fraramon commented Jan 2, 2021

I have eliminated all the comparisons and exceptions and it worked, but of course this is not a solution, and also the recording still does not work.

@fraramon
Copy link
Author

fraramon commented Jan 2, 2021

I'm going to try the version you told me, and I check if it works.

@fraramon
Copy link
Author

fraramon commented Jan 2, 2021

Version 3.2.7 works. I've been testing and it works. 👍
When will you release 3.3.2?

@fraramon
Copy link
Author

fraramon commented Jan 2, 2021

Another thing, when it is executed again, it is not waiting for the stop and generates the following error:
WARNING:root:Unexpected echo. Expected b'%Run -c $EDITOR_CONTENT\r\n', got bytearray(b'MediaTrans/TimerCam ')

@fraramon
Copy link
Author

fraramon commented Jan 2, 2021

Example the program:

from m5stack import *
from m5ui import *
from uiflow import *
while True:
      wait_ms(1000)

@aivarannamaa
Copy link
Member

Thank you for the feedback! I hope to release 3.3.2 in two weeks.

@jackho9
Copy link

jackho9 commented Jan 3, 2021

Just FYI I have the same issue with M5StickC and M5StickC-Plus. Reverting to 3.2.7

@fraramon
Copy link
Author

fraramon commented Jan 3, 2021

Can you confirm that you have this configuration?
Thonny 3.2.7 (MicroPython (ESP32))
M5StickC Plus Firware v1.7.0-plus (Modo de aplicación con temp.py) (In USB mode it doesn't work)
Windows 10.

@jackho9
Copy link

jackho9 commented Jan 3, 2021

Hello fraramon, yes that's exactly my configuration, with USB Serial Port (Com 3) on Windows 10 Home.

It works in USB mode for me. As always when Thonny is started the M5StickC is busy and I need to interrupt it with Ctrl-F2. At first it wouldn't run my usual python file because lcd had disappeared from m5stack. But after a few tries lcd reappeared (weird, huh?) and it has worked fine since. Before:

Screenshot 2021-01-03 185211

After:

Screenshot 2021-01-03 185404

BTW, I am sure you know this, but you have to set the Stick up for USB mode before you connect it, right? You press the power on button for a couple of secs and then quickly press the M5 button to enter set up mode. Then use the side button to navigate and select USB connection mode.

@fraramon
Copy link
Author

fraramon commented Jan 3, 2021

You can do the following test:
1.- Burn M5stack with Firware v1.7.0-plus
2.- Select the temp.py program in M5stick-C
Try to see what happens.
Sorry about my English, I'm Spanish ... upps.

@fraramon
Copy link
Author

fraramon commented Jan 3, 2021

Reset the device with the left button.
Then quickly central button.
After 2 right click to appList.
Then right-click and select temp.py.
And when you start thonny you shouldn't have to hit Ctrl-c.
Regards.

@jackho9
Copy link

jackho9 commented Jan 3, 2021

So I turn it on, quickly press M5, then the side button twice to get to file list and select temp.py

It says "This file from web exec" - the USB connection to Thonny works and I am able to run my python file from there.

@jackho9
Copy link

jackho9 commented Jan 3, 2021

Only difference from your instructions is that I turn it off then on and had Thonny already running when I did what you suggested

@fraramon
Copy link
Author

fraramon commented Jan 3, 2021

ok, But it is just an example with no while holding the program.

@fraramon
Copy link
Author

fraramon commented Jan 3, 2021

The important thing is to select a program that does not end in an infinite loop.

@jackho9
Copy link

jackho9 commented Jan 3, 2021

This is what's shown in Thonny after doing that

Screenshot 2021-01-03 190853

@fraramon
Copy link
Author

fraramon commented Jan 3, 2021

But that is already running your code.

@fraramon
Copy link
Author

fraramon commented Jan 3, 2021

if your program ends in an infinite loop, to cut it you must use Ctrl-C.

@fraramon
Copy link
Author

fraramon commented Jan 3, 2021

Ctrl-C should be run every time a program is started, but automatically, so that we can develop quickly.

@aivarannamaa
Copy link
Member

Should be fixed under #1516, will be released in Thonny 3.3.2 (hopefully in a week). Please reopen, if you are still having same problem in Thonny 3.3.2

@fraramon
Copy link
Author

fraramon commented Jan 5, 2021

Ok, thank you very much. 👍

@jackho9
Copy link

jackho9 commented Jan 13, 2021

3.3.2 works for me now, thanks.

@fraramon
Copy link
Author

3.3.2 works for me now, thanks.

@macraj
Copy link

macraj commented Feb 12, 2021

In 3.3.3 the same problem (with echoes) still exists. After CTRL+C I can upoad file

@aivarannamaa
Copy link
Member

@macraj, can you paste your error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants