LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Powering off a cRIO

Solved!
Go to solution

Normally my method of powering down a cRIO is just to kill the power seeing as they are always embedded devices. Never given it any consideration despite the fact it certainly wouldn't be my first choice for a Windows machine.

 

Operating cRIO's like this has never caused me any problems but I am now looking at developing a system to run as a datalogger for long periods of time (years), regularly turning off and on, min once per day, probably much more regularly. Should I make any considerations for things like file handling to ensure that the file system doesn't become corrupted when the power is disconnected.

 

Should I even trigger a soft shutdown before disconnecting the power? If so how do people actually implement that on the electrical side? The only thing I can think is a soft power button with a timer relay of some sort.

0 Kudos
Message 1 of 7
(152 Views)

Yes you should. It is a full blown Linux OS after all and while it is less susceptible to system file corruptions from a hard shutdown by yanking out the power under its feet, it is not entirely impossible to catch it in the middle of some important system state update, which leaves the stored system state in an inconsistent configuration. We definitely have seen cRIO chassis go into a non-operable mode after power failure.

 

Now there is a bit of a problem about this however. The NI System Control API does have a function to restart a controller but not one to shut it down. Calling the reboot() function in libc.so with the appropriate command value doesn't work since the LabVIEW RT app is not operating as root. reboot() simply returns with a NO_PERM error.

 

What is likely to help is to at least call libc:sync() and waiting a few seconds before yanking the power.

Rolf Kalbermatter
Averna BV
Message 2 of 7
(127 Views)

Just to make sure I understand correctly:

- I should ensure the system is in a safe state before pulling the power

- There is no method of shutting down the Linux OS from a RT app

- The best I can do is write all file caches to disk and then pull the power

 

As I said in my first post, the reality of doing that from an electrical point of view is a bit of a pain for a system which effectively is running headless isn't it. I would need to have some relay magic with a soft shutdown button which tells the cRIO to shutdown safely before actually killing the power. Is it worth the effort? If you have had problems in the past I suspect so for something which is going to be operating remotely and unattended for years potentially

0 Kudos
Message 3 of 7
(110 Views)

@Niatross wrote:

Should I even trigger a soft shutdown before disconnecting the power? If so how do people actually implement that on the electrical side? The only thing I can think is a soft power button with a timer relay of some sort.


Can you spell "Watch Dog"?  I'm doing Software development for a device that has a RIO inside it running the "Target" side of a LabVIEW RT Project.  The Project Supervisor (who is more experienced than I) was concerned about the Real-Time code getting "hung" (particularly during Shut Down, as there are many parallel loops, including in the FPGA, that need to be shut down, which doesn't, yet, always happen), and insisted I put a "Watch Dog" routine in the Remote code.  The module that governs the Power to the RIO goes through a little Chip that does the following:

  • When Power On is pressed, provide 12V for 45" to the RIO to allow it to boot up and start running its Deployed RT Code.
  • The RT code starts a Parallel Loop that toggles a DIO output from the RIO (thereby communicating with the FPGA) to produce a 10 Hz TTL square wave (I'm not 100% certain of the frequency, but that's the right ball park).
  • This goes to the "Watch Dog" circuit in the Power Unit, which after 45", requires seeing a changing TTL input to reset its "Count-down" clock.  If the Clock counts down to 0, it kills the Power to the RIO (because it detects that the Watch Dog has failed, either because the FPGA stopped running or the Real-Time loop in the RIO that was supposed to drive the DIO line in the FPGA was hung).  This turns off the power to the RIO.

So how does this work?  We simply add the Reboot command at the end of the RIO code.  While this does not "power off" the RIO, it does stop the code currently being executed (in order to run the Boot code).  This, in turn, stops the FPGA and the Real-Time code, stopping the Watch Dog and causing the Watch Dog circuit in the Power unit to kill the power.  [Fortunately, my colleague knew how to build the circuit, and where to find the Chip.  I only had to figure out how much time we needed at Power Up time ...].

 

Bob Schor

0 Kudos
Message 4 of 7
(107 Views)

I can see how I could make that work. Is it worth the effort though? I have never had a problem before, and I am guessing it isn't a common issue due to the lack of forum posts.

 

The only posts I can find are:

https://forums.ni.com/t5/LabVIEW/cRIO-9068-config-file-corruption-on-power-loss-best-practices/td-p/...

and this KB article suggesting using a UPS

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000wxA6CAI&l=en-GB

 

Am I worrying about nothing here or should this sort of thing become a part of my standard design for a cRIO system.

0 Kudos
Message 5 of 7
(85 Views)
Solution
Accepted by topic author Niatross

@Niatross wrote:

 

Am I worrying about nothing here or should this sort of thing become a part of my standard design for a cRIO system.


It depends on your requirements. If you absolutely require that system to always start up, never fail and can't tolerate that it may be out of operation for days or weeks because you have to take it out and completely reformat and reinstall it or in the worst case RMA it to NI, then yes an UPS and/or more safe shutdown procedure is absolutely mandatory. Issues are rare and far in between but do happen for sure as we have seen ourselves.

 

If you can tolerate that the system may have to be taken out and completely reset and reinstalled then no you can continue as is. It may happen but it can go fine for years to come too.

Rolf Kalbermatter
Averna BV
0 Kudos
Message 6 of 7
(80 Views)

Thanks for the input. I will consider it for the next system I am designing

0 Kudos
Message 7 of 7
(73 Views)