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

Re: using HTERM with RP2040

Post by GoRo » Sat May 28, 2022 9:45 pm

Quick update:

working:
- Putty
- Tera Term
- pqcom
- Realterm

not working:
- hterm
- YAT
- my C# (most important! ;) )

Noone any ideas?

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

C# Serial Connection to RP2040 (was Re: using HTERM with RP2040)

Post by scruss » Sun May 29, 2022 1:40 pm

GoRo wrote:
Sat May 28, 2022 9:45 pm
not working:
- hterm
- YAT
- my C# (most important! ;) )

Noone any ideas?
Now that's a completely different question.

How are you generating the output on RP2040 MicroPython that you want to read with C#? If you're using print(), it should be sending UTF-8 characters (with no BOM) + LF. C#'s SerialPort.ReadLine looks like it's expecting the same (unless you've redefined C#'s Newline, that is).

If you're using write() from MicroPython, it doesn't append any LF automatically, so ReadLine in C# won't be happy.

I don't know how C# handles UTF-8. The last time (long time ago) I had to use anything MS-derived, it forced all I/O to UTF-16, which made me sad.

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

Re: using HTERM with RP2040

Post by GoRo » Sun May 29, 2022 6:15 pm

It's not a problem of coding chars, because data is perfectly received as 8bit-ASCII e. g. with 'pqcom'.

Python works perfect on Windows as well, but not C#. C# detects the connection, opens the port, but does not receive anything (class System.IO.Ports.SerialDataReceivedEventArgs). :?

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 » Mon May 30, 2022 2:20 am

but what about the C# equivalent of readline? If it can't read incoming characters, but Python can, then there are bigger problems with your system.

You don't accidentally have the device opened by another process, do you?

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

Re: using HTERM with RP2040

Post by GoRo » Mon May 30, 2022 9:34 am

The type of a serial input is always byte, but C# simply doesn't even trigger that event.

Well, yes, I also thought about a different task blocking that, especially because the USB of the RP2040 may provide different services. That's why I also tried the Zadic driver (https://zadig.akeo.ie/), but the result is the same. :cry:

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

Re: using HTERM with RP2040

Post by GoRo » Tue May 31, 2022 4:41 pm

Finally it was totally simple: It was the handshake! OMG, how could I oversee that :roll:

Normally, it's allways no handshake on a physical interface because 2 lines are less efford than for lines ;) , but the RP2040/Micropyhton obviously uses (virtual) HW handshake by default. Enabling flow control and setting DTR high soved the problem with HTerm and most likely it'll work with C#, too, of course.

Thank you for all the ideas!

User avatar
karfas
Posts: 193
Joined: Sat Jan 16, 2021 12:53 pm
Location: Vienna, Austria

Re: using HTERM with RP2040

Post by karfas » Tue May 31, 2022 7:25 pm

GoRo wrote:
Tue May 31, 2022 4:41 pm
Normally, it's allways no handshake on a physical interface...
I completely disagree. In my early days in IT EVERY serial connection (Modem, Terminals, even my 300Bd acoustic coupler) used RTS, CTS and DTR.
A visit to a customer required two handful of breakout boxes, zero-modem adapters and 9 to 25 converters.
A few hours of debugging might save you from minutes of reading the documentation! :D
My repositories: https://github.com/karfas

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

Re: using HTERM with RP2040

Post by GoRo » Tue May 31, 2022 7:42 pm

Ok, in my EARLY days as well.. :lol: I remember I put an optocouper to the RI line to detect incoming FAX.. Oh my god - I'm old! :)

In fact, I was talking about µC and serial. When handshake is used today, it is used as PIO for reset or entering programming mode, altough the classic usecase may still be useful for some applications. Honestly I never saw one, but I'm more focussed on RS485 and CAN.

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

Re: using HTERM with RP2040

Post by GoRo » Wed Jun 01, 2022 5:28 am


Post Reply