06-26-2021 05:37 PM
I'm developing a LabVIEW application that uses a myRIO to control a number of custom boards, largely using DIO lines on the myRIO to control SPI chips. Things are going well, and I'm now trying to build an Executable that will run as a Start-up Application on the myRIO, so when the myRIO is turned on, it auto-runs the RTexe, which starts "listening" for the Host to establish Network Streams with it, and then off they go. And when the Host shuts down, it tells the myRIO to reboot, which is supposed to bring it up again (after about 30-40 seconds) for a possible subsequent run.
I've built RTexe's before, but on PXI systems running PharLap. This is my first attempt with NI Linux Real-Time. I'm running LabVIEW 2019 (32-bit), with myRIO Firmware Version 7.0.0f0, myRIO Toolkit 19.0.0, LabVIEW Real-Time 19.0.0, etc.
So I went to build an Executable. The process is similar to what I used with Pharlap, but slightly different. There is no .ini file that specifies the name of the startup executable (by default, startup.rtexe), and the distinction of the "Set as Startup" vs "Run as Startup" was missing (I vaguely recall using "Run as"), but otherwise it felt "familiar".
Unfortunately, it failed to run on rebooting the myRIO. I had written a little Test routine that did nothing more than flash the myRIO's 4 LEDs at 1 Hz, and this was deployed as startup.rtexe.
When the myRIO was restarted from the Project Manager, it went through its 20" shutdown routine, rebooted, produced the (annoying) byRIO USB Monitor window (I chose "Do Nothing"), did "something" (I could see the WiFi light flashing occasionally) for about 20-30", then nothing -- two steady myRIO lights (Power and WiFi), no flashing LEDs.
Note that running this routine from within the Project (i.e. clicking on the Top-Level VI, opening its Front Panel, and clicking the Run arrow) causes an immediate Deploy (2") and then the myRIO's LEDs start to flash.
I noticed that this exercise creates a series of files on my PC that bear a resemblance to the File Tree that I think is built on the myRIO -- TEST_RTexe\home\lvuser\natinst\bin\startup.aliases and startup.exe, though I'm not sure why they are present on the Host.
There is a "walkthrough" video from about 7 years ago that shows how to do this in the myRIO, whose steps I followed, but my Executable didn't start.
One final (related) question -- I'd like to use the myRIO in this application, but really would like to avoid the myRIO USB Monitor popping up when the myRIO reboots. Is there a way to shut this off? Ideally, the myRIO would reboot (silently), initialize itself, and then start executing the LabVIEW Real-Time Executable I marked as the Startup Executable. [Extra points for letting me know if the name of the Executable is stored somewhere on the myRIO so I can do what I did with the PXI, have 3-5 Executables (all with .rtexe extensions) and set the myRIO to run the one that I want (in the PXI case, it involved changing a .ini parameter).
Bob Schor
Solved! Go to Solution.
06-28-2021 09:41 PM
The Last shall be First --
@Bob_Schor wrote:
I'd like to use the myRIO in this application, but really would like to avoid the myRIO USB Monitor popping up when the myRIO reboots. Is there a way to shut this off?
Well, the simple way to avoid the myRIO USB Monitor is ... don't connect via USB. Duh ... A WiFi connection means when the myRIO reboots, the USB PopUp doesn't Pop Up.
So why doesn't the built myRIO Target Code work as an RT Startup Executable? Why doesn't it "Start Up"? I don't (yet) know. However, if I build a "Baby Demo" LabVIEW Real-Time routine, one without Network Streams, without a significant custom FPGA module, the Real-Time routine starts and runs. So it may well be something simple I'm forgetting to do (oooh, I think I may know what this is ... stay tuned, I'll do some more testing tomorrow after I get a good night's sleep and well return here with what I hope is a Solution ...).
Bob Schor
06-29-2021 12:51 AM
We are happy to be your rubber ducklings Bob 🙂
06-29-2021 10:11 PM
This is so embarrassing! I have a fairly large, complex LabVIEW Real-Time Project that involves controlling a isolated Pulse Train generator built around a motherboard holding 15 independent Current generators containing 5 SPI chips apiece, providing up to 16 current sources and sinks. Managing all this is a tiny myRIO that "plugs in" to the Motherboard and provides the SPI signals to drive all these chips.
So once I had a LabVIEW Real-Time Project that showed we could (in principle) generate the stimuli we needed (using the prototype Motherboard, 2 of the 15 daughterboards, and 4 of the 16 Current-measuring Boards), I decided to move the LabVIEW Real-Time part of the Project (with custom FPGA code that enabled us to acquire 16 Current and 16 Voltage channels at burst speeds of 10 kHz) from being deployed to the myRIO every time we ran the Host + Real-Time Target code, deploying it to the Target, to being a compiled Real-Time Executable deployed to the myRIO as its Start-up routine.
Did I start with a "tiny" Real-Time code, compile it into an Executable, and try it out? No, I took my entire myRIO Target code, compiled it (so far, so good), deployed it as the myRIO startup.rtexe, and tried it out. Hmm, why didn't the FPGA start running? Why can't the Host connect to the Network Streams "that should have been listening" in the myRIO? Why can't I get the myRIO back to the state it was in before I started testing with Executables? Why can't I get rid of the myRIO USB Startup that "looks like" it might be interfering with the myRIO starting its code startup?
I solved the last piece first -- get rid of the USB cable, start using WiFi, and presto, when the myRIO starts up, you don't hear the "USB sound" and don't get the pop-up that says "I see a myRIO, what do you want to do with it?".
Unfortunately, while struggling with building my fairly large RT Project code into an Executable, I appear to have done something foolish with the myRIO firmware, because I discovered I could no longer run in "Development Mode". Fuss, fuss, fuss, give up and rebuild the myRIO with new Firmware, new myRIO Toolkit (2019, with LabVIEW 2019, as there is no myRIO Software Toolkit 2020, but I expect to see a 2021 Toolkit).
So I made Real-Time Program for my Project that consisted of loading the FPGA (which has a little routine that "blinks" a Version code, a number from 1 to 15, binary 0001 to 1111, in the myRIO's LED lights), waits 10 seconds, then tells the myRIO to reboot. Granted, this doesn't do very much -- if installed as a Startup routine for the myRIO, the myRIO should start up, blind a pattern (currently the number 12) in the LEDs, reboot, and repeat.
And that's just what happened (and is still happening, as I haven't shut it off by turning off the myRIO). I'm hoping I'll be able to stop it by re-opening the Project and "unset as Startup" for this Executable.
So things are, indeed, working as advertised. Not sure what silly move I made that scrambled the myRIO software/firmware, but I'll try not to do it again.
It's hard to call this a "solution", as there is probably no problem here, only the advise to "start with a little Executable" to get your feet wet with less likelihood of doing something silly when building and deploying it.
Bob Schor
P.S. -- nope, not done yet! I just tried to "unset as Startup" my little Test routine and it failed to deploy. So I pulled the power plug from the myRIO, and will tackle the problem of this "Sorcerer's Apprentice" tomorrow morning. I sure hope I don't need to re-install the myRIO software again ...
06-30-2021 02:40 PM
OK, after more False Starts than I'd like to admit, I finally (think I) have the myRIO Executable story understood.
Lesson #1 -- the Tutorial on the Web by Prof. Ed Doering (from Rose Hulman Institute of Technology) is very clear, and 100% correct. Somehow, I managed to mess things up (probably because I remembered "doing it slightly differently on a PXI system 8 years ago").
Anyway, first make sure you have working code for myRIO. Generally when you deploy something to a RT Target, you intend for it to always be there and to start running when the Target is powered up (it "boots" directly to your application). You need to think about what you want to do when (or if) the Application stops running.
In the Target section of your RT Project, go to Build Specifications and choose "New", "Real-Time Application". Fill in the name of your Build Spec (I suggest using the name of the Startup VI). For now, leave the rest of the options at their Default values (the Local destination directory will use the Build Spec name you just chose). Feel free, however, to enter a Build Spec description in the bottom box.
Source Files -- find the Top Level VI and "click it" over to Startup VIs. That should be all you need.
Source File Settings -- should be OK. If you want, find your Startup VI and open Customize VI Properties -- make sure "Run when opened" is checked.
Advanced -- uncheck "Copy Error Code files" unless you are using multiple languages.
Preview -- I suggest you Generate Preview. You should see two files, "startup.aliases" and "startup.rtexe" being generated. If you didn't uncheck "Advanced", you'll see additional Error files in 5 additional languages..
Click Build. LabVIEW will build your Executable.
Now you need to do two things -- tell the myRIO that your Executable should be set as the Startup when the myRIO boots (called "Set as Startup"), and then you need to Deploy it to the myRIO. [This, I think, is where I went awry. I'm about to do what I write here, so wish me luck ...]. Select the Build Specification, right-click, and choose "Set as Startup. Right-click again and choose Deploy. Once it has deployed, reboot the myRIO. It should load and run your Executable. If this is the first time you've tried this Executable, I recommend that you not make it "reboot on exit", lest you get trapped in the "Sorcerer's Apprentice" nightmare I encountered. [Oh, great -- I get "An error occurred while attempting to reboot the target." when I ask Project Manager to reboot. What happens when I disconnect/reconnect the power? Good News -- it goes through its (slow, about 30") power-on routine, WiFi comes alive, and shortly after, my program runs, then stops (I can tell because the Program blinks the LEDs).
If you now open the Build Spec, you can see that you now have the option to "Unset as startup". You also need to Deploy again to "inform" the myRIO of your choice. [This time, the Reboot request from the Project Manager went through without trouble] Yes, that worked, the LEDs are not blinking.
I'm going to mark this (now) as a "Solution", even though Prof. Doering "said it first, and said it better", but if you're searching the Forums for an answer, this might be helpful ...
Bob Schor