1

Is it possible to share the UART /dev/ttyAMA0 of the Raspberry Pi via the local network so that it is accessible from a Windows Machine?

I think there will also be some driver for the Windows Machine necessary so that /dev/ttyAMA0 is listed e.g. as COM1 on the Windows PC.

I looked for some solution but I did not find one. May be you can help me.

  • Maybe not so it literally appears as COM1, but obviously yes you can transfer the data over the network, and I am certain there are applications kicking around for this that will work from a pi (because I've written one but haven't bothered to publish it because I noticed there's already stuff that does much the same thing). As to whether they have corresponding Windows parts I dunno, but presumably. – goldilocks Jan 10 '17 at 15:29
  • 1
    Oh look: superuser.com/a/54727/257378 <- Found that by searching "UART over TCP". It might not be quite what you are after though. I'd focus on the windows side first because for sure it is easy enough to do a crude counterpart on the linux side (just read/write from the network to the UART). However, wait a day and see if someone who's used the slightly fancier thing I was thinking of in my first comment comes along. Pretty sure it was actually written with the Pi in mind. – goldilocks Jan 10 '17 at 15:34
2

I was able to find a solution based on this post: http://www.linuxquestions.org/questions/linux-networking-3/serial-over-lan-from-linux-to-windows-825334/#post4062960

Following steps are necessary.

  • Install com0com and com2tcp on the Windows machine and socat on the Raspberry.
  • Then add a virtual COM-pair (COM0 <-> COM25) on the Windows machine with the help of com0com.
  • Execute following command on the Raspberry. socat file:/dev/ttyAMA0,raw,echo=0,b115200 tcp-l:3016,fork& (adjust the device /dev/ttyAMA0, baudrate b115200 and port 3016 according your needs)
  • Start com2tcp on the Windows PC with following command. com2tcp --baud 115200 --ignore-dsr \\.\COM25 192.168.0.1 3016
  • Now you can communicate via COM0 with the device attached to /dev/ttyAMA0
  • Please mark your answer as expected... if it answered your question :) Which it looks like it did. Thank you for sharing too! – Piotr Kula Jan 10 '17 at 19:03
0

You could buy a USB to UART converter and access it remotely using USB/IP. You won't be able to export the built-in UART this way, since USB/IP only works with USB devices.

The advantage of this method is that you get complete control over the UART from the remote machine, including changing the baudrate and manipulating hardware flow control lines.

If all you need is to access the UART in a terminal emulator, simply connecting to your RPi via SSH and running screen /dev/ttyAMA0 115200 is enough.

0

My pigpio library lets you run a Python script on a Windows' box which can use a Pi's serial link (and the GPIO).

See http://abyz.me.uk/rpi/pigpio/python.html#serial_open

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.