using HTERM with RP2040

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
User avatar
GoRo
Posts: 13
Joined: Sun Apr 03, 2022 9:35 am

using HTERM with RP2040

Post by GoRo » Sun Apr 03, 2022 8:33 pm

My favorite terminal program on both Linux and Win is Hterm for several years now. But for any reason, it does not connect to an Arduino Nano RP2040 Connect module.

Thonny on Linux works well and also Putty on Win works, but I can't get Hterm to display any incoming data on neither Linux Mint 20.3 nor Win10.

Any idea? Maybe something very simple?

User avatar
jcf
Posts: 60
Joined: Wed Mar 03, 2021 11:14 am

Re: using HTERM with RP2040

Post by jcf » Mon Apr 04, 2022 9:33 am

With Gtkterm I have no problem to connect and have a REPL (ttyACM0, 115200 baud).
Ctrl-B switches ro the normal REPL >>>

With hterm, no reaction.
I tried sending the control characters, but I am not familiar with hterm, maybe I didn't do it right.
Can you tell me how to send Ctrl-A, Ctrl-B, Ctrl-C, Ctrl-D ?

I did all this under Linux Mint.

User avatar
GoRo
Posts: 13
Joined: Sun Apr 03, 2022 9:35 am

Re: using HTERM with RP2040

Post by GoRo » Mon Apr 04, 2022 6:47 pm

Data, Hterm should send, are put into the "input control" window. You can choose ASCII (just type a text), Hex (type '0d' for carriage return e. g.), decimal, etc.

When pressing enter, the data is sent as a block. That makes it possible to test e. g. Modbus.

I tried to connect to ttyACM0, Hterm seemed to be connected but didn't receive any characters (my Nano connect sends IMU data automatically).

User avatar
scruss
Posts: 360
Joined: Sat Aug 12, 2017 2:27 pm
Location: Toronto, Canada
Contact:

Re: using HTERM with RP2040

Post by scruss » Tue Apr 05, 2022 1:02 am

I couldn't get it to do anything at all. Doesn't seem able to receive anything from the serial port on my Linux box

User avatar
jcf
Posts: 60
Joined: Wed Mar 03, 2021 11:14 am

Re: using HTERM with RP2040

Post by jcf » Tue Apr 05, 2022 8:13 am

I got it to receive data from ttyUSB0, 9600baud.
But I could not communicate with the Pico via ttyACM0.
(Linux Mint)

User avatar
jcf
Posts: 60
Joined: Wed Mar 03, 2021 11:14 am

Re: using HTERM with RP2040

Post by jcf » Tue Apr 05, 2022 8:36 am

Accidentally I noticed something:
hterm was active.
I started Thonny and tried to connect. No connection.
Then I noticed the reason why: hterm was connected.
In the hterm window I saw the result of Thonny's connection tries:

Code: Select all

>OK\r\nMPY: soft reboot ...
So the problem lies not on the receiving, but on the sending side of hterm!

User avatar
GoRo
Posts: 13
Joined: Sun Apr 03, 2022 9:35 am

Re: using HTERM with RP2040

Post by GoRo » Tue Apr 05, 2022 3:13 pm

yes, seems Thonny and Hterm can both connect to the RPi Pico (tried with that board this time) at /dev/ttyACM0 at the same time. Of couse, it does not work...

HTerm:

Code: Select all

 /'</thonny>   > 
Thonny:

Code: Select all

