LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Arduino MEGA 2560 with 115200 baud rate

Hello, I have a Arduino MEGA 2560 that I want to use for some sampling. With the original baud rate of 9600 and the original firmware in the arduino (found in C:\Program Files\National Instruments\LabVIEW 2010\vi.lib\Arduino\Firmware\LVIFA_Base) it works fine. Thing is i need to use the maximum baud rate, which is 115200 for the MEGA 2560. To do this i change a code snippet (se below)

 

#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define DEFAULTBAUDRATE 9600    // Defines The Default Serial Baud Rate (This must match the baud rate specifid in LabVIEW)
#else
#define DEFAULTBAUDRATE 115200
#endif

 

To the following:

 

#if defined(__AVR_ATmega1280__)
#define DEFAULTBAUDRATE 9600    // Defines The Default Serial Baud Rate (This must match the baud rate specifid in LabVIEW)
#else
#define DEFAULTBAUDRATE 115200

#endif

 

The program I am currently trying this on is a extreamly simple "read pin" program that just initiates with the new baudrate(se below).

The error I am getting seems to come form somewhere within either the firmware or the "read pin" sub-VI or one of its sub-VIs.



Download All
0 Kudos
Message 1 of 4
(22,680 Views)

Actually any higher baud rate will do fine. 38400 seems to be a nice and stable choice. I think that my problems are in the firmware code but I really can´t find where.

0 Kudos
Message 2 of 4
(22,646 Views)

Just want to add that the problem has not been solved. My last addition could be interpreted as the problem was solved but all I meant was that 38400 baud rate is a good match for the crystal I am using.

115200 had a quite high error rate which I started to think might have caused the problems due to some kind of loss of sync caused by one of those errors. The 38400 baud rate has a much lover error rate but still does not work.

9600 seems to be the only baud rate that will work with the Arduino MEGA 2560 and if you go into the arduinos init sub-vi you can see that whatever you put in as baud rate it will just drop that data and put in 9600 as baud rate from a constant.

 

 

If anyone has used Arduino uno, did you have any trouble changing baud rate?

0 Kudos
Message 3 of 4
(22,641 Views)

 

Have you found the solution to this issue yet?

 

anyway I have successfully changed the baud rate on Mega to 115200 after alot of strugging XD .

The way to do it is to play with the VI themselfs  ( inti vi ) + changing the firmware to somethig like this

 

#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define DEFAULTBAUDRATE 115200          // Defines The Default Serial Baud Rate (This must match the baud rate specifid in LabVIEW)
#else
#define DEFAULTBAUDRATE 115200
#endif

 

I have even tried higher baud rate and they all works , but you will not notice much difference for baud rate higher than 115200 . I believe that is the hardware/software limit

 

 

 

0 Kudos
Message 4 of 4
(22,062 Views)