LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 missing characters

Hello, I'm trying to trasmit from Labview to a custom board a command through RS232 cable. It seems to work for other commands, but in one case it seems that even if Labview counter of written byte is correct (in Visa write block), the board receive the message with one character missing, not always in the same position, but always after a specific position (not before). This command is a bit longer that the others.

I tried to set the buffer dimension , change timeout of serial port, and many other tests but they have not solved the problem.

I tried to send the same command through TeraTerm and it works in that case.

I attach the piece of code.

Thank you

0 Kudos
Message 1 of 11
(281 Views)

Hi V,

 


@V.Life wrote:

I attach the piece of code.


No, you attached an image of a small part of code…

(We cannot debug/edit/run images with LabVIEW!)

 


@V.Life wrote:

Hello, I'm trying to trasmit from Labview to a custom board a command through RS232 cable. It seems to work for other commands, but in one case it seems that even if Labview counter of written byte is correct (in Visa write block), …

I tried to send the same command through TeraTerm and it works in that case.


Using TeraTerm with the very same port settings as in LabVIEW?

Did you check the serial transmission using a tool like WireShark? Or the NI-I/O-Trace tool in MAX?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(278 Views)

Serial port settings are the same. I tried Ni Trace Tool and another software called I/O Ninja. In both case I see the correct data that seems to be transmitted, but the board does not receive all characters.

0 Kudos
Message 3 of 11
(258 Views)

Hi V,

 


@V.Life wrote:

In both case I see the correct data that seems to be transmitted, but the board does not receive all characters.


So why do you suspect LabVIEW to be the problem?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 11
(250 Views)

Only because I can send it with success from TeraTerm and maybe I have not set some parameters on Labview, if it is available.

0 Kudos
Message 5 of 11
(242 Views)

@V.Life wrote:

Serial port settings are the same. I tried Ni Trace Tool and another software called I/O Ninja. In both case I see the correct data that seems to be transmitted, but the board does not receive all characters.


So you've verified that all is sent correctly (unless you forgot some termination character). That means LVs job is done.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 11
(226 Views)

Most serial communication issues can be solved by watching this video: VIWeek 2020/Proper way to communicate over serial

========================
=== Engineer Ambiguously ===
========================
Message 7 of 11
(196 Views)

@V.Life wrote:

It seems to work for other commands, but in one case it seems that even if Labview counter of written byte is correct (in Visa write block), the board receive the message with one character missing, not always in the same position, but always after a specific position (not before).


As a first step, right-click your string constant and change to \-codes display.

It it not useful to talk about a "specific position" unless you specify what that position is.

0 Kudos
Message 8 of 11
(163 Views)

At this point it sounds like defective hardware.  There are 3 involved pieces of hardware:

 

  • Your PC's serial port
  • The cable
  • The device you are communicating with

 

Try changing the first two.  Get a different cable, and try a different serial port.  If you're using a USB to serial adapter, get a different brand (preferably one that uses FTDI, not Prolific, as its chipset).  If it's an onboard port on your motherboard, get a USB adapter or a PCIe serial port.

 

Failing all that, you say it's "a custom board".  Does that mean you have any agency over how it interprets incoming serial commands?  If so, your best bet is to add a checksum requirement to all communications, and have it reply back with a "checksum failure" response while taking no action, so your program knows to resend the message.

Message 9 of 11
(160 Views)

@V.Life wrote:

Only because I can send it with success from TeraTerm and maybe I have not set some parameters on Labview, if it is available.


This makes me think the serial buffer on your custom board is too small for this command. I say this because you have to type in the characters into TeraTerm. To a computer/microcontroller, this is horribly slow. But your test software is just dumping the entire command all at once.


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 10 of 11
(152 Views)