LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Port Open Stops Power Connection

Solved!
Go to solution

I've used VISA several times before, but never with an application like this one.  I'm using a basic VISA Open command to talk to a RPLIDAR USB device.  All I've been able to discover so far is that as soon as I open the VISA port, the RPLIDAR device stops rotating.  The USB connection is providing power to the device, and it's like when I open the VISA connection it cuts the power.  

 

Yes, I did search, and I've found several older posts related to this particular device, and the issues people had trying to talk to it in LabVIEW, but none that got as far as this, and no one that solved it.  It seems everyone else gave up, or found the solution and didn't post it.

 

Anyone have a guess why just opening the port (even if I stop it there and do nothing else) is stopping the motor?  I do zero commands, and close the VISA port, and the motor immediately resumes turning.  It seems very strange to me.

0 Kudos
Message 1 of 4
(1,339 Views)

Does the device support some kind of USB-UART converter or it is a native USB implementation and VISA open establishing the connection is not handled and causes the device to crash?

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 4
(1,324 Views)
Solution
Accepted by topic author Shane-C

Yes it's important to know what type of USB device it is. If it is a USB-CDC device, meaning it appears to the OS as a RS-232 port, there are many things that might be causing this. That the power is cut on opening the port sounds rather unlikely or the USB interface and/or device driver for that device is truly borked.

 

But RS-232 also has additional handshake lines like RTS, CTS, RTR, DTR, DCD and it is very possible that the device uses one of them as inhibit signal (or sometimes even as power source but that would be also a borked implementation).

 

Do you use the VISA Open function to open the port or rather the VISA Configure Serial Port? What do you use to close the port again, which according to you makes the device work again? What is the make and model number of the device?

 

Looking through the sources of the LPLIDAR SDK, which supposedly is for your device, I do see that they explicitly enable the DTR line when opening the port and then clear the DTR state (setting it to RS-232 state space, which is the positive/high voltage +5-15V).

 

Try to add a property node to set the VISA->Serial Settings->Modem Line Settings->Line DTR state to most likely logic FALSE after you open the port. You will also need to make sure to use the right baudrate.

 

But things will get hairy after that. The SDK is not just a trivial driver sending some text commands to the sender. It transfers commands and data as binary and most of that logic can be found in here and while it is totally possible to do this in LabVIEW, it is going to be a lot of work and the binary nature of the data stream will make you learn a few more things about bits and bytes than you probably have cared to learn so far.

Rolf Kalbermatter
My Blog
Message 3 of 4
(1,289 Views)
Solution
Accepted by topic author Shane-C

Thanks everyone for the quick responses.  That pointed me in the right direction.  Turns out that it's not actually all that complicated, all that is needed is to set the DTR state to on/off to control the motor.  I've never used those lines before and would not have though of that on my own.  The rest of the API is fairly straight forward just writing on binary byte packets and reading back the response as per the manual.  Here is an image of my new open command that works:

ShaneC_0-1636039078155.png

 

For anyone else facing the same issue, the DTR line can be used again to turn off the motor.  It's basically an on/off switch (or that's what it looks like to me anyway.)

Message 4 of 4
(1,240 Views)