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: 

UART VISA Read in vectornavread.vi

I'm trying to read the data from a IMU chip using a MyRIO and UART and the data output is this weird string of characters. (see pic) 

 

The block diagram is pretty simple, see picture.

 

What am I missing? 

Download All
0 Kudos
Message 1 of 10
(3,976 Views)

Unless this instrument is as stupid as another one I have dealt with, you have a serial port settings issue.  The most common issue is Baud Rate.  Also, most instruments do not use the parity and use 8 data bits.  So I would set those two first and then try different Baud Rates.  Unfortunately, the manual does not give must information other than it uses ASCII commands.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 10
(3,940 Views)

One other thing.  That error messages says you had a buffer overrun.  You also have a 1 second wait in your loop.  So every second, you are collecting "all the data available".  Your baud rate is set for 230,400.  Roughly 10 bits per byte, means you are getting ~23,040 bytes every read.  The serial port buffer is probably only 4096 bytes.  Thus a buffer overrun.

 

I believe you might be okay on your settings since you aren't getting a parity error, and it looks like you are receiving binary data.

 

Get rid of the 1 second wait and replace it with something much smaller.  Perhaps 50 or 100 milliseconds.  I would recommend getting rid of the Express VI which adds lot of overhead.  The VISA Serial Configure, Read, Write, and Close VI's are all very easy to use.  It is possible your Express VI is opening and closing the serial port every loop iteration.  If you are trying to read a lot of data frequently  (and 230,040 is a very, very high baud rate.  unusually so), then you want to open the port before the loop, only read and write inside the loop, and close the port when your VI is done.

 

I see you have a False wired to your Stop terminal.  Maybe this was just quick and easy for debugging purposes, but right now the only way to stop your VI is to use the Abort button, which is not a recommended way to end a VI.

0 Kudos
Message 3 of 10
(3,928 Views)

This is my reply to the both of you.

 

Thanks for your answers!

 

I've tried what you suggested and replaced the UART express with the VISA parts and using different baud rates and byte count.

But I still get this weird string of characters. 

 

Can you see from my front and block panel what is wrong? 

Download All
0 Kudos
Message 4 of 10
(3,919 Views)

You set your baud rate to 9600 (the default of the Configure Serial Port).  Shouldn't that be 230400?  In the manual, there is a list of valid baud rates.  I recommend you go through those until you find one that works.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 10
(3,913 Views)

What data do you expect to receive?  If it is "binary" data, as in any byte value from 0-255 that is probably not human readable, then you will get what you are seeing.  (And if you are expecting binary data, wire a False constant to the Enable Termination Character input of the Serial Configure VI.

 

Now your error message has changed.  You don't seem to be getting buffer overruns.  Your baud rate is now 9600 by default (since you didn't wire any other value into the Serial Configure.)  Along with 8 data bits, 1 stop bit, no parity.  Does that match you device?

 

The error message is "I/O error", which unfortunately isn't descriptive enough to tell you exactly what is wrong.

 

Have you read the device's manual?

 

Make your string indicator show "hex display" and see if that byte data matches anything you expect.

 

0 Kudos
Message 6 of 10
(3,910 Views)

Hi Jacob,

 

Just a quick question: why are do trying to do everything with the low level VISA commands? I had a quick look at the manual and it looks like you would need to invest a lot of time in order to get everything working.

 

VectorNav has a complete .NET library on their download page taking care of the low level commands and in the folder there are even Labview examples showing how to interact with the library.

 

I believe the quickest way to work with the chip would be using this library, especially if you do not have a lot of experience with serial communication.

 

http://www.vectornav.com/support/downloads

 

Andreas
CLA, CTA
0 Kudos
Message 7 of 10
(3,880 Views)

Thanks for the advice!

 

I was able to get it to show the output as a hexcidecimal but that didn't change much.

 

I've come to the conclussion that I will have to use the FPGA on the MyRIO, since I must have a baud rate of 921600 to be able to read all the data I need.

 

I will keep this thread updated 

0 Kudos
Message 8 of 10
(3,876 Views)

Thanks for your advice. 

 

I checked out VectorNav .NET library and it was quite insightful.

 

But unfortunately I can't use it, because I've to read the data through a MyRIO.

0 Kudos
Message 9 of 10
(3,864 Views)

Quick update!

 

I've discovered that the wires between the IMU chip and MyRIO were defect, so I've ordered a new cable! 

 

I hope this was the problem, but we'll see! 

0 Kudos
Message 10 of 10
(3,827 Views)