02-07-2014 07:42 AM - edited 02-07-2014 08:06 AM
Hello,
I've just installed LabVIEW Interface for Arduino and I'm trying to get a simple blinking LED to work, but the connection between my Mac Pro and the Arduino Uno board isn't happening. I'm pretty new to LabVIEW so I may be missing something obvious, but I followed a tutorial so I think I did the right things.
There's a VISA Resource which has control of my Mac's ports, and its pop-up menu gives me a list of 5 ports labelled ASRL1::INSTR to ASRL5::INSTR. So far as I know, Macs don't have labelled ports the way PCs do (COM ports). My Mac Pro has a lot more than 5 USB ports anyway. I've tried each port setting from 1 to 5 a couple of times with the Arduino Uno board plugged into a USB port as usual, with no luck.
The Arduino communicates fine with my Mac over USB when I'm running the Arduino IDE, which I've been using for about a year, but I'm not familiar enough with LabVIEW to know what to try next. The Help docs don't have anything under ASRL at all, and Wikipedia and Google don't have anything very relevant either.
I'm running an up-to-date copy of LabVIEW 2013 on Mac OS X 10.9.1 Mavericks on a 2009 'Nehalem' Mac Pro. It's an evaluation copy which I've only recently downloaded so I could decide if LabVIEW for NXT (robot programming) was going to work for me or not. Despite being an evaluation copy, it doesn't appear to be crippled in any way (it just has the words 'EVALUATION COPY' printed all over the windows), so I don't think that's the problem (I can program my NXT brick just fine with it through USB).
If I can get it working for Arduino as well as NXT, that'll be twice the reason to go with it as a replacement for Arduino IDE and EV3 Home Edition.
[EDIT]
P.s. I left the Arduino connected while I wrote this post, and when I went back to it after posting, the pop-up menu on the VISA Resource now has a little icon on the left of the third 'ASRL port', namely ASRL3::INSTR . The icon looks like two screens, or perhaps monitors, arranged diagonally with the one to the upper left and behind the other. There's a green zigzag on each screen, like an oscilloscope reading of a triangle wave, and towards the bottom left of the icon there's a green tick mark. If I select it I still don't get a working connection though … Anyone know what it's supposed to mean? A recognised port, for instance?
Solved! Go to Solution.
02-07-2014 08:06 AM
02-07-2014 08:11 AM
Thanks for your prompt reply, Denis.
I'd have provided an error code or message if there had been one, but there wasn't; just a failure (apparently) to connect, and no control of the LED on the Arduino.
The LabVIEW 'code' is identical to the tutorial I followed, so I don't think the problem's there. Anyway, it makes perfect sense in Arduino terms, being a graphic form of exactly what I'd have had to write in C/Processing in the Arduino IDE.
02-07-2014 11:02 AM
Lachlan,
I have not used the Arduino code and I am still on Snow Leopard, but I will offer a few suggestions.
Serial ports (on any OS) are not identified by what is connected at the other end. You may need to actually communicate with something to find out if it is there.
One way to detemine which port is connected to the Arduino is to look at the System Information application (or whatever Mavericks might call it). Look under Hardware >> USB. First check with the Arduino disconnected. Note what devices are present. Then connect the Arduino and Refresh the information. A new device should show up. This will assure that the OS sees the device.
On the LabVIEW side open the Init.vi from the Arduino toolkit. Do not run it. With the Arduino disconnected click the operate tool on the down arrow on the VISA Resource control and select Refresh. Note the list of resources. I get ASRL1::INSTR through ASRL4. Then connect the Arduino and select Refresh again. Any new resource which shows up should be the Arduino.
Lynn
02-07-2014 11:12 AM
The Arduino Init VI will never stop if the computer is connected to serial port (whether via USB or not) which does not return an error. I am not sure how it is supposed to work, but I doubt this is correct.
Lynn
02-07-2014 01:28 PM
Hello Lynn,
Thanks for your reply. It was really helpful, and helped me to understand a bit more about the connection process.
In all the years (decades, actually) I've been using Macs I never knew that CMD-R refreshed the System Info. Thanks for the tip!
I followed your instructions (which made a lot of sense btw, and I can't believe I didn't think of doing them before - silly me), and refreshing the input pop-up menu on the LabVIEW block diagram window does show another ARSL connection. I tried refreshing it before, but didn't think to disconnect and reconnect the board, so didn't see anything.
I still can't get my Uno to show up, but I remembered that I had an old Mega and plugged that in with some success in connecting, though I haven't got it to flash an LED yet. The Uno was always erratic in connecting, even with the Arduino IDE, and it doesn't show up at all in the Sys Info, even after refreshing, though my other boards do (I have a Leonardo clone as well, though afaik LabVIEW doesn't work with them; they aren't available as a choice, anyway).
Now I just have to figure out how to get it actually doing something!
02-07-2014 01:31 PM
@johnsold wrote:
The Arduino Init VI will never stop if the computer is connected to serial port (whether via USB or not) which does not return an error. I am not sure how it is supposed to work, but I doubt this is correct.
Lynn
I'm not sure what you mean by "Init.vi will never stop if the computer is connected to serial port which does not return an error."
Also, what is it that you doubt is correct? Sorry, but I'm not clear enough on your meaning to answer you properly …
02-07-2014 01:46 PM
I connected a serial port to USB adapter to my computer and selected one of its serial ports. That port is connected to loop back (RxD tied to TxD). Then I ran Init VI from the LV Interface for Arduino. After several minutes I checked to see what it was doing by turning on Execution Highlighting. It was in the while loop at the right side of the block diagram. The Send Receive VI returns warning 1073676294 (more bytes may be available). The case structure goes to the case for that warning (marked "No Timeout") and the inner case is Default. Unless the Send Receive VI changes its output, the VI will stay in this loop forever. One time it ran over 4000 counts on the Failed Coonection Attempts line before I aborted the execution.
I would argue that this is a bug in the Arduino VIs because it should determine that a loop back is not an Arduino and terminate with an error or status message.
Lynn
02-07-2014 01:51 PM
Sorry, but I'm fairly new to LabVIEW so some of that went over my head, but I think a got the general gist of it.
So if there's something wrong in the LabVIEW Interface For Arduino code, where do I go from here?
02-07-2014 02:02 PM
Lachlan,
There may not be anything wrong with the VI so long as a working Arduino is connected. What I see does not seem to be appropriate behavior for the case where no Arduino is connected.
For the moment try to forget about my comments about the error. Try what I suggested to see if you can determine which serial port to use and whether it can talk to the Arduino.
Lynn