Page 2 of 2

Re: using HTERM with RP2040

Posted: Sat May 28, 2022 9:45 pm
by GoRo
Quick update:

working:
- Putty
- Tera Term
- pqcom
- Realterm

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

Noone any ideas?

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

Posted: Sun May 29, 2022 1:40 pm
by scruss
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.

Re: using HTERM with RP2040

Posted: Sun May 29, 2022 6:15 pm
by GoRo
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). :?

Re: using HTERM with RP2040

Posted: Mon May 30, 2022 2:20 am
by scruss
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?

Re: using HTERM with RP2040

Posted: Mon May 30, 2022 9:34 am
by GoRo
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:

Re: using HTERM with RP2040

Posted: Tue May 31, 2022 4:41 pm
by GoRo
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!

Re: using HTERM with RP2040

Posted: Tue May 31, 2022 7:25 pm
by karfas
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.

Re: using HTERM with RP2040

Posted: Tue May 31, 2022 7:42 pm
by GoRo
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.

Re: using HTERM with RP2040

Posted: Wed Jun 01, 2022 5:28 am
by GoRo