LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Performance drop when upgrading to v2.x

When I upgraded to LIFA v2.1.1.69 my Arduino (Mega 2560) control program runs poorly.  It is really choppy.  I tried to do some profiling (I have no idea what I'm doing here) but didn't seem to give any useful information.  It runs perfectly smoothly on v1.3.x. 

If you have any ideas it would be much appreciated.

Download All
0 Kudos
Message 1 of 9
(4,370 Views)

Hey Nathan,

Which version of the arduino firmware are you using? 1.0 /022/023? What examples are you running that you are seeing choppy behavior? Are you running at the 9600 baud rate or the 115200?

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 2 of 9
(3,009 Views)

I'm running Arduino 1.0 (which is required for LIFA 2.1.1.69).  I'm running the program that I posted above which was written by a few of us together.  I think I've narrowed it down to writing operations (digital write pin and servo write pulse width).  The analog reads don't seem to contribute to the point I can see that lag.  The thing that I've been using as my "lag guage" is the throttle needle on the front panel.  When I push the joystick foward it moves  in little jumps (it was perfectly smooth when using Arduino 022 and LIFA 1.3.0.26).

I'm using the default baud rate (115200).  Did the default baud rate change between LIFA 1.3.0.26 and 2.1.1.69?

Also, I forgot to post the other custom VI's used above.  I'll attach them here.  So, you should have the entire program that I'm running between these two posts.

EDIT:  After looking through the LIFA firmware I see that the default baud rate for the ATmega1280 and ATmega2560  is now 9600 instead of 115200, which was the default for everything in LIFA 1.3.0.26.  I'll try changing this and see if that solves my problem.

In the mean time, is there anything else that might cause this or does the baud rate explain how analog reads don't seem to be affected like the digital/servo writes?

Download All
0 Kudos
Message 3 of 9
(3,009 Views)

We changed the default baud rate from 115200 to 9600 for the Mega to get rid of the 5002 timing out error. The problem with that is if you were not running into that error your loop rate is slower- i could definitely see this affecting the performance of your digital reads/writes.

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 4 of 9
(3,009 Views)

How high can I go and still have it be reliable?  Is 9600 overkill (lower than actually needed)?

0 Kudos
Message 5 of 9
(3,009 Views)

With the Mega we had 9600 was as high as we could go and avoid the 5002 error when connecting. That being said it seems like there is some variance depending on board- especially which revision of the Mega you are using- we were using the Rev 2. If it worked for you before with 115200 I think you are probably safe to keep using that baud rate.

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 6 of 9
(3,009 Views)

After doing some testing (I'm sure I could do more), I've found that the only time that I can get 115200 to work is with a 1yr old Arduino Mega 2560 R2 and LIFA 1.3.0.26.  I could not get either the new one (Arduino Mega 2560 R2 that we just received a while back) or the old one to use 115200 with LIFA 2.1.1.69.

I'm so confused.  Our robot might not actually need to run at 115200, I will have to check with my club.

0 Kudos
Message 7 of 9
(3,009 Views)

Hey Nathan,

To change to the 115200 sample rate you need to change the rate both in the firmware and in the LabVIEW code. When its not working are you getting the 5002 error?

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 8 of 9
(3,009 Views)

I did change the baud rate on both to match but it still didn't work.  I tried it with several different values and only 9600 worked.

On another note, I tink we've figured out our other issue of running old firmware (v1.3.0.26 and Arduino 022) on our newer boards.  All we had to do on these is lower the baud rate to 57600.

So, we are likely going to just go with this for the remainder of our project.

Thanks for you time Kevin.

0 Kudos
Message 9 of 9
(3,009 Views)