From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB/Virtual Serial Port - No Data Read & No Errors

I have a problem reading data from the STEVAL-MKI005V1 development board for the LIS3LV02DL accelerometer. 
 
It's a USB/virtual serial port connection to the PC.  I started out testing the connection with hyper terminal, which worked.  I even changed the COM# settings (i.e. 2, 3, and 😎 and still everything works.  However, once I try this in Labview, I do not get any data read in.  I also do not get an error.  I do get a status code, 1073676294, which I've learned is ok.  I've tried numerous things to get this to work. 
 
I first started with a simple write then read.  I'm now configuring and opening the port, writing a command, waiting a certain amount of time to read, reading data, and then closing the port.  I'm also using the "number of bytes at serial port" option from a property node for the byte count on the VISA read.   
 
I've done this before with other serial devices; albeit, not a USB/virtual serial port connection. 
 
Maybe it's a USB/virtual serial port thing?!?!?!?! 
 
Any help is greatly appreciated. 
 
Dave
 
 
0 Kudos
Message 1 of 11
(4,236 Views)
...sorry...also, I've tried using MAX to connect and have had no luck.  I do notice a caution flag on the associated com port though with a device status listed as follows: 

"VISA port settings are different from the Windows port settings. Go to the Port Settings Conflict tab to resolve the inconsistency."

 I'm not too sure what this is telling me and how to resolve it.  I anticipate this is pointing to my problem though.   Still looking...

- Norwood

 

 

0 Kudos
Message 2 of 11
(4,223 Views)
...ok...even when I type in ASRL1::INSTR in my labview program for my VISA resource name, I still have no luck...
0 Kudos
Message 3 of 11
(4,221 Views)
...downloaded NI-VISA 4.3 and upgraded from NI-VISA 3.4...still no luck...
0 Kudos
Message 4 of 11
(4,220 Views)
...resolved problem - "caution flag" - in MAX.  Still cannot connect using MAX or LV program...
0 Kudos
Message 5 of 11
(4,215 Views)
Hi Norwood,

What do you mean you resolved the problem "caution flag" in MAX? Do you mean that you don't get the message anymore but can't access the port anyway in MAX and LabVIEW?

This points to a possible incompatibility with the USB-Serial converter that you have. Please take an NI Spy capture while trying to communicate with the device and upload that here. There are instructions on doing this here.

National Instruments does have a number of USB-Serial converters that are definitely compatible with NI-VISA and LabVIEW that can be found here.
Rasheel
0 Kudos
Message 6 of 11
(4,180 Views)
My resolution of the "caution flag" in MAX was in repsonse to one of my earlier posts.  Resolving this did not fix my problem - I still cannot communicate with my device in Labview; moreoever, I do not get any errors.  
 
Here is the NI-SPY capture.  I am simply writing the *dev command and expecting "3LV02DL" to be read.  Again, I do not get any errors. 
 
1.  viOpenDefaultRM (0x02010610)
Process ID: 0x00000BFC         Thread ID: 0x000009D0
Start Time: 12:49:34.828       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)
2.  viParseRsrc (0x02010610, "COM2", 4, 2)
Process ID: 0x00000BFC         Thread ID: 0x000009D0
Start Time: 12:49:34.828       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)
3.  VISA Set Attribute ("COM2", TMO_VALUE, 10000)
Process ID: 0x00000BFC         Thread ID: 0x000009D0
Start Time: 12:49:34.828       Call Duration 00:00:00.109
Status: 0 (VI_SUCCESS)
4.  VISA Set Attribute ("COM2", ASRL_BAUD, 115200)
Process ID: 0x00000BFC         Thread ID: 0x000009D0
Start Time: 12:49:34.937       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)
5.  VISA Set Attribute ("COM2", ASRL_DATA_BITS, 😎
Process ID: 0x00000BFC         Thread ID: 0x000009D0
Start Time: 12:49:34.937       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)
6.  VISA Set Attribute ("COM2", ASRL_STOP_BITS, 10)
Process ID: 0x00000BFC         Thread ID: 0x000009D0
Start Time: 12:49:34.937       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)
7.  VISA Set Attribute ("COM2", ASRL_PARITY, 0)
Process ID: 0x00000BFC         Thread ID: 0x000009D0
Start Time: 12:49:34.937       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)
8.  VISA Set Attribute ("COM2", TERMCHAR_EN, 0)
Process ID: 0x00000BFC         Thread ID: 0x000009D0
Start Time: 12:49:34.937       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)
9.  VISA Set Attribute ("COM2", TERMCHAR, 10)
Process ID: 0x00000BFC         Thread ID: 0x000009D0
Start Time: 12:49:34.937       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)
10.  VISA Set Attribute ("COM2", ASRL_FLOW_CNTRL, 0)
Process ID: 0x00000BFC         Thread ID: 0x000009D0
Start Time: 12:49:34.937       Call Duration 00:00:00.047
Status: 0 (VI_SUCCESS)
11.  VISA Set Attribute ("COM2", ASRL_END_IN, 0)
Process ID: 0x00000BFC         Thread ID: 0x000009D0
Start Time: 12:49:34.984       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)
 
12.  VISA Open ("COM2", False, 0, 0, "COM2")
Process ID: 0x00000BFC         Thread ID: 0x000009D0
Start Time: 12:49:34.984       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)
13.  VISA Write ("COM2", "*dev")
Process ID: 0x00000BFC         Thread ID: 0x000009D0
Start Time: 12:49:34.984       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)
Buffer Contents
00000000:  2A 64 65 76                                      *dev
14.  VISA Get Attribute ("COM2", ASRL_AVAIL_NUM, 0)
Process ID: 0x00000BFC         Thread ID: 0x000009D0
Start Time: 12:49:35.984       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)
15.  VISA Read ("COM2", 0)
Process ID: 0x00000BFC         Thread ID: 0x000009D0
Start Time: 12:49:35.984       Call Duration 00:00:00.000
Status: 0x3FFF0006 (VI_SUCCESS_MAX_CNT)
16.  VISA Close ("COM2")
Process ID: 0x00000BFC         Thread ID: 0x000009D0
Start Time: 12:49:35.984       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)
0 Kudos
Message 7 of 11
(4,172 Views)
Hi norwood,

Would it be possible for you to upload the .spy file that is generated? This would make it easier for me to take a look at the data, thanks!
Rasheel
0 Kudos
Message 8 of 11
(4,123 Views)
Here you go.  Thanks for your time and help.
 
D.Norwood
 
0 Kudos
Message 9 of 11
(4,117 Views)
Hi norwood,

I took a look at the NI-Spy capture, and it looks like VISA thinks that there is no data waiting at the port to be read. In the line "VISA Get Attribute", it gets the number of bytes at the port, and this returns a 0. Could you try reading the expected number of bytes, instead of using the bytes at port?

Have you tried this using the exact same LabVIEW VI with the same settings on a system with a built-in serial port? It does look like this might have to do with incompatibilities with the USB-Serial converter.

Let me know!
Rasheel
0 Kudos
Message 10 of 11
(4,082 Views)