12-02-2023 09:13 PM
Hi,
I've created an application that uses a power outlet that I can turn on and off over USB. I use this controllable power outlet to power cycle various devices. One of those devices is a computer. The computer has a USB/UART connection over which I can read the computer's boot up sequence.
I start with the PC powered up. I use a VISA Configure Serial Port and then attempt to read from the port. The first read shows me some of the data from the boot up sequence.
I thought to close the serial port, power cycle the PC, configure the serial port again and try to read from the serial port again. However, when I do that, I get an error from Configure Serial Port that something is wrong with the flow control settings of the port.
So, I tried to close the port, power cycle the PC, and then open the serial port again. This time, I don't get errors when I open the port, but my attempts to read from the port return nothing.
Can anyone suggest what I might be doing wrong in this scenario?
Thanks,
Jason Mazzotta
12-04-2023 06:53 AM
If you open a port while the connected device is sending something, it is likely your first read will have a framing error due to opening the port in the middle of a data byte. Other hardware related errors are also common from shutting down and starting up devices. I would just ignore the error on the first read and try reading again.
12-04-2023 10:04 AM
Thank you for your reply, crossrulz. I cleared out the error from the first read, as well as from using Config Serial Port after power cycle.
I then probed the VISA resource after power cycling and running Config Serial Port again. The probe showed that the VISA resource was no longer valid. So, I think using that more than once may be the problem.
12-04-2023 10:43 AM
Probably you should close the serial port when you power cycle the computer. You should be okay after that.
12-04-2023 11:16 AM - edited 12-04-2023 11:40 AM
"Probably you should close the serial port when you power cycle the computer. You should be okay after that."
"I thought to close the serial port, power cycle the PC, configure the serial port again and try to read from the serial port again. However, when I do that, I get an error from Configure Serial Port that something is wrong with the flow control settings of the port."
I do close the serial port before configuring it again. When I configure the port again, I get an error :
-1073807194 at Property Node ( arg 8 ) in VISA Configure Serial Port.
Possible reason: The connection for the given session has been lost.
12-04-2023 11:37 AM
I've run into "The connection for the given session has been lost" before. I found that when I closed the VISA, I was just closing the VISA alias that I used. I also had to close the associated VISA resource, which I got from the C:\ProgramData\National Instruments\NIvisa\visaconf.ini file. Once both of those are closed then reopening the VISA did not cause that error.
12-04-2023 12:56 PM
Thank you. I tried this and now the original VISA resource I was using is considered invalid when I try to reconfigure it?
12-04-2023 01:14 PM
@jasonmaz wrote:
Thank you. I tried this and now the original VISA resource I was using is considered invalid when I try to reconfigure it?
That sounds worse. Oh well maybe don't do that then.
12-13-2023 04:25 PM
I think the problem I was having was that I started with the computer that I was trying to communicate and the power switch turned on.
When I started with both the power switch and the computer turned off, powered on the switch, opened the port and then tried to communicate, I was successful the first time.
The cycle was then:
close the COM port
power cycle the computer
open the COM port
read from COM port
and more often then not, I could see output streaming from the UART.
In any case, my communications with this computer are more consistently successful.
Thanks!