I am trying to programmatically communicate with a device connected over a serial connection. When I send commands using PuTTY, I have no problems. But when I try to communicate using Plink, I get no response. What would cause that difference?
I connect to PuTTY through the command line using putty -serial com3 -sercfg 9600 and then send my commands from within the PuTTY window using Ctrl-J (to adjust for the line endings, I think? It works in any case).
And I connect to plink using plink -serial com3 -sercfg 9600, but then neither enter nor Ctrl-J or any combination seem to send my commands.
Related
I need to write commands to a USB serial port to configure multiple devices, the commands are always the same so I type the same list of commands over and over again which is inefficient. I do this using PuTTY.
Is there a program similar to PuTTY which allows you to read commands from a text file or another method which I can send the same series of commands quickly?
PuTTY comes with console tool called Plink that's (contrary to PuTTY) intended for automation.
See this question for details how to use Plink to execute commands over serial connection:
Execute a command on device over serial connection with Plink
I emulate the firmware of a embedded device with qemu-system-arm. The output of the console is working fine by appending "console=ttyAMA0" to the kernel. On the guest there is a binary which opens another serial port for communication (bi-directional) on /dev/ttyGS0 and listens on that port. Now I need to connect to this port from the host, to send commands to the binary and receive the output.
I already tried different things like creating character devices and pseudo ttys, but I don't know how to define the serial device for the guest.
Is there a way to do this?
Thanks in advance.
If you pass multiple -serial options to QEMU they will be interpreted as defining what you want to do for UARTs 0, 1, 2, etc. So for example "-serial stdio -serial tcp::4444,server" will send UART 0 to your terminal and connect UART 1 to a TCP server on port 4444 which you can then connect to with netcat or similar utility. (You can connect serial output to a lot of different backends, not just stdio or TCP: check the QEMU documentation.)
(NB: this relies on your board model actually creating multiple UARTs and wiring them up to the command line options correctly, of course.)
I want to log and display a stream of data arriving at a serial port in hex with timestamps and all non printable characters (particularly any XON XOFF characters). don't need to transmit anything on the Tx port, it is not connected.
Been trying to use stty to set port parameters and socat to log but having trouble.
using /dev/null socat just exits without any doing any thing, using -u and /dev/null as second address doesn't show or log anything, using a PTY as second address works for a while but then hangs - I guess the PTY fills up and block with nothing reading it.
Thanks for any help.
I have a HPLC pump connected via serial port to the computer. By using PuTTy I can send commands to it such as REMOTE to control it from PC (the display will change on the pump to show that it is indeed in remote mode. However when I use the same command from python the device does not respond.
import serial
pump = serial.Serial(port='COM2', baudrate=19200)
I have tried
pump.write('REMOTE\n'.encode())
and
pump.write(b'REMOTE\n')
and
pump.write(b'REMOTE')
I resolved the issue.
I needed to use
pump.write(b'REMOTE\r')
not
\n
Is it possible to send a message to a serial device from the u-boot prompt? Like I would do in a linux terminal with echo "Hello" > /dev/tty2
Thanks
Yes, its possible to send data/write data in Serial port via Uboot. Loading Linux images over UART is possible in that case its possible to do write data to the serial device.
set line /dev/ttyUSB0
set speed 115200
send "hello"
You can just try to use echo or send from the U-boot terminal.
Right now I don't have access to U-boot from my device. This is what I did several times to just handshake serial device from U-boot.