Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

myRIO UART Arduino Due Issue

Solved!
Go to solution

Hey Guys!

I'm using an Arduino Due to send measurement data to my myRIO1900 via the UART Port. The setup worked when I had the Arduino connected to my PC via USB cable and my LabVIEW code run on my PC as well. I then transferred the LabVIEW VI to the myRIO and changed the Serial port. I connected the Arduino Due with the RX/TX Pins and unplugged the USB cable. The Arduino shows at first the expected behaviour and displays my measurement data. After a while (10s) it seems like the RX Port of the myRIO stops reading new data (its Buffer is not full - I check that with the "bytes at Port" Node). When I restart the VI it does exactly the same and stops in lack of data after approx. 10s again.

 

Does anyone have an idea what is the reason for my data stopping after that short period?

Thanks for your help!

Tobi

0 Kudos
Message 1 of 5
(3,000 Views)

@Tobyphone67 wrote:

Does anyone have an idea what is the reason for my data stopping after that short period?


Most likely a bug in your code.  Unfortunately, we cannot check that since you did not supply your code.


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 5
(2,988 Views)

Here is the part of the code in which the problem occurs. The same part works on my PC but on the myRIO, like described above, after ca. 10s the data stream to the UART Port stops. I hope this helps?

0 Kudos
Message 3 of 5
(2,984 Views)

Hey Guys!

I have now discovered that my Arduino keeps sending data. So the problem must be on the myRIO side. It simply stops receiving the data at the Port. The buffer is just empty at a certain point. Does anyone have any idea? The code where this happens is still the same (see above).

0 Kudos
Message 4 of 5
(2,945 Views)
Solution
Accepted by topic author Tobyphone67

Okay I think I was able to solve the problem though I don't really understand my solution. I did change the required number of bytes at the port to read the port. I changed it to >0 and works now. I am still reading 6 bytes in my serial read part though.

I am expecting packages of 6 bytes each. That's why I used the "bytes at port" node to check if everything has arrived prior to reading all 6 of them. Obviously my understanding was incomplete at this point. It still reads 6 bytes at a time which makes it working for my solution.

I couldn't answer one question though: why, if bytes keep arriving, does my "bytes at port" node say (at a certain point) that there are no new bytes at the port?

0 Kudos
Message 5 of 5
(2,938 Views)