<thonny>'
Crash in backend
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/connection.py", line 35, in read
    self._read_buffer.extend(self._read_queue.get(True, timer.time_left))
  File "/usr/lib/python3.8/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 "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 103, in __init__
    self._prepare(clean)
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 118, in _prepare
    self._cwd = self._fetch_cwd()
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 207, in _fetch_cwd
    return self._evaluate(
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 469, in _evaluate
    _, _, value_repr = self._execute_print_expr(expr, prelude, cleanup)
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 466, in _execute_print_expr
    return self._execute(script, capture_output)
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 441, in _execute
    return self._process_until_raw_prompt(capture_output)
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 532, in _process_until_raw_prompt
    self._check_for_side_commands()
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 635, in _check_for_side_commands
    self._submit_input(cmd.data)
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 389, in _submit_input
    echo = self._connection.read(len(bdata))
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/connection.py", line 37, in read
    raise TimeoutError("Reaction timeout. Bytes read: %s" % self._read_buffer)
TimeoutError: Reaction timeout. Bytes read: bytearray(b'')
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/connection.py", line 35, in read
    self._read_buffer.extend(self._read_queue.get(True, timer.time_left))
  File "/usr/lib/python3.8/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 "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 103, in __init__
    self._prepare(clean)
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 118, in _prepare
    self._cwd = self._fetch_cwd()
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 207, in _fetch_cwd
    return self._evaluate(
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 469, in _evaluate
    _, _, value_repr = self._execute_print_expr(expr, prelude, cleanup)
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 466, in _execute_print_expr
    return self._execute(script, capture_output)
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 441, in _execute
    return self._process_until_raw_prompt(capture_output)
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 532, in _process_until_raw_prompt
    self._check_for_side_commands()
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 635, in _check_for_side_commands
    self._submit_input(cmd.data)
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 389, in _submit_input
    echo = self._connection.read(len(bdata))
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/connection.py", line 37, in read
    raise TimeoutError("Reaction timeout. Bytes read: %s" % self._read_buffer)
TimeoutError: Reaction timeout. Bytes read: bytearray(b'')

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

User avatar
GoRo
Posts: 13
Joined: Sun Apr 03, 2022 9:35 am

Re: using HTERM with RP2040

Post by GoRo » Tue Apr 05, 2022 3:20 pm

another try:

Hterm:

Code: Select all

aw REPL; Ctrl-B to exit \r\n
Thonny:

Code: Select all

Crash in backend
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 103, in __init__
    self._prepare(clean)
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 120, in _prepare
    self._builtin_modules = self._fetch_builtin_modules()
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 173, in _fetch_builtin_modules
    out, err, _ = self._execute("help('modules')", capture_output=True)
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 431, in _execute
    self._ensure_raw_propmt()
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 428, in _ensure_raw_propmt
    raise TimeoutError("Could not ensure raw prompt")
TimeoutError: Could not ensure raw prompt
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 103, in __init__
    self._prepare(clean)
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 120, in _prepare
    self._builtin_modules = self._fetch_builtin_modules()
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 173, in _fetch_builtin_modules
    out, err, _ = self._execute("help('modules')", capture_output=True)
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 431, in _execute
    self._ensure_raw_propmt()
  File "/usr/lib/python3/dist-packages/thonny/plugins/micropython/backend.py", line 428, in _ensure_raw_propmt
    raise TimeoutError("Could not ensure raw prompt")
TimeoutError: Could not ensure raw prompt

Backend terminated or disconnected. Use 'Stop/Restart' to restart.
Clicking Stop @ Thonny brings this message:

Code: Select all

Connection lost (read failed: device reports readiness to read but returned no data (device disconnected or multiple access on port?))

Use Stop/Restart to reconnect.
(message in Hterm keeps the same)

Thonny has the right idea, but I don't know how to solve that

User avatar
jcf
Posts: 60
Joined: Wed Mar 03, 2021 11:14 am

Re: using HTERM with RP2040

Post by jcf » Wed Apr 06, 2022 5:38 pm

If you can send Ctrl-A, Ctrl-B, Ctrl-C, Ctrl-D you can do the important things.
How is it done in HTERM? I tried, but I had no reaction.

User avatar
GoRo
Posts: 13
Joined: Sun Apr 03, 2022 9:35 am

Re: using HTERM with RP2040

Post by GoRo » Wed Apr 06, 2022 9:07 pm

So did I - having no reaction as well.

Hterm:
- check "Hex" in "input control" window
- enter 01 (e. g. for Ctrl-A)
- press enter key

Post Reply