LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem serial communication with Arduino nano

I made the change by adding more sensors on the same Arduino and it works fine. Except one thing : at the first loop where I do a read Visa I get that overflow error code. I stop the program, and restart again, and it's ok. This happens one time of two at the begining. Once the first loop is done without any problem, I don't get any error after. This is not new, I alradeay had this problem starting this post. The loop runs at a speed maximum a few milliseconds, except when I press on STOP, where it takes 1 seconds. I am wondering if that doesn't create the overflow when I restart the program next time? I do close the visa port as it should down. 

0 Kudos
Message 11 of 17
(924 Views)

@User79 wrote:

at the first loop where I do a read Visa I get that overflow error code. I stop the program, and restart again, and it's ok. This happens one time of two at the begining.


Need to see code to diagnose.  But it is sounding like you have something else happening between when you open the port and you start to read from it.


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 12 of 17
(919 Views)

The problems occurs in this simplified program I have attached.

With the shift registers :

- If no problem at first loop I don't have have any problems later on

- if problem at first loop, I stop the program. If I start the program immediately after, in general it is ok. But it is seems that if I wait a bit, like 30secs or more, before restarting the program, I get that error on first loop. So the quicker I restart the program the less I havethat first loop problem.

 

When the shift registers have been deleted :

-I haven't been able to reproduce that problem. Always works fine, never had once this  error code.

 

Regarding the loop timing, with or without shift registers, I get the same behaviour  :

- iteration 0 around 10 to 20 ms  

- iteration 1 : around 2490 ms

- iteration >1 : around 5ms

- last iteration : around 1000 ms

 

 

Download All
0 Kudos
Message 13 of 17
(915 Views)

Hi everyone,

 

I am creating a new post to try to find a solution to my last question in this post (https://forums.ni.com/t5/LabVIEW/Problem-serial-communication-with-Arduino-nano/m-p/3813170#M1076951) that didn't get an answer.

When I run the attached VI I get this error (error code : -1073807252 ( (Hex 0xBFFF006C An overrun error occured during transfer. A character was not read from the hardware before the next character arrived) in some of the conditions below :

 

With the shift registers :

- If no problem at first loop I don't have have any problems later on

- if problem at first loop, I stop the program. If I start the program immediately after, in general it is ok. But it is seems that if I wait a bit, like 30secs or more, before restarting the program, I get that error on first loop. So the quicker I restart the program the less I have that first loop problem.

 

When the shift registers have been deleted :

-I haven't been able to reproduce that problem. Always works fine, never had once this  error code.

 

Regarding the loop timing, with or without shift registers, I get the same behaviour  :

- iteration 0 around 10 to 20 ms  

- iteration 1 : around 2490 ms

- iteration >1 : around 5ms

- last iteration : around 1000 ms

 

I guess that when I don't use the shift registers, the error at first loop still occurs but it doesn't affect the next iterations.

I could just not use the shift registers, it would work fine, but I would like to understand why I am getting this first loop error (and why time restarting effects the behaviour of the program).

Would anyone have an idea?

Thanks.

User

0 Kudos
Message 14 of 17
(892 Views)

You should be able to unmark the solution and continue your quest there.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 15 of 17
(888 Views)

Crossrultz's answer was a real solution as far as I was at that time. I have unmarked this post as solved if that's how it should be down on the forum.

0 Kudos
Message 16 of 17
(872 Views)

Crossrulz's answer was a good one and would be the solution.  The fact it was working then and is not now means something has changed with your communication.  Offhand, I can't figure out why your VI is behaving the way you say it is now.

 

You should run your code and capture some of the data you receive in the string indicator.  Save that value as default, then save the VI and attach the actual VI to the forum.

 

Rather than having a continual streaming of data, you'd be better off if you programmed your Arduino so it behaves like a query/response communication protocol.  Have LabVIEW send a message that asks for data.  The Arduino, upon receiving that message, then and only then sends back the data.  LabVIEW will then read the data and parse it.

 

Having a query/response prevents the other device from flooding the serial port buffer while it is open as it will only send data when LabVIEW has requested it and is ready to receive it.

0 Kudos
Message 17 of 17
(865 Views)