LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Arduino Mini and Labview Interface for Arduino - Error 5002

Solved!
Go to solution

I modified the Analog Read Pin Example.vi by adding a VISA resource constant (COM6) and baud rate constant (9600). I further added probes as described.

The attached images show the probe report.

error1.jpg

error2.jpg

Visa resource1.jpg

Visa resource2.jpg

Visa resource3.jpg

Visa resource4.jpg

Visa resource5.jpg

0 Kudos
Message 11 of 30
(3,293 Views)

This is where I added the probes

Init vi Blockdiagram.jpg

0 Kudos
Message 12 of 30
(3,293 Views)

This looks like I expected. This says to me that VISA was able to see the USB-USART and  init the port. Did the VI run or did you get the 5002 error?

Can you place a probe on the error cluster after each sub vi it passes thru. This way we may be able to isolate where the error comes from. The 5002 error is generated in one of the cases inside the error/no/error case structure.

JohnCS

0 Kudos
Message 13 of 30
(3,293 Views)

Thanks for your constant replies & help!

Question 1: Yes, I got the 5002 error again.

Question 2: The vi 'Wait for Bytes' is reporting 0 bytes and the indikator 'Bytes Available?' is constantly set to False. Would this help?

Daniel

-

0 Kudos
Message 14 of 30
(3,293 Views)

Receiving zero bytes at the port is what triggers the 5002 error. Now we need to see where the bytes went! I don't have a Mini but I think I have a Pro around here somewhere. Its very  similar to the Mini and I can try to make it work over the weekend. What device are you using for the USB to UART connection? Are you connecting the RTS?

In the interim, unless you changed it in LIFA, try setting the baud rate to the default baud rate which is 115200 in the LabVIEW VI you are using.

JohnCS

0 Kudos
Message 15 of 30
(3,293 Views)

I'm using this device:

http://www.ebay.co.uk/itm/1x-USB-2-0-TO-RS232-Converter-UART-TTL-Serial-CP2102-For-Arduino-UNO-ATMEG...

I have conncted the reset cable as described at the page (to DTR pin).

I changed the baud rate to 115200 yesterday night, but I still received error 5002...

Thanks heaps for your help!!!

Daniel

0 Kudos
Message 16 of 30
(3,293 Views)

How exactly have you connected this RESET cable? When the VISA Configure Serial Port.vi runs, a reset is asserted by toggling the DTR line.  For the Mini to run correctly, a 0.1uf cap should be in series between the DTR pin of the USB-UART and the RESET pin of the Mini on the J1 or J2 header.

0 Kudos
Message 17 of 30
(3,293 Views)

There is a 100nF cap between the DTR pin of the USB-UART and the RESET pin of the Mini. Does this really matter?

0 Kudos
Message 18 of 30
(3,293 Views)
Solution
Accepted by topic author ToxFox

A 100nf capacitor is OK. This is in the circuit to keep the RESET pin high and still allow for an auto-reset. When the LabVIEW serial port is initialized by the VI, DSR is forced low and then the Arduino will reboot the app. This also occurs when new Arduino firmware is uploaded. Check out the Arduino web site for a full explanation:

                    http://www.arduino.cc/en/Guide/ArduinoMini

To see if this is happening as expected, check the voltage at the DSR pin. When the VI starts, the voltage should go from 3.3 to about 0.1 volts. You could also try hitting the RESET button on the Arduino just before you  run the VI.

JohnCS

0 Kudos
Message 19 of 30
(3,293 Views)

No more Init.vi error 5002 when I follow the sequence:

1. start my vi

2. wait for a few seconds (or until timeout of Init.vi)

3. hit the arduino reset button

and the VI performes as expected, awesome! Thanks heaps for your advice JohnCS!

However, using my vi requires manual and user-dependent reset that I'd love to avoid. Uploading arduino sketches does not require manual reset. Voltage at the DSR pin (to arduino / USB-UART ground) seems to measure as expected: 3.4 V before & after, -0.02 V during VI operation. Any ideas regarding auto-reset? 

Daniel

0 Kudos
Message 20 of 30
(3,293 Views)