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
Related
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 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
I am currently attempting to use a computer and RS232 connection to control a HP 34401A Multimeter. I am able to use commands such as "SYSTem:REMote" or "*TST" however when I attempt to use a command that sends back information nothing is returned to the computer. If I use another return command directly after I get a -410 error signifying that the output buffer is full. Are there any commands I need to use to tell it to send the information to the computer? I have been looking through the manual for one but cannot find it.
Extra Info:
RS232 Connection Setup: Baudrate=9600, Data bits=8, Stop bits=2, Parity=None
Since the connection is DTE to DTE I am using a null modem cable
I am using Termite to send commands to the multimeter
Thank you for any help!
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.
I'm trying to communicate with a device over a serial port, and pipe its output to a file. I've managed to use the screen program to communicate with the device, but I'm not sure how to pipe the data I receive to a file.
For example, right now can start the screen program with: sudo screen /dev/ttyACM0. Then I can send the command DATA to the device, and the data I want gets printed to my console. Now I want to send that data to a file.
stty doesn't seem to be working for me due to some permission error. Using sudo didn't help.
Does anyone have ideas on how I can accomplish this?