Python Pyserial write() in Putty then STM32 - python

Im trying to see what pyserial is writing in Putty, later on I would like to try CubeIDE STM32 to receive this data as well.
Putty gives me a port is being used error. How can I check what Python is writing to COM5?

You can use programs like for example Virtual Serial Port Driver. It can create linked virtual COM ports ,one to write and second to read data.

Related

How can I make a virtual COM port in python? (Windows)

I have a python script that talks to an external device through a COM port. I'm trying to make unit tests for this and I would like to write something that can act as a simulated COM port so I can run these tests without the machine that the script usually uses.
It seems like virtual COM ports are what I need but I haven't been able to find any clear python implementations of this. I'm not sure the best way to do this but I've been thinking that a script that I could leave running would read the virtual port and write back to it whenever the tests are running.

What is workable serial port name for MacOS of /dev/cu.usbmodem143301 that can be accepted by Python's Pyserial?

I'm trying to use Python on my Mac Catalina to communicate with my Arduino and keep getting "no such file or directory" when I input the Mac serial port /dev/cu.usbmodem1433301 (Arduino Uno) as indicated in the Arduino Tools/Port list and I run the script. If I can't get a workable port for Python, I might as well not use it.
I just discovered that the usb port on the opposite end of my mac's keyboard is the one that python can communicate with arduino through. The port I was using was 143301 and the one that works (on the caps lock end) is 143101. Made all the difference in the world. Problem solved. Life is good again.

Python2.7(on Windows) Need to capture serial port output into log files during Python/Robot script run

We are testing networking devices to which test interaction is done using serial ports. Python 2.7 with Windows is used to achieve this using the PySerial module of Python.
The scripts are run using Robot framework.
We observe that the Robot logs do not contain the serial device interaction dialogues.
We tried checking on Robot framework forums and it is unlikely that such support exists at Robot framework level.
We need to implement this in Python.
How can the following be achieved:
I) Basic requirement: All script interaction with the (multiple) test devices on serial port needs to be captured into a log file
II) Advanced requirement: while the script is not actively interacting with the test device there has to be continuous background monitoring of the device under test over serial ports for any errors/crashes
Thanks!
I may be incorrect but perhaps you want to capture data sent/received between computer and device through serial port. If this is true then serial port sniffer will be required. Linux and mac os x does not support sniffing however you may use sniffing for windows.

How to create COM-port in python on windows

I'm trying to create a serial port in python. I'm going to use it to communicate with another program that is communicating via a serial port. the PySerial package seems fine but I can't get it working. I've looked eveywhere and every implementation is for linux. Can anyone help me create a COM port on windows and read/write to it?
It is not possible to create a serial port in Python, because you need a special driver for this task. You can only call 3rd party utility (with the drivers) that will do it for you.
I would recommend to try the following utilities:
Com0Com: http://sourceforge.net/projects/com0com/
Virtual Null Modem: http://www.virtual-null-modem.com/

How to send file to serial port using kermit protocol in python

I have device connected through serial port to PC. Using c-kermit I can send commands to device and read output. I can also send files using kermit protocol.
In python we have pretty nice library - pySerial. I can use it to send/receive data from device. But is there some nice solution to send files using kermit protocol?
You should be able to do it via the subprocess module. The following assumes that you can send commands to your remote machine and parse out the results already. :-)
I don't have anything to test this on at the moment, so I'm going to be pretty general.
Roughly:
use pyserial to connect to the remote system through the serial port.
run the kermit client on the remote system using switches that will send the file or files you wish to transfer over the remote systems serial port (the serial line you are using.)
disconnect your pyserial instance
start your kermit client with subprocess and accept the files.
reconnect your pyserial instance and clean everything up.
I'm willing to bet this isn't much help, but when I actually did this a few years ago (using os.system, rather than subprocess on a hideous, hideous SuperDOS system) it took me a while to get my fat head around the fact that I had to start a kermit client remotely to send the file to my client!
If I have some time this week I'll break out one of my old geode boards and see if I can post some actual working code.

Categories