recommendations on controlled shutdown?

Can anyone give some recommendations on clean power-off / shutdown for Xavier?

short of just cutting power to the Xavier and risk file-system corruption, what are the recommended mechanisms to do a clean controlled shutdown in an in-vehicle system when ignition is turned off ?

What access do you have? If ssh, then connect via ssh, then:

# To halt:
sudo shutdown -h now
# To reboot:
sudo shutdown -r now

Although the ext4 is journaled, if you have something on the SD card, e.g., VFAT, it might not do as well. I would never suggest not using a clean shutdown, but most unrecoverable errors would be to an external storage. Also, file system checking and tools for VFAT have to be added separately.

I am asking about when the xavier is running in a vehicle and whats the best practice around clean shutdown when the vehicle is turned off…

i.e. the vehicle operator wont have ssh or any other access to it and for that matter wont even know or care that there is a linux box running… the idea is to gracefully shutdown on ignition off…

right now its just a hard power off, but id like to avoid that.

Hi koosdupreez, I think you would want to have some backup battery or Uninterruptible Power Supply (UPS) that your electronics / Jetson are powered from so that you can perform a graceful shutdown when the vehicle is powered down.

Thanks!

I have a hard time believing you would have to install a UPS or backup battery on vehicles to run embedded systems.

typically these systems run off the vehicle battery power and hooked up to ignition and when you sense ignition is turned off, you do a graceful shutdown adn vice versa.

or is the guidance from nvidia toe OEM to develop a carrier board that has its own battery onboard ??

If you have a battery source already available on the platform, then yes certainly you can utilize that as opposed to needing a separate battery just for the Jetson. Just make sure you use a voltage regulator inline with the Jetson and battery source if there is a risk of the input power being outside of the Xavier module’s 9.0V - 20.0V acceptable voltage range.

Great - so back to my question…

When the ignition is turned off - what are the recommended mechanisms to gracefully shutdown the Xavier.

i.e. are there any power sense lines that will initiate a shutdown or do we need to implement that manually ourselves and also write scripts to initiate a power down when ignition gets turned off?

You would need to sense when the ignition is turned off and seamlessly switch over to battery power (if that switch-over isn’t done automatically). If the Jetson were to lose power, it would not have the time to shutdown gracefully itself. You would need to detect the pending shutdown condition, exit your running applications, and run the “sudo shutdown now” Linux command to gracefully shutdown the system.

If this is an automotive vehicle, perhaps you can utilize CANbus or an ODB-II interface to see from the Jetson when the ignition has been turned off?

I would guess koosdupreez has something slightly different in mind. The setup would be to feed in both switched and unswitched power. The switched power line would act only as a signal for the unit to boot and would act as a signal when off for the Xavier to shut down gracefully. The unswitched power would be used to power the device.

With the Xavier’s IO, you should be able to connect switched power to a level shifter and use it as a signal to shutdown. I’m not sure how you would use it to resume(boot) though when switched power is turned back on.

Similar to Dusty’s CANbus idea. That is a good idea for triggering when to shutdown, but how does the system know to turn back on when CAN traffic resumes?

I’d set it up to always boot when switched power exists, but then switch to non-switched power (a tongue twister). Once on non-switched power you’d need to create a method to call the orderly shutdown when sensed for loss of switched power (for example, a GPIO might be able to be customized for that, or similar via CAN if shutdown status is already available on that bus).

The corner case would be that if someone starts the system, but stops before booted, then the Jetson would need to know to shut down after it boots up (a shutdown event occurring prior to completion of start would still need to be accounted for).