• How to realize a 'serial server' (with com port emulation on pc Windows

    From RobertoA@3:770/3 to All on Wed Dec 30 16:19:56 2020
    The Raspberry4 board has 6 native uart
    I'm not talking about serial ports via usb but uart on the gpio
    connector of the Raspberry board
    Having to control devices via uart (for example gps receivers,
    electronic scales, etc.) it would be useful to create a device that, communicating with the control computer via ethernet, would allow the
    computer to 'see' the virtual com ports, corresponding to the uart of
    the card Raspberry
    So it will be necessary to program the Raspberry so that it has a tcp /
    ip server inside, which will pass the information to the uart ports
    On the computer side it will be necessary to install programs to
    'virtualize' the com port and connect it to the tcp / ip server on the Raspberry
    How to proceed?

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Andy Burns@3:770/3 to RobertoA on Wed Dec 30 16:22:38 2020
    RobertoA wrote:

    How to proceed?

    What you're trying to do would traditionally have been done by a
    "terminal server" e.g. from DEC or Moxa, but could be done by a Pi.

    On a hardware level you'll need a level shifter to convert the PI's
    RX/TX pins from 3.3V TTL to +/- 12V e.g.

    <https://uk.farnell.com/ftdi/ttl-232r-3v3/cable-usb-to-ttl-level-serial/dp/1329


    there are plenty of cheaper ones on ebay/amazon/aliexpress

    Then you need to setup something listening on a known IP addr/TCP port,
    which invokes the "cu" utility to talk to the /dev/ttyXX port.

    not Pi specific, and probably xinetd won't be running by default, but
    clues available here ...

    <http://www.trinityos.com/LINUX/TrinityOS/cHTML/TrinityOS-c-55.html>

    Beware where it says there is zero security doing it this way, anyone
    who is allowed [by your firewall] to telnet to your Pi, will be directly connected to the serial port, you'd have to knock up any extra security yourself ...

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Andy Burns@3:770/3 to Andy Burns on Wed Dec 30 16:41:18 2020
    Andy Burns wrote:

    Then you need to setup something listening on a known IP addr/TCP port,
    which invokes the "cu" utility to talk to the /dev/ttyXX port.

    Just re-read your message, are you saying you want something to create a virtual COMn: port on a windows PC, which when opened by a program
    running there automatically connects over TCP/IP to the PI, which in
    turn connects to the serial port as mentioned above?

    The commercial drivers (e.g. Moxa) do come with such drivers, but are presumably licenced only for use with their hardware, implementing that
    from scratch would be "more involved" ...

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From =?UTF-8?Q?Bj=c3=b6rn_Lundin?=@3:770/3 to All on Wed Dec 30 18:55:40 2020
    Den 2020-12-30 kl. 16:19, skrev RobertoA:
    The Raspberry4 board has 6 native uart
    How to proceed?

    with virtual ports you need commercial drivers.
    I once did a mapping tcp-port <-> serail port in tcl
    ran in a _very_ busy warehouse translating stacker crane protcol (3964rk512)
    it ran 12 serial port on an XP at that time (now - new plcs with tcp/ip
    are installed)

    it basically looked like



    proc accept {sock addr port} {
    dbg "[gettime] -> start accept from $addr"

    if { ! [string equal $addr $::client_ip]} {
    dbg "[gettime] -> wrong client, got '$addr' but accepts only from '$::client_ip'"
    catch {close $::ss}
    catch {close $sock}
    set ::done 1 ;# signal to main loop to let go
    return
    }

    set ::my_sock $sock
    set ::my_com [open $::tty {RDWR}]

    # Read channels w/o buffering and in binary mode
    fconfigure $::my_sock -buffering none -translation binary
    fconfigure $::my_com -mode $::mode -buffering none -translation binary

    # Setup handler for communication on the channels
    fileevent $::my_sock readable [list pass_through $::my_sock $::my_com]
    fileevent $::my_com readable [list pass_through $::my_com $::my_sock]

    # make sure noone else connects while a session in running
    catch {close $::ss}
    dbg "[gettime] -> stop accept"
    }



    loop to reopen the listening socket when connection down
    while {1} {
    dbg "[gettime] -> Start listening"
    set ss [socket -server accept $port]
    vwait done ; # wait until the connection is closed
    # clean up after session
    dbg "[gettime] -> Close this session"
    catch {close $::my_com}
    catch {close $::my_sock}
    }

    there where som config files and some whitelist involved as well, but
    above is the essence of it



    its usefull, if you connect the pi with your serial device, and the
    conect the PC to the pi via a simple socket.

    --
    Björn

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Deloptes@3:770/3 to RobertoA on Wed Dec 30 19:02:28 2020
    RobertoA wrote:

    The Raspberry4 board has 6 native uart
    I'm not talking about serial ports via usb but uart on the gpio
    connector of the Raspberry board
    Having to control devices via uart (for example gps receivers,
    electronic scales, etc.) it would be useful to create a device that, communicating with the control computer via ethernet, would allow the computer to 'see' the virtual com ports, corresponding to the uart of
    the card Raspberry
    So it will be necessary to program the Raspberry so that it has a tcp /
    ip server inside, which will pass the information to the uart ports
    On the computer side it will be necessary to install programs to
    'virtualize' the com port and connect it to the tcp / ip server on the Raspberry
    How to proceed?

    I built one Rs323 to RS232 adapter during the first lock down this year. I
    had this project on my todo list since 3-4years already. I connect it to
    the GPIO pins and have a serial console, where I can see exactly
    everything. It works great. It helped me debug and setup the TFTP boot. But
    of course you can also buy a ready to use one. Pay attention on the chipset
    and manufacturer. There is tons of fake and buggy crap out there. There are also Serial to IPv4 converters, so that you can access your serial port via internet. AFAIR they are RS232 (12V) so perhaps a TTL level shifter
    (323-232) and a Serial to IPv4 is what you are looking for.
    I am not aware of any additional software (besides setting up the serial
    port on the RPI4)

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to RobertoA on Wed Dec 30 18:31:07 2020
    On Wed, 30 Dec 2020 16:19:56 +0100, RobertoA wrote:

    The Raspberry4 board has 6 native uart I'm not talking about serial
    ports via usb but uart on the gpio connector of the Raspberry board
    Having to control devices via uart (for example gps receivers,
    electronic scales, etc.) it would be useful to create a device that, communicating with the control computer via ethernet, would allow the computer to 'see' the virtual com ports, corresponding to the uart of
    the card Raspberry So it will be necessary to program the Raspberry so
    that it has a tcp /

    Ignore the gpio lines: Just get a standard a USB-serial adapter. Each
    supports a single serial line, so get one for each device with a serial
    port that you need to connect to the Pi and either plug them directly
    into the Pi or, if you run out of USB ports, via a USN connector block.

    The ones I've used have all presented a common interface to Linux:
    plugging one in on a Pi automatically creates a new serial device, /dev/ ttyUSBnn IIRC, that behaves exactly like one of the predefined serial
    ports (/dev/ttynn) that are created at boot time on a PC with builot-in
    serial ports. This means that any program using the standard Linux serial
    port library routines can read and write to anything connected to your Pi
    via a USBserial adapter. It can also set the baud rate, character size,
    parity and stop bits.

    The last Serial USB adapter I bought came from PicAxe, where they're used
    to upload PIC binaries to a PICAXE chip and/or to let the program you
    uploaded to the PICAXE chip talk to a program on your Linux box. They
    work just fine if that's a Pi too.

    PICAXE http://www.picaxe.com/ sell adaptors for £12.49 (VAT incl) +
    postage:

    https://picaxe.com/hardware/cables/picaxe-usb-download-cable/


    I'm certain they're available elsewhere too, but that's where I bought
    the last one I needed.


    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Deloptes@3:770/3 to Martin Gregorie on Wed Dec 30 22:21:13 2020
    Martin Gregorie wrote:

    The last Serial USB adapter I bought came from PicAxe, where they're used
    to upload PIC binaries to a PICAXE chip and/or to let the program you uploaded to the PICAXE chip talk to a program on your Linux box. They
    work just fine if that's a Pi too.

    PICAXE http://www.picaxe.com/ sell adaptors for £12.49 (VAT incl) +
    postage:

    https://picaxe.com/hardware/cables/picaxe-usb-download-cable/


    I'm certain they're available elsewhere too, but that's where I bought
    the last one I needed.

    The best one is the prolific chip (pl2303) in the controller, but it is hard
    to have a genuine one. There are tons of Chinese fakes. I wounder how this
    sh*t is sold in the west, how it is possible to enter the markets and why?!
    I definitely was thinking of this when heard the news about Trump and the tarifs on Chinese imports. And it is not only the prolific chip of course.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Jim Jackson@3:770/3 to Anssi Saari on Wed Dec 30 22:19:25 2020
    On 2020-12-30, Anssi Saari <as@sci.fi> wrote:
    RobertoA <amorosik@tiscalinet.it> writes:

    The Raspberry4 board has 6 native uart

    I didn't actually know that but so it is. One or two may be in use by default.

    So it will be necessary to program the Raspberry so that it has a tcp
    / ip server inside, which will pass the information to the uart ports
    On the computer side it will be necessary to install programs to
    'virtualize' the com port and connect it to the tcp / ip server on the
    Raspberry
    How to proceed?

    I can't help with the Windows part and it's really off topic here. On
    the RPi side you can use netcat to listen to a tcp port and forward data
    to serial and vice versa.

    Serial to tcp servers for linux already exist. Try looking at the
    package ser2net - I'm sure there others.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Anssi Saari@3:770/3 to RobertoA on Thu Dec 31 00:15:32 2020
    RobertoA <amorosik@tiscalinet.it> writes:

    The Raspberry4 board has 6 native uart

    I didn't actually know that but so it is. One or two may be in use by
    default.

    So it will be necessary to program the Raspberry so that it has a tcp
    / ip server inside, which will pass the information to the uart ports
    On the computer side it will be necessary to install programs to
    'virtualize' the com port and connect it to the tcp / ip server on the Raspberry
    How to proceed?

    I can't help with the Windows part and it's really off topic here. On
    the RPi side you can use netcat to listen to a tcp port and forward data
    to serial and vice versa.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Theo@3:770/3 to RobertoA on Wed Dec 30 22:17:30 2020
    RobertoA <amorosik@tiscalinet.it> wrote:
    So it will be necessary to program the Raspberry so that it has a tcp /
    ip server inside, which will pass the information to the uart ports
    On the computer side it will be necessary to install programs to
    'virtualize' the com port and connect it to the tcp / ip server on the Raspberry

    Have a look at Conserver:
    https://en.wikipedia.org/wiki/Conserver

    Theo

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dennis Lee Bieber@3:770/3 to All on Wed Dec 30 18:52:14 2020
    On Wed, 30 Dec 2020 18:31:07 -0000 (UTC), Martin Gregorie <martin@mydomain.invalid> declaimed the following:


    Ignore the gpio lines: Just get a standard a USB-serial adapter. Each >supports a single serial line, so get one for each device with a serial
    port that you need to connect to the Pi and either plug them directly
    into the Pi or, if you run out of USB ports, via a USN connector block.


    That doesn't answer the OP's actual request -- they want the ports physically on the R-Pi to be VISIBLE on the host (desktop/laptop) computer
    that is connecting to the R-Pi.

    Unfortunately, that likely means a commercial $$$ ($260) package (which may not be available for ARM architecture). https://www.eltima.com/products/com-port-redirector/ {STRIKE my
    parenthetical: "Linux version for ARM-based devices is available. Now you
    can share serial ports on ARM devices or connect to remote devices. Note:
    you need D-Bus to be installed on your device to use this version."}
    Hmmm... https://wiki.eltima.com/software-licenses/trial-version-eula.html



    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to Dennis Lee Bieber on Thu Dec 31 00:58:57 2020
    On Wed, 30 Dec 2020 18:52:14 -0500, Dennis Lee Bieber wrote:

    On Wed, 30 Dec 2020 18:31:07 -0000 (UTC), Martin Gregorie <martin@mydomain.invalid> declaimed the following:


    Ignore the gpio lines: Just get a standard a USB-serial adapter. Each >>supports a single serial line, so get one for each device with a serial >>port that you need to connect to the Pi and either plug them directly
    into the Pi or, if you run out of USB ports, via a USN connector block.


    That doesn't answer the OP's actual request -- they want the ports physically on the R-Pi to be VISIBLE on the host (desktop/laptop)
    computer that is connecting to the R-Pi.

    It answers the first part of his problem: getting signals to and from a
    user process to a D-9 or D-25 serial port without having to build
    something on a GPIO expansion card.

    Once that's done the rest should be fairly simple programming. If the OP speaks C, then whipping up a program based round the poll() library
    function is pretty straight forward, not the least because it avoids
    having to write any multithreaded code.

    Don't like C? Write it in Perl or, probably, Python instead.

    Java isn't really a starter for this job since it can't handle serial
    ports without helper processes, which would have to be written in C, Perl
    or Python.


    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dennis Lee Bieber@3:770/3 to All on Wed Dec 30 20:33:36 2020
    On Thu, 31 Dec 2020 00:58:57 -0000 (UTC), Martin Gregorie <martin@mydomain.invalid> declaimed the following:

    It answers the first part of his problem: getting signals to and from a
    user process to a D-9 or D-25 serial port without having to build
    something on a GPIO expansion card.

    A 5-pack of TTL<>RS232 level shifters is available for only $6 via Amazon (US).

    SparkFun has one that includes the DB-9 connector for $16 https://www.sparkfun.com/products/449 Other than running wires between the
    R-Pi and the unit there isn't much to "build" (and this one likely can be mounted in a suitable hole in a chassis).


    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From A. Dumas@3:770/3 to Martin Gregorie on Thu Dec 31 02:14:44 2020
    Martin Gregorie <martin@mydomain.invalid> wrote:
    It answers the first part of his problem: getting signals to and from a
    user process to a D-9 or D-25 serial port without having to build
    something on a GPIO expansion card.

    He. Never. Mentioned. D9, D25 or RS232. Stop living in 1975.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From A. Dumas@3:770/3 to Anssi Saari on Thu Dec 31 02:09:06 2020
    Anssi Saari <as@sci.fi> wrote:
    RobertoA <amorosik@tiscalinet.it> writes:
    The Raspberry4 board has 6 native uart

    I didn't actually know that but so it is. One or two may be in use by default.

    Yeah, lots of caveats: https://www.raspberrypi.org/documentation/configuration/uart.md

    I can't help with the Windows part and it's really off topic here. On
    the RPi side you can use netcat to listen to a tcp port and forward data
    to serial and vice versa.

    That seems useful.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From A. Dumas@3:770/3 to Andy Burns on Thu Dec 31 02:02:10 2020
    Andy Burns <usenet@andyburns.uk> wrote:
    On a hardware level you'll need a level shifter to convert the PI's
    RX/TX pins from 3.3V TTL to +/- 12V e.g.

    No. He said uart, never mentioned rs232.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From A. Dumas@3:770/3 to Martin Gregorie on Thu Dec 31 02:04:06 2020
    Martin Gregorie <martin@mydomain.invalid> wrote:
    Ignore the gpio lines: Just get a standard a USB-serial adapter.

    Why? His problem has nothing to do with the actual serial ports (whether
    uart or rs232) but with getting the data from them on the network.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From A. Dumas@3:770/3 to Theo on Thu Dec 31 02:14:16 2020
    Theo <theom+news@chiark.greenend.org.uk> wrote:
    Have a look at Conserver:
    https://en.wikipedia.org/wiki/Conserver

    Wow, nice.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From A. Dumas@3:770/3 to Dennis Lee Bieber on Thu Dec 31 02:14:16 2020
    Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote:
    That doesn't answer the OP's actual request -- they want the ports physically on the R-Pi to be VISIBLE on the host (desktop/laptop) computer that is connecting to the R-Pi.

    Unfortunately, that likely means a commercial $$$ ($260) package

    Nope. Look at replies by Theo and Jim.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Deloptes@3:770/3 to Dennis Lee Bieber on Thu Dec 31 09:37:02 2020
    Dennis Lee Bieber wrote:

    A 5-pack of TTL<>RS232 level shifters is available for only $6 via
    Amazon (US).


    As said there is tons of crap and who buys on Amazon?!

    SparkFun has one that includes the DB-9 connector for $16 https://www.sparkfun.com/products/449 Other than running wires between the R-Pi and the unit there isn't much to "build" (and this one likely can be mounted in a suitable hole in a chassis).

    You can soldier your own RS323<>RS232 level shifter if skilled enough - it would guarantee quality compared to the 5pack for 6US$ Amazon sh*t.

    The parts cost me about 3-4,- the plastic case however cost 6,- :/. I added some transistor, capacitor and diode for the feedback from the TTL
    signalling.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Andy Burns@3:770/3 to A. Dumas on Thu Dec 31 10:29:02 2020
    A. Dumas wrote:

    Look at replies by Theo and Jim.

    Does conserver provide a Windows COMx: driver? I didn't see one ...

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobertoA@3:770/3 to All on Thu Dec 31 21:38:59 2020
    Il 30/12/2020 18:55, Björn Lundin ha scritto:
    Den 2020-12-30 kl. 16:19, skrev RobertoA:
    The Raspberry4 board has 6 native uart
    How to proceed?

    with virtual ports you need commercial drivers.
    I once did a mapping tcp-port <-> serail port in tcl
    ran in a _very_ busy warehouse translating stacker crane protcol
    (3964rk512)
    it ran 12 serial port on an XP at that time (now - new plcs with tcp/ip
    are installed)

    it basically looked like



    proc accept {sock addr port} {
      dbg "[gettime] -> start accept from $addr"

      if { ! [string equal $addr $::client_ip]} {
        dbg "[gettime] -> wrong client, got '$addr' but accepts only from '$::client_ip'"
        catch {close $::ss}
        catch {close $sock}
        set ::done 1        ;# signal to main loop to let go
        return
      }

      set ::my_sock $sock
      set ::my_com [open $::tty {RDWR}]

      # Read channels w/o buffering and in binary mode
      fconfigure $::my_sock               -buffering none -translation binary
      fconfigure $::my_com  -mode $::mode -buffering none -translation binary

      # Setup handler for communication on the channels
      fileevent $::my_sock readable [list pass_through $::my_sock $::my_com]
      fileevent $::my_com  readable [list pass_through $::my_com $::my_sock]

      # make sure noone else connects while a session in running
      catch {close $::ss}
      dbg "[gettime] -> stop accept"
    }



     loop to reopen the listening socket when connection down
    while {1} {
      dbg "[gettime] -> Start listening"
      set ss [socket -server accept $port]
      vwait done ; # wait until the connection is closed
      # clean up after session
      dbg "[gettime] -> Close this session"
      catch {close $::my_com}
      catch {close $::my_sock}
    }

    there where som config files and some whitelist involved as well, but
    above is the essence of it



    its usefull, if you connect the pi with your serial device, and the
    conect the PC to the pi via a simple socket.


    I cannot fully understand how to use the example code described, but it
    seems to me very useful to realize what I would like to achieve
    How to use this code on Raspberry board?

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobertoA@3:770/3 to All on Thu Dec 31 21:36:34 2020
    Il 31/12/2020 03:02, A. Dumas ha scritto:
    Andy Burns <usenet@andyburns.uk> wrote:
    On a hardware level you'll need a level shifter to convert the PI's
    RX/TX pins from 3.3V TTL to +/- 12V e.g.

    No. He said uart, never mentioned rs232.


    Rs232 electric level in not necessary
    Conversion ttl-rs232 is not necessary
    Gpio port of Rasperry is connected directly with other 3v3 electronic boards The part for me obscure, is how to use Raspberry uart port for
    communication via tcp ethernet line
    The second big question is how to use for a 'virtual com port' on
    Windows side, that mus communicate with Raspberry board
    Please see the following link

    https://www.b4x.com/android/forum/threads/raspberry-how-to-realize-a-serial-ser ver-uart-ethernet.125040/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobertoA@3:770/3 to All on Thu Dec 31 21:41:51 2020
    Il 30/12/2020 19:31, Martin Gregorie ha scritto:
    On Wed, 30 Dec 2020 16:19:56 +0100, RobertoA wrote:

    The Raspberry4 board has 6 native uart I'm not talking about serial
    ports via usb but uart on the gpio connector of the Raspberry board
    Having to control devices via uart (for example gps receivers,
    electronic scales, etc.) it would be useful to create a device that,
    communicating with the control computer via ethernet, would allow the
    computer to 'see' the virtual com ports, corresponding to the uart of
    the card Raspberry So it will be necessary to program the Raspberry so
    that it has a tcp /

    Ignore the gpio lines: Just get a standard a USB-serial adapter. Each supports a single serial line, so get one for each device with a serial
    port that you need to connect to the Pi and either plug them directly
    into the Pi or, if you run out of USB ports, via a USN connector block.

    The ones I've used have all presented a common interface to Linux:
    plugging one in on a Pi automatically creates a new serial device, /dev/ ttyUSBnn IIRC, that behaves exactly like one of the predefined serial
    ports (/dev/ttynn) that are created at boot time on a PC with builot-in serial ports. This means that any program using the standard Linux serial port library routines can read and write to anything connected to your Pi
    via a USBserial adapter. It can also set the baud rate, character size, parity and stop bits.

    The last Serial USB adapter I bought came from PicAxe, where they're used
    to upload PIC binaries to a PICAXE chip and/or to let the program you uploaded to the PICAXE chip talk to a program on your Linux box. They
    work just fine if that's a Pi too.

    PICAXE http://www.picaxe.com/ sell adaptors for £12.49 (VAT incl) +
    postage:

    https://picaxe.com/hardware/cables/picaxe-usb-download-cable/


    I'm certain they're available elsewhere too, but that's where I bought
    the last one I needed.


    Why ignore the uarts provided on the gpio connector?

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobertoA@3:770/3 to All on Thu Dec 31 21:40:59 2020
    Il 30/12/2020 19:02, Deloptes ha scritto:
    RobertoA wrote:

    The Raspberry4 board has 6 native uart
    I'm not talking about serial ports via usb but uart on the gpio
    connector of the Raspberry board
    Having to control devices via uart (for example gps receivers,
    electronic scales, etc.) it would be useful to create a device that,
    communicating with the control computer via ethernet, would allow the
    computer to 'see' the virtual com ports, corresponding to the uart of
    the card Raspberry
    So it will be necessary to program the Raspberry so that it has a tcp /
    ip server inside, which will pass the information to the uart ports
    On the computer side it will be necessary to install programs to
    'virtualize' the com port and connect it to the tcp / ip server on the
    Raspberry
    How to proceed?

    I built one Rs323 to RS232 adapter during the first lock down this year. I had this project on my todo list since 3-4years already. I connect it to
    the GPIO pins and have a serial console, where I can see exactly
    everything. It works great. It helped me debug and setup the TFTP boot. But of course you can also buy a ready to use one. Pay attention on the chipset and manufacturer. There is tons of fake and buggy crap out there. There are also Serial to IPv4 converters, so that you can access your serial port via internet. AFAIR they are RS232 (12V) so perhaps a TTL level shifter
    (323-232) and a Serial to IPv4 is what you are looking for.
    I am not aware of any additional software (besides setting up the serial
    port on the RPI4)


    The description seems to be what I need
    How do you get it?

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobertoA@3:770/3 to All on Thu Dec 31 21:44:00 2020
    Il 31/12/2020 00:52, Dennis Lee Bieber ha scritto:
    On Wed, 30 Dec 2020 18:31:07 -0000 (UTC), Martin Gregorie <martin@mydomain.invalid> declaimed the following:


    Ignore the gpio lines: Just get a standard a USB-serial adapter. Each
    supports a single serial line, so get one for each device with a serial
    port that you need to connect to the Pi and either plug them directly
    into the Pi or, if you run out of USB ports, via a USN connector block.


    That doesn't answer the OP's actual request -- they want the ports physically on the R-Pi to be VISIBLE on the host (desktop/laptop) computer that is connecting to the R-Pi.

    Unfortunately, that likely means a commercial $$$ ($260) package (which may not be available for ARM architecture). https://www.eltima.com/products/com-port-redirector/ {STRIKE my parenthetical: "Linux version for ARM-based devices is available. Now you
    can share serial ports on ARM devices or connect to remote devices. Note:
    you need D-Bus to be installed on your device to use this version."}
    Hmmm... https://wiki.eltima.com/software-licenses/trial-version-eula.html



    Yes, I would like to use the uarts on the Raspberry connector and 'send/receive' via the internet to a Windows PC that must 'display' the
    comX ports

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobertoA@3:770/3 to All on Thu Dec 31 21:46:18 2020
    Il 30/12/2020 23:19, Jim Jackson ha scritto:
    On 2020-12-30, Anssi Saari <as@sci.fi> wrote:
    RobertoA <amorosik@tiscalinet.it> writes:

    The Raspberry4 board has 6 native uart

    I didn't actually know that but so it is. One or two may be in use by
    default.

    So it will be necessary to program the Raspberry so that it has a tcp
    / ip server inside, which will pass the information to the uart ports
    On the computer side it will be necessary to install programs to
    'virtualize' the com port and connect it to the tcp / ip server on the
    Raspberry
    How to proceed?

    I can't help with the Windows part and it's really off topic here. On
    the RPi side you can use netcat to listen to a tcp port and forward data
    to serial and vice versa.

    Serial to tcp servers for linux already exist. Try looking at the
    package ser2net - I'm sure there others.


    Ok thanks, now I'm looking for ser2net

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to RobertoA on Thu Dec 31 21:03:47 2020
    On Thu, 31 Dec 2020 21:36:34 +0100, RobertoA wrote:

    Il 31/12/2020 03:02, A. Dumas ha scritto:
    Andy Burns <usenet@andyburns.uk> wrote:
    On a hardware level you'll need a level shifter to convert the PI's
    RX/TX pins from 3.3V TTL to +/- 12V e.g.

    No. He said uart, never mentioned rs232.


    Rs232 electric level in not necessary Conversion ttl-rs232 is not
    necessary Gpio port of Rasperry is connected directly with other 3v3 electronic boards The part for me obscure, is how to use Raspberry uart
    port for communication via tcp ethernet line The second big question is
    how to use for a 'virtual com port' on Windows side, that mus
    communicate with Raspberry board Please see the following link

    https://www.b4x.com/android/forum/threads/raspberry-how-to-realize-a-
    serial-server-uart-ethernet.125040/

    netcat - aka. nc is one answer.

    Its a standard Linux utility program. Its usable in shell scripts which
    in turn can be run a cron jobs. See its manpage for details. Among other
    things it can copy a data stream from a serial port to a network socket
    or vice versa.


    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Andy Burns@3:770/3 to RobertoA on Thu Dec 31 21:18:25 2020
    RobertoA wrote:

    Il 31/12/2020 11:29, Andy Burns ha scritto:

    A. Dumas wrote:

    Look at replies by Theo and Jim.

    Does conserver provide a Windows COMx: driver?  I didn't see one ...

    What do you mean when you refer to 'conserver'?

    <https://www.conserver.com>

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobertoA@3:770/3 to All on Thu Dec 31 21:44:59 2020
    Il 31/12/2020 11:29, Andy Burns ha scritto:
    A. Dumas wrote:

    Look at replies by Theo and Jim.

    Does conserver provide a Windows COMx: driver?  I didn't see one ...



    What do you mean when you refer to 'conserver'?

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Andy Burns@3:770/3 to RobertoA on Thu Dec 31 21:22:24 2020
    RobertoA wrote:

    Rs232 electric level in not necessary
    Conversion ttl-rs232 is not necessary
    Gpio port of Rasperry is connected directly with other 3v3 electronic
    boards

    ok

    The part for me obscure, is how to use Raspberry uart port for
    communication via tcp ethernet line

    That's the fairly easy part, as several people have linked different ways

    The second big question is how to use for a 'virtual com port' on
    Windows side

    There are several bit of software that do half of what you want, but not
    all of it e.g. look at com0com, maybe com2tcp does actually do what you
    need?

    <http://com0com.sourceforge.net/com2tcp/ReadMe.txt>

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to RobertoA on Thu Dec 31 21:31:11 2020
    On Thu, 31 Dec 2020 21:41:51 +0100, RobertoA wrote:

    Il 30/12/2020 19:31, Martin Gregorie ha scritto:
    On Wed, 30 Dec 2020 16:19:56 +0100, RobertoA wrote:

    The Raspberry4 board has 6 native uart I'm not talking about serial
    ports via usb but uart on the gpio connector of the Raspberry board
    Having to control devices via uart (for example gps receivers,
    electronic scales, etc.) it would be useful to create a device that,
    communicating with the control computer via ethernet, would allow the
    computer to 'see' the virtual com ports, corresponding to the uart of
    the card Raspberry So it will be necessary to program the Raspberry so
    that it has a tcp /

    Ignore the gpio lines: Just get a standard a USB-serial adapter. Each
    supports a single serial line, so get one for each device with a serial
    port that you need to connect to the Pi and either plug them directly
    into the Pi or, if you run out of USB ports, via a USN connector block.

    The ones I've used have all presented a common interface to Linux:
    plugging one in on a Pi automatically creates a new serial device,
    /dev/ ttyUSBnn IIRC, that behaves exactly like one of the predefined
    serial ports (/dev/ttynn) that are created at boot time on a PC with
    builot-in serial ports. This means that any program using the standard
    Linux serial port library routines can read and write to anything
    connected to your Pi via a USBserial adapter. It can also set the baud
    rate, character size, parity and stop bits.

    The last Serial USB adapter I bought came from PicAxe, where they're
    used to upload PIC binaries to a PICAXE chip and/or to let the program
    you uploaded to the PICAXE chip talk to a program on your Linux box.
    They work just fine if that's a Pi too.

    PICAXE http://www.picaxe.com/ sell adaptors for £12.49 (VAT incl) +
    postage:

    https://picaxe.com/hardware/cables/picaxe-usb-download-cable/


    I'm certain they're available elsewhere too, but that's where I bought
    the last one I needed.


    Why ignore the uarts provided on the gpio connector?

    Because a USB serial adapter is ready to run off the shelf and uses
    standard RS-232 levels, character encoding, parity and stop bits on its
    serial side, which is compatible with most items with serial connections,
    e.g. puck-type GPS receivers.

    The ones sold by PICAXE have the USP blug on the body with a serial cable terminated by a 3.5mm 3-wire jackplug. Most other converters seem to come
    with a D9 socket (male or female - you choose) on the converter body and
    the USB plug on a short flying lead. Amazon has loads of them in the £7 -
    £15 price range.



    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dennis Lee Bieber@3:770/3 to All on Thu Dec 31 17:50:50 2020
    On Thu, 31 Dec 2020 10:29:02 +0000, Andy Burns <usenet@andyburns.uk>
    declaimed the following:

    A. Dumas wrote:

    Look at replies by Theo and Jim.

    Does conserver provide a Windows COMx: driver? I didn't see one ...

    Looking at the documentation I doubt it... It appears to be Linux specific (unless one can build "console" client on Windows).

    It does not appear to grant passthrough access to arbitrary UARTs. Instead it appears to mirror system (login) consoles to remote systems.


    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dennis Lee Bieber@3:770/3 to All on Thu Dec 31 17:37:17 2020
    On 31 Dec 2020 02:14:44 GMT, A. Dumas <alexandre@dumas.fr.invalid>
    declaimed the following:

    Martin Gregorie <martin@mydomain.invalid> wrote:
    It answers the first part of his problem: getting signals to and from a
    user process to a D-9 or D-25 serial port without having to build
    something on a GPIO expansion card.

    He. Never. Mentioned. D9, D25 or RS232. Stop living in 1975.

    Most of the hardware I've had to interface with has required RS-232 levels. In truth, the only serial port device I have that did not need
    RS-232 levels is a Kenwood R-5000 receiver -- and in its day a 5V TTL to
    RS-232 level shifter was a separate accessory or something one had to build
    in order to control it. Kenwood finally put real RS-232 ports on the TS-570/590/2000 rigs.





    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Grant Taylor@3:770/3 to RobertoA on Thu Dec 31 17:39:03 2020
    On 12/30/20 8:19 AM, RobertoA wrote:
    Having to control devices via uart (for example gps receivers,
    electronic scales, etc.) it would be useful to create a device that, communicating with the control computer via ethernet, would allow the computer to 'see' the virtual com ports, corresponding to the uart of
    the card Raspberry

    Do you /need/ (raw) Ethernet specifically? Or are you simply wanting
    the ability to use a physical serial port on one computer from another
    computer across a network (be it Ethernet, WiFi, PPP, etc.)?

    So it will be necessary to program the Raspberry so that it has a tcp /
    ip server inside, which will pass the information to the uart ports
    On the computer side it will be necessary to install programs to
    'virtualize' the com port and connect it to the tcp / ip server on the Raspberry

    There is a standard that has been used in the past: RFC 2217 - Telnet
    Com Port Control Option. It is an extension to the telnet protocol to
    allow controlling various aspects about the serial port across the
    network from the client.

    How to proceed?

    It's been about 15 years since I've used this. But the last time I did
    so, I installed one of the handful of programs that supported RFC 2217
    on a Linux machine, and a separate / independent client program on a
    Windows VM that also supported RFC 2217. The client made a virtual COM
    port on Windows that any program could use just like a physical COM
    port. The only caveat was some programs didn't know how to deal with
    COM ports numbered higher than 4.

    I've messed with a few different RFC 2217 servers for Linux. I remember messing with a couple of different RFC 2217 clients for Windows. One
    was free and limited function. Another was a reasonable price to
    license with more functions. The names of all of them have long since
    been lost to me.

    Search for things related to RFC 2217. I think that will get you close
    to what you want.



    --
    Grant. . . .
    unix || die

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From =?UTF-8?Q?Bj=c3=b6rn_Lundin?=@3:770/3 to All on Fri Jan 1 15:30:02 2021
    Den 2020-12-31 kl. 21:38, skrev RobertoA:

    I cannot fully understand how to use the example code described, but it
    seems to me very useful to realize what I would like to achieve
    How to use this code on Raspberry board?


    Hmm, if you don't see that, then it is not for you.
    Basically you adapt the code for your purposes.
    You assign values to variables
    port
    client_ip if you want a white list - otherwise remove that if-section
    tty

    then add a dbg proc like (or remove calls to dbg)
    proc dbg {what } {
    puts $what
    }

    then you run it via tclsh (I think it is installed in raspbian else
    sudo apt install tcl)

    The filevent does the rest

    But as others have pointed out - nc/netcat does the job as well
    If you are not a programmer - then that is a better route.
    If you needs are more special - then use something you can adapt
    yourself - like above

    --
    Björn

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Deloptes@3:770/3 to RobertoA on Fri Jan 1 21:54:30 2021
    RobertoA wrote:

    The description seems to be what I need
    How do you get it?

    For example this here (UART TTL to Ethernet) https://eckstein-shop.de/Waveshare-UART-TTL-to-Ethernet-Converter-ETH-RJ45-Modu le-USR-TCP232-T2?curr=EUR&gclid=CjwKCAiArbv_BRA8EiwAYGs23AXvVipkyFagOGWo7bhPhl3 2DwV9YYJKJ14TADzevjAnaJjX3jA3_RoCxmcQAvD_BwE

    or read here https://www.virtual-serial-port.org/article/best-serial-over-ethernet-tools/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Jim Jackson@3:770/3 to All on Fri Jan 1 20:29:21 2021

    Ok thanks, now I'm looking for ser2net

    It's in the RaspberryPi OS package system (which is based on debian) ...

    On the rapsberry pi ...

    sudo apt-get install ser2net

    It will probably have a man page that describes the software.
    Again on the raspberry pi ...

    man ser2net

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Andy Burns@3:770/3 to Jim Jackson on Fri Jan 1 21:28:29 2021
    Jim Jackson wrote:


    Ok thanks, now I'm looking for ser2net

    It's in the RaspberryPi OS package system

    But I think he really wants com2tcp for windows instead of ser2net ?

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobertoA@3:770/3 to All on Sat Jan 2 11:01:49 2021
    Il 01/01/2021 21:54, Deloptes ha scritto:
    RobertoA wrote:

    The description seems to be what I need
    How do you get it?

    For example this here (UART TTL to Ethernet)

    https://eckstein-shop.de/Waveshare-UART-TTL-to-Ethernet-Converter-ETH-RJ45-Modu le-USR-TCP232-T2?curr=EUR&gclid=CjwKCAiArbv_BRA8EiwAYGs23AXvVipkyFagOGWo7bhPhl3 2DwV9YYJKJ14TADzevjAnaJjX3jA3_RoCxmcQAvD_BwE

    or read here https://www.virtual-serial-port.org/article/best-serial-over-ethernet-tools/




    I already use the module with two uart https://www.pusr.com/products/dual-ttl-to-ethernet-modules-usr-tcp232-e2.html But there is no equivalent module for 6 uart

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobertoA@3:770/3 to All on Sat Jan 2 11:10:59 2021
    Il 31/12/2020 22:22, Andy Burns ha scritto:
    RobertoA wrote:

    Rs232 electric level in not necessary
    Conversion ttl-rs232 is not necessary
    Gpio port of Rasperry is connected directly with other 3v3 electronic
    boards

    ok

    The part for me obscure, is how to use Raspberry uart port for
    communication via tcp ethernet line

    That's the fairly easy part, as several people have linked different ways

    The second big question is how to use for a 'virtual com port' on
    Windows side

    There are several bit of software that do half of what you want, but not
    all of it e.g. look at com0com,  maybe com2tcp does actually do what you need?

    <http://com0com.sourceforge.net/com2tcp/ReadMe.txt>


    I know com0com but I thought it used its own protocol to communicate
    between the various components of the project
    Do you think you can also use it to communicate with netcat or other
    program that will be installed on the Raspberry?

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobertoA@3:770/3 to All on Sat Jan 2 11:08:27 2021
    Il 01/01/2021 01:39, Grant Taylor ha scritto:
    On 12/30/20 8:19 AM, RobertoA wrote:
    Having to control devices via uart (for example gps receivers,
    electronic scales, etc.) it would be useful to create a device that,
    communicating with the control computer via ethernet, would allow the
    computer to 'see' the virtual com ports, corresponding to the uart of
    the card Raspberry

    Do you /need/ (raw) Ethernet specifically?  Or are you simply wanting
    the ability to use a physical serial port on one computer from another computer across a network (be it Ethernet, WiFi, PPP, etc.)?

    No particular protocol is required, the final goal is to be able to use
    a Hyperterminal / Realterm type program on a Windows PC to read/write
    on any of the 6 Raspberry4 uart boards


    So it will be necessary to program the Raspberry so that it has a tcp
    / ip server inside, which will pass the information to the uart ports
    On the computer side it will be necessary to install programs to
    'virtualize' the com port and connect it to the tcp / ip server on the
    Raspberry

    There is a standard that has been used in the past:  RFC 2217 - Telnet
    Com Port Control Option.  It is an extension to the telnet protocol to
    allow controlling various aspects about the serial port across the
    network from the client.


    This is valuable information, I didn't know there was a standard for
    serial port communications via telnet

    How to proceed?

    It's been about 15 years since I've used this.  But the last time I did
    so, I installed one of the handful of programs that supported RFC 2217
    on a Linux machine, and a separate / independent client program on a
    Windows VM that also supported RFC 2217.  The client made a virtual COM
    port on Windows that any program could use just like a physical COM
    port.  The only caveat was some programs didn't know how to deal with
    COM ports numbered higher than 4.


    When you talk about 'client program' exactly what are you referring to?

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobertoA@3:770/3 to All on Sat Jan 2 11:14:23 2021
    Il 01/01/2021 15:30, Björn Lundin ha scritto:
    Den 2020-12-31 kl. 21:38, skrev RobertoA:

    I cannot fully understand how to use the example code described, but
    it seems to me very useful to realize what I would like to achieve
    How to use this code on Raspberry board?


    Hmm, if you don't see that, then it is not for you.
    Basically you adapt the code for your purposes.
    You assign values to variables
    port
    client_ip if you want a white list - otherwise remove that if-section
    tty

    then add a dbg proc like (or remove calls to dbg)
    proc dbg {what } {
      puts $what
    }

    then you run it via tclsh (I think it is installed in raspbian else
    sudo apt install tcl)

    The filevent does the rest

    But as others have pointed out - nc/netcat does the job as well
    If you are not a programmer - then that is a better route.
    If you needs are more special - then use something you can adapt
    yourself - like above


    I understand the substance of the written code, what I can't do at the
    moment is how to use it on Raspberry
    What documents / tutorials to follow to understand how to use the sent code?

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobertoA@3:770/3 to All on Sat Jan 2 11:20:02 2021
    Il 31/12/2020 22:31, Martin Gregorie ha scritto:
    On Thu, 31 Dec 2020 21:41:51 +0100, RobertoA wrote:

    Il 30/12/2020 19:31, Martin Gregorie ha scritto:
    On Wed, 30 Dec 2020 16:19:56 +0100, RobertoA wrote:

    The Raspberry4 board has 6 native uart I'm not talking about serial
    ports via usb but uart on the gpio connector of the Raspberry board
    Having to control devices via uart (for example gps receivers,
    electronic scales, etc.) it would be useful to create a device that,
    communicating with the control computer via ethernet, would allow the
    computer to 'see' the virtual com ports, corresponding to the uart of
    the card Raspberry So it will be necessary to program the Raspberry so >>>> that it has a tcp /

    Ignore the gpio lines: Just get a standard a USB-serial adapter. Each
    supports a single serial line, so get one for each device with a serial
    port that you need to connect to the Pi and either plug them directly
    into the Pi or, if you run out of USB ports, via a USN connector block.

    The ones I've used have all presented a common interface to Linux:
    plugging one in on a Pi automatically creates a new serial device,
    /dev/ ttyUSBnn IIRC, that behaves exactly like one of the predefined
    serial ports (/dev/ttynn) that are created at boot time on a PC with
    builot-in serial ports. This means that any program using the standard
    Linux serial port library routines can read and write to anything
    connected to your Pi via a USBserial adapter. It can also set the baud
    rate, character size, parity and stop bits.

    The last Serial USB adapter I bought came from PicAxe, where they're
    used to upload PIC binaries to a PICAXE chip and/or to let the program
    you uploaded to the PICAXE chip talk to a program on your Linux box.
    They work just fine if that's a Pi too.

    PICAXE http://www.picaxe.com/ sell adaptors for £12.49 (VAT incl) +
    postage:

    https://picaxe.com/hardware/cables/picaxe-usb-download-cable/


    I'm certain they're available elsewhere too, but that's where I bought
    the last one I needed.


    Why ignore the uarts provided on the gpio connector?

    Because a USB serial adapter is ready to run off the shelf and uses
    standard RS-232 levels, character encoding, parity and stop bits on its serial side, which is compatible with most items with serial connections, e.g. puck-type GPS receivers.

    The ones sold by PICAXE have the USP blug on the body with a serial cable terminated by a 3.5mm 3-wire jackplug. Most other converters seem to come with a D9 socket (male or female - you choose) on the converter body and
    the USB plug on a short flying lead. Amazon has loads of them in the £7 - £15 price range.


    The rs232 level is not useful to me
    I would connect the uart of the Raspberry gpio connector directly to electronics at the 3v3 level
    Furthermore, the USB ports are not sufficient, of the four available,
    two remain free (after keyboard and mouse) while the uart devices to
    write/read are 6
    For this reason I am trying to exploit the uart directly from the gpio connector

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobertoA@3:770/3 to All on Sat Jan 2 11:23:13 2021
    Il 01/01/2021 22:28, Andy Burns ha scritto:
    Jim Jackson wrote:


    Ok thanks, now I'm looking for ser2net

    It's in the RaspberryPi OS package system

    But I think he really wants com2tcp for windows instead of ser2net ?


    That's right, se2net on the Raspberry side and then on the Windows side
    what do I put in it?

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Ahem A Rivet's Shot@3:770/3 to RobertoA on Sat Jan 2 10:41:29 2021
    On Sat, 2 Jan 2021 11:23:13 +0100
    RobertoA <amorosik@tiscalinet.it> wrote:

    Il 01/01/2021 22:28, Andy Burns ha scritto:
    Jim Jackson wrote:


    Ok thanks, now I'm looking for ser2net

    It's in the RaspberryPi OS package system

    But I think he really wants com2tcp for windows instead of ser2net ?


    That's right, se2net on the Raspberry side and then on the Windows side
    what do I put in it?

    This may prove helpful to you:

    https://remoteqth.com/wiki/index.php?page=Ser2Net

    Crammed with details including the Windows side of things.

    --
    Steve O'Hara-Smith | Directable Mirror Arrays C:\>WIN | A better way to focus the sun
    The computer obeys and wins. | licences available see
    You lose and Bill collects. | http://www.sohara.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From =?UTF-8?Q?Bj=c3=b6rn_Lundin?=@3:770/3 to All on Sat Jan 2 13:24:18 2021
    Den 2021-01-02 kl. 11:14, skrev RobertoA:
    Il 01/01/2021 15:30, Björn Lundin ha scritto:
    Den 2020-12-31 kl. 21:38, skrev RobertoA:

    I understand the substance of the written code, what I can't do at the
    moment is how to use it on Raspberry

    save it to a file and run it with
    tclsh filename


    What documents / tutorials to follow to understand how to use the sent
    code?

    There is none - since I wrote it for me - unless you mean tcl as a
    language and in particular file events <https://www.tcl.tk/man/tcl8.6/TclCmd/fileevent.htm> <https://www.tcl.tk/man/tcl8.6/TclCmd/fconfigure.htm>



    I just saw it wasn't complete - this should work (though not tested
    since I got no serial device)

    save it to a file, install tcl if not alredy there
    (sudo apt install tcl)

    and set - below
    set my_com "/dev/ttyWhatever"
    set port 6789
    to whatever values you need.

    Then - when something connects to the tcp/ip port of your choise
    it is forwared byte by byte to the serial device.
    and vice versa. whenever the soceket ot serail port becomes readable, it invokes proc pass_through that reads a byte and forwards it unless its a carriage return. those are swallowed - change the if-statement 'if
    {[string equal "\r" $tmp]}' - in pass_through if it does not apply to you.


    run it with tclsh whatever/name/you/gave/it

    #####
    #Associate a tcp/ip port 'port' with a tty 'my_com'
    # run with tclsh scriptname
    #####
    set done 0
    set my_sock 0
    set my_com "/dev/ttyWhatever"
    set port 6789
    set ss 0
    set debug 1
    set config_line {}
    ###########################

    proc gettime {} {
    return [clock format [clock seconds] -format "%Y-%b-%d %H:%M:%S"]
    }

    ###########################

    proc dbg {what} {
    if {$::debug} {
    puts $what
    # puts $::error_file_pointer $what
    # catch {flush $::error_file_pointer}
    }
    }

    ###########################

    proc pass_through {from to} {
    set tmp [read $from 1] ;# read 1 byte at a time
    if {[eof $from]} { ;# client gone or finished
    set ::done 1 ;# signal to main loop to let go
    } else {
    #do things
    if {[string equal "\r" $tmp]} {
    catch {puts "\n[gettime] -> CR received, terminating chars above" 1}
    } else {
    catch {puts -nonewline $tmp}
    catch {puts -nonewline $to $tmp} ;# put it out
    }
    }
    }
    ###########################

    proc accept {sock addr port} {
    dbg "[gettime] -> start accept from $addr"

    set ::my_sock $sock
    set ::my_com [open $::tty {RDWR}]

    # Read channels w/o buffering and in binary mode
    fconfigure $::my_sock -buffering none -translation binary
    fconfigure $::my_com -mode $::mode -buffering none -translation binary

    # Setup handler for communication on the channels
    fileevent $::my_sock readable [list pass_through $::my_sock $::my_com]
    fileevent $::my_com readable [list pass_through $::my_com $::my_sock]

    # make sure noone else connects while a session in running
    catch {close $::ss}
    dbg "[gettime] -> stop accept"
    }

    ###########################

    # loop to reopen the listening socket when connection down
    while {1} {
    dbg "[gettime] -> Start listening"
    set ss [socket -server accept $port]
    vwait done ; # wait until the connection is closed
    # clean up after session
    dbg "[gettime] -> Close this session"
    catch {close $::my_com}
    catch {close $::my_sock}
    }





    --
    Björn

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Grant Taylor@3:770/3 to RobertoA on Sat Jan 2 12:29:04 2021
    On 1/2/21 3:08 AM, RobertoA wrote:
    When you talk about 'client program' exactly what are you referring to?

    I remember messing with things in two broad categories.

    1) A driver that created a virtual serial port on the client computer,
    e.g. COM3, Which any standard Windows program could use, e.g.
    Hyperterminal.

    2) A program that spoke the RFC 2217 protocol itself. Think enhanced
    telnet / PuTTY / etc.

    I believe #1 / driver type is what you are after.



    --
    Grant. . . .
    unix || die

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dennis Lee Bieber@3:770/3 to All on Sat Jan 2 14:48:38 2021
    On Sat, 2 Jan 2021 11:08:27 +0100, RobertoA <amorosik@tiscalinet.it>
    declaimed the following:

    No particular protocol is required, the final goal is to be able to use
    a Hyperterminal / Realterm type program on a Windows PC to read/write
    on any of the 6 Raspberry4 uart boards


    Since you imply plain text I/O, the simplest route would probably be to SSH into the R-Pi, and then use a command line terminal program on the R-Pi
    to connect to the specific UART(s) -- rather than try to create a terminal server on the R-Pi exporting virtual com ports on Windows..

    https://www.cyberciti.biz/hardware/5-linux-unix-commands-for-connecting-to-the- serial-console/
    {NOTE: subject says "serial console" but you just want raw serial}

    https://linux.die.net/man/1/cu
    """
    cu takes a single argument, besides the options. If the argument is the
    string "dir" cu will make a direct connection to the port. This may only be used by users with write access to the port, as it permits reprogramming
    the modem.
    """

    The "screen" command, alone, doesn't seem that helpful -- at least, most examples seem to assume one is just toggling shell sessions on the
    device; I've only found one example claiming to open connected to a serial port.... Ah, wait https://www.cyberciti.biz/faq/unix-linux-apple-osx-bsd-screen-set-baud-rate/ """
    If a tty name (e.g. “/dev/ttyS0â€) is specified as the first parameter to the screen command, the window is directly connected to this device.
    """

    Similar process with "minicom"... SSH from host to R-Pi, start minicom, connect to desired UART/serial port.

    If using something like PuTTY on the Windows box, you could maybe even provide a start-up command to be run when the connection is made -- that command could be to start one of the above commands automatically (you'd
    have a PuTTY configuration defined for each target serial port, so clicking
    on the configuration in PuTTY session control menu would connect to the
    R-Pi, run the appropriate connection command for the port, ...





    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Grant Taylor@3:770/3 to Dennis Lee Bieber on Sat Jan 2 13:31:25 2021
    On 1/2/21 12:48 PM, Dennis Lee Bieber wrote:
    Since you imply plain text I/O, the simplest route would probably be to
    SSH into the R-Pi, and then use a command line terminal program on the
    R-Pi to connect to the specific UART(s) -- rather than try to create
    a terminal server on the R-Pi exporting virtual com ports on Windows..

    This may be a simpler solution. But it often falls quite short of other solutions. Particularly when software is running in a VM that needs to
    connect to a modem to call a bank / CC company / etc. or needs to
    connect to industrial equipment.

    Conversely, drivers that create a virtual serial port that communicates
    across the network will work for these types of special case scenarios.



    --
    Grant. . . .
    unix || die

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dennis Lee Bieber@3:770/3 to All on Sun Jan 3 12:27:42 2021
    On Sat, 2 Jan 2021 13:31:25 -0700, Grant Taylor
    <gtaylor@tnetconsulting.net> declaimed the following:

    On 1/2/21 12:48 PM, Dennis Lee Bieber wrote:
    Since you imply plain text I/O, the simplest route would probably be to
    SSH into the R-Pi, and then use a command line terminal program on the
    R-Pi to connect to the specific UART(s) -- rather than try to create
    a terminal server on the R-Pi exporting virtual com ports on Windows..

    This may be a simpler solution. But it often falls quite short of other >solutions. Particularly when software is running in a VM that needs to

    But the OP explicitly stated the use of a simple terminal program (though HyperTerm is ancient and $$$, since the light version is no longer available on Windows... TeraTerm and PuTTY in serial connection mode might
    do).

    My approach would probably start with:

    * Take out the Windows box first -- assume keyboard/mouse/monitor connected to R-Pi.
    How would the OP handle the 6 serial ports from this configuration?
    Open 6 shell windows/xterm and run minicom/cu in each (I presume
    they expect to receive some status back from the end devices in response to
    any commands sent, otherwise a simple "echo command > serialport" would
    maybe suffice and only use one shell window/xterm). Too messy? Open one
    shell window/xterm with 6 tabs, each tab running minicom/cu.
    Create a custom application (Python with wxPython/Python GTK/Tkinter...) with input and response widgets, and [send] button?

    * Don't have keyboard/mouse/monitor on the R-Pi?
    Configure the R-Pi VNC server. Install VNC client on the Windows box. Connect to R-Pi using VNC client.
    One now has a window on the Windows box that looks just like the
    monitor did in the previous option, and the same serial port handling is available (minicom/cu in shell window/tab) or custom application.

    * VNC too much overhead?
    Install (if needed) "screen" on the R-Pi. Use PuTTY to SSH into the R-Pi. Start "screen" as a shell (NOT the option for direct connect to
    port). Run minicom/cu on first serial port. Use screen escape sequence to create a second "window", run minicom/cu on second serial port; repeat
    until all six instances are running. Now user screen escape sequences to
    switch from serial port instance to instance.
    Of course, if no responses are expected from the end devices, a single PuTTY session without screen would suffice, using the "echo command
    serialport" operations.
    Note: GUI applications need not apply (though a custom application
    using text-only curses that handles all 6 serial ports at once is feasible)

    * Screen escapes too messy? Text-only too ugly?
    Run a web-server on the R-Pi (nginx?). Create a web-app (flask/django, PHP?) which presents a form with 6 sections (one for each serial port, each section has a command input field, and a response output field).
    The most basic form would require a submit button, probably using
    "GET" and the web-app would extract the sent command(s), deliver them to
    the corresponding ports, collect return status (timeout?), then
    refresh/resend the form with now empty input fields but populated response fields.
    Better might be to have the form use AJAX to dynamically send commands as entered, and receive responses for each port as they become available, instead of undergoing full page refreshes.


    Creating VCPs seems fraught with difficulties. First, one needs a "discovery" mechanism (for USB adapters, that is the USB device enumeration system, which discovers newly connected adapters, queries them for
    capabilities [serial port using xyz chip-set], searches registry for
    chip-set specific driver [or goes on-line to find one], creates VCP
    connected to adapter at address mno, assigns COM port number [and that
    number may change if the adapter is moved to a different USB port]). For a device on the net? Either the discovery module is hard-coded for a specific R-Pi, and "pings" the network looking for it, and the R-Pi is running a
    daemon that collects/distributes network packets, while the discovery
    module creates VCPs that identify specific network port connections (and
    how does one ensure the COM port numbers make logical sense)... OR the discovery module is a passive listener, and the R-Pi broadcasts an
    announcement that it has a serial port -- which any computer on the net
    with a listener could respond to by sending back "I want it" response, and
    then setting up a VCP talking to that handler process on the R-PI -- repeat
    for each port.

    Which leads us back to something like https://www.eltima.com/products/com-port-redirector/ (which, strangely,
    appears to be the same as
    https://www.eltima.com/products/serial-over-ethernet/ with a different
    name). One runs server side on the R-Pi (suspect one has to build from
    source, they likely don't have an ARMHF build), and client side on Windows
    to create the VCPs.




    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Grant Taylor@3:770/3 to Dennis Lee Bieber on Sun Jan 3 14:22:53 2021
    On 1/3/21 10:27 AM, Dennis Lee Bieber wrote:
    But the OP explicitly stated the use of a simple terminal program (though HyperTerm is ancient and $$$, since the light version is no longer available on Windows... TeraTerm and PuTTY in serial connection mode might do).

    And the COM port driver allows a simple terminal program to use the
    remote serial ports.

    How would the OP handle the 6 serial ports from this configuration?

    Six different instances of the COM driver pointed to each remote serial
    port.

    Then HyperTerm / ProComPlus / Quicken / pager program / fax program
    could use COM1, COM2, COM3, COM4, COM5, COM6 at their discretion. Just
    like they would for a hardware COM port.

    You could even have Windows Routing and Remote Access Server provide
    Dial Up Networking on the aforementioned COM ports.

    Open 6 shell windows/xterm and run minicom/cu in each (I presume they
    expect to receive some status back from the end devices in response to
    any commands sent, otherwise a simple "echo command > serialport" would
    maybe suffice and only use one shell window/xterm). Too messy? Open
    one shell window/xterm with 6 tabs, each tab running minicom/cu.

    The pager / fax / banking program that need to connect to a modem on a
    serial port are the exact type of programs that can't / won't use
    something like minicom / cu on a remote machine.

    Create a custom application (Python with wxPython/Python
    GTK/Tkinter...) with input and response widgets, and [send] button?

    That won't work when the time clock / attendance application needs to
    connect to the time clocks in the factory over a serial port.

    * Don't have keyboard/mouse/monitor on the R-Pi?
    Configure the R-Pi VNC server. Install VNC client on the Windows box.
    Connect to R-Pi using VNC client.

    That is untennable in a business environment. Especially when there is
    an option to install a virtual COM port that connects across the network
    and allows the application to run the same way that it has for the last
    15 years.

    One now has a window on the Windows box that looks just like the
    monitor did in the previous option, and the same serial port handling
    is available (minicom/cu in shell window/tab) or custom application.

    Nope.

    It's about more than simply talking to the serial port. It's about
    /how/ you talk to the serial port and /where/ you talk to the serial port.

    Things like the time clock application or the fax software running on
    Windows (where) need (as in they have no choice in the matter) to talk
    to a local (to Windows) COM port (how).

    Note: GUI applications need not apply (though a custom application
    using text-only curses that handles all 6 serial ports at once is
    feasible)

    GUI applications work perfectly fine with the virtual COM port.

    Run a web-server on the R-Pi (nginx?). Create a web-app (flask/django,
    PHP?) which presents a form with 6 sections (one for each serial port,
    each section has a command input field, and a response output field).

    So now you want to add even more complexity -and- code development into
    the process.

    You're selling the virtual COM port for me.

    1) Install and configure the remote serial port server.
    2) Install and configure the virtual COM port driver.
    3) Reconfigure the existing program to use the new COM port.
    4) Profit!!!

    Creating VCPs seems fraught with difficulties.

    Not really.

    It's quite like using an IP port for a printer. It's been quite
    standard for the better part of 30 years. Quite easy to do too.

    Which leads us back to something like https://www.eltima.com/products/com-port-redirector/
    (which, strangely, appears to be the same as https://www.eltima.com/products/serial-over-ethernet/ with a different
    name). One runs server side on the R-Pi (suspect one has to build
    from source, they likely don't have an ARMHF build), and client side
    on Windows to create the VCPs.

    Which seems to be a varient of what I'm describing.



    --
    Grant. . . .
    unix || die

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dennis Lee Bieber@3:770/3 to All on Sun Jan 3 22:27:53 2021
    o/~ Talking to myself in public o/~

    On Sun, 03 Jan 2021 12:27:42 -0500, Dennis Lee Bieber
    <wlfraed@ix.netcom.com> declaimed the following:

    Run a web-server on the R-Pi (nginx?). Create a web-app (flask/django,
    PHP?) which presents a form with 6 sections (one for each serial port, each >section has a command input field, and a response output field).
    The most basic form would require a submit button, probably using
    "GET" and the web-app would extract the sent command(s), deliver them to
    the corresponding ports, collect return status (timeout?), then >refresh/resend the form with now empty input fields but populated response >fields.
    Better might be to have the form use AJAX to dynamically send
    commands as entered, and receive responses for each port as they become >available, instead of undergoing full page refreshes.


    This might almost be a built-in...

    Node-Red is available for the R-Pi. There appear to be modules available to create a web-page "dashboard". So... It should be possible to define a "flow" for text inputs to a serial port and serial port to an
    output (for any responses).

    I'm not familiar with Node-Red, and for some reason was unable to get said dashboard to display an input item -- I did have a text input node connected to a serial port (send/receive port node -- there are also
    send-only and receive-only nodes).

    This would be simpler than a full-fledged web app and server configuration, since the flows are defined by drag&drop nodes.


    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)