UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer andycap
Observer
1,196 Views
Registered: ‎09-18-2017

Ultra96 BSP - Power Off not working

Hi Guys,

 

On the petalinux that is supplied with the Ultra96 board pressing the power button will signal it to shutdown cleanly and power off.

When building from the BSP though this doesn't work, also shutdown (-h -p) doesn't power the board down and poweroff also doesn't power the board down.

The only way to power the board off is to shutdown and then hold the power button down for 10 seconds.

Does anyone know how to get power off functionality working?

Many thanks for any help

 

Andy

 

0 Kudos
14 Replies
Moderator
Moderator
1,172 Views
Registered: ‎06-27-2017

Re: Ultra96 BSP - Power Off not working

Hi @andycap,

 

Did you try steps mentioned in below answer record?

https://www.xilinx.com/support/answers/68514.html

 

Regards
Kranthi
--------------------------
Don't forget to reply, kudo, and accept as solution.

Best Regards
Kranthi
--------------------------
Don't forget to reply, kudo, and accept as solution.
0 Kudos
Observer andycap
Observer
1,165 Views
Registered: ‎09-18-2017

Re: Ultra96 BSP - Power Off not working

Hi Kranthi,

 

Thanks very much for the link, I will have a closer look later.

Would this stop the power button starting the shutdown though?

On the default image pressing the button starts a shutdown, on the image built from the BSP pressing the button does nothing.

 

Many thanks for your help

 

Andy

0 Kudos
Highlighted
Visitor kellyjp
Visitor
1,141 Views
Registered: ‎04-26-2018

Re: Ultra96 BSP - Power Off not working

HI Andy,

I experienced the same issue and dug into it a little.  Here is what I found:

  1. The Ultra96 board uses a LTC2954 push button controller to power the board on and off.
  2. There are 2 connections between the ZynqMP and the LTC2954.  The interrupt output of the LTC2954 is connected to MIO26 and the power kill input to the LTC2954 is connect to MIO34.
  3. The 2018.2 Ultra96 BSP Vivado project configures the ZynqMP to connect MIO26 to PMU GPI 0 and MIO34 to PMU GPO 2 respectively.
  4. There is code in the Xilinx provided PMU firmware to interact with the LTC2954 (see pm_core.c) that can be activated using appropriate compiler defines.  However this code appears to have been disabled in the 2018.2 Ultra96 BSP.  The commit that disabled these defines when building the PMU firmware can be found at:

https://github.com/Xilinx/meta-xilinx-tools/commit/93d6b87bdc451ee81d6d716809e0d7e9bc3b7021

This appears to be the root cause of the shutdown button not working in the 2018.2 BSP even though it works with the Petalinux installation that ships on the SD card that comes with the Ultra96 board - I suspect the code that ships with the Ultra96 board was built before this commit was added to the meta-xilinx-tools Yocto layer to disable the power button functionality.

Interestingly the Ultra96 BSP also includes code that runs on the application processor (i.e. Linux) that attempts to interact with the LTC2954.  This code can never work with the BSP as shipped because the the MIO26 and MIO34 pins are connected to the PMU rather than the GPIO peripheral in the Vivado project.  There are 2 pieces of code that are relevant:

  1. A daemon that listens to the GPIO port that would normally be associated with MIO26 and invokes the "poweroff" Linux command when it gets the interrupt from the LTC2954.  This daemon is provided in the "ultra96-power-button" package.
  2. A kernel device driver that attempts to hook into the kernel power off API and send the kill signal to the LTC2954.  This is done by the LTC2952 device driver (which also supports the LTC2954).

As an experiment I changed the Vivado project to connect MIO26 and MIO34 to GPIO 26 and GPIO 34 instead of the PMU.

When you do this the ultra96-power-button daemon does indeed detect the interrupt from the LTC2954 and does invoke the poweroff command.  However, it does not power off the board.  Looking at the kernel log it seems as if the LTC2952 driver doesn't load properly.

Thats as far as I got before deciding I could put up with holding down the button for 10 seconds to power it off when the noise annoys me!

James

0 Kudos
Moderator
Moderator
1,129 Views
Registered: ‎04-24-2017

Re: Ultra96 BSP - Power Off not working

Hi @andycap@kellyjp,

AR is ready that should be release by this week.

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
0 Kudos
Visitor kellyjp
Visitor
1,121 Views
Registered: ‎04-26-2018

Re: Ultra96 BSP - Power Off not working

Hi @andycap@sandeepg

I just did another experiment by changing the 2018.2 Ultra96 BSP Vivado project so that MIO26 is connected to GPIO 26 and MIO34 is connected to PMU GPO 2 (with polarity high) i.e. the interrupt output of the LTC2954 is accessible to Linux, but the kill input to the LT2954 is controlled by the PMU.  Note that the polarity is important.  If set to low (the default) the board powers off as soon as you try to power it on.

I also re-enabled some of the code that was disabled in the commit I referenced in my earlier post by creating the file project-spec/meta-user/recipes-bsp/pmu-firmware/pmu-firmware_%.bbappend with the contents:

YAML_COMPILER_FLAGS_append_ultra96-zynqmp = " -DBOARD_SHUTDOWN_PIN=2 -DBOARD_SHUTDOWN_PIN_STATE=0"

I can now successfully power off the Ultra96 when running the 2018.2 BSP.

When the power button is pressed the daemon running under Linux detects the interrupt from the LTC2954 and invokes the Linux poweroff command which does an orderly shutdown of Linux (unmount file systems etc.).  Once Linux has finished its orderly shutdown the PMU sends the kill signal to the LTC2954 to power the board off.

This solution does not use the PMU GPI 0 which appears to be incompatible with active low interrupts if the the commit I referenced in my original post is to be believed.  The append to the pmu-firmware recipe only enables the code relating to driving the PMU GPO 2 output and not the code relating to PMU GPI 0 input.

James

P.S. I have updated this post with some further detail that I found to be necessary after running a petalinux-build -x mrproper.

0 Kudos
Observer andycap
Observer
1,116 Views
Registered: ‎09-18-2017

Re: Ultra96 BSP - Power Off not working

Hi James,

Thanks very much for all the info, very good of you.

I don't think I would have worked that lot out!

Many Thanks

Andy

 

0 Kudos
Observer andycap
Observer
1,115 Views
Registered: ‎09-18-2017

Re: Ultra96 BSP - Power Off not working

HI James

Our posts crossed!

I will make those changes and see how it goes.

Once again thanks!

 

Andy

0 Kudos
Moderator
Moderator
1,076 Views
Registered: ‎04-24-2017

Re: Ultra96 BSP - Power Off not working

Hi @kellyjp,

Your solution is ok but shutdown is not a graceful in this case see below description. Please wait for AR with patch as we are testing this in 2018.3 internal builds and we have shared this patch Avent team and they also running some integration test on 2018.2 builds this week.

Ultra96 has a power button controller LTC2950 which generates an active low interrupt on MIO26 whenever the power button is pressed. Since PMU GPI (connected to MIO26) only supports positive edge triggered interrupts, it is not possible to reliably capture the power button press event. So, we choose to capture the button press event by polling for the GPI pin state at regular intervals. When a LOW state is detected on the pin, system shutdown process is initiated. As per the datasheet, LTC2950 generates an active low pulse of minimum 26ms duration. So, to ensure we capture the event reliably, a scheduler task that runs every 10ms is added to check for the pin state and initiate shutdown. With Ar we have a patch that adds Ultra96 module which implements this functionality and is enabled by defining -DENABLE_MOD_ULTRA96 flag. It depends on scheduler feature which needs to be enabled -DENABLE_SCHEDULER.

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
0 Kudos
Moderator
Moderator
1,012 Views
Registered: ‎04-24-2017

Re: Ultra96 BSP - Power Off not working

Hi @kellyjp@andycap,

Here is the AR https://www.xilinx.com/support/answers/71722.html with patch.

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
0 Kudos
Observer andycap
Observer
999 Views
Registered: ‎09-18-2017

Re: Ultra96 BSP - Power Off not working

Thanks Sandeep.

0 Kudos
Observer andycap
Observer
977 Views
Registered: ‎09-18-2017

Re: Ultra96 BSP - Power Off not working

Hi Sandeep,

 

I have applied this patch.

 

The button now signals a shutdown but the board still does not power down.

 

Any ideas

 

Thanks 

 

Andy

0 Kudos
Observer andycap
Observer
947 Views
Registered: ‎09-18-2017

Re: Ultra96 BSP - Power Off not working

some more info:

 

shutdown -h -P powers the board off correctly.

 

The button also powers the board off sometimes, intermittently it stays powered up.

 

 

0 Kudos
Moderator
Moderator
915 Views
Registered: ‎04-24-2017

Re: Ultra96 BSP - Power Off not working

Hi @andycap,

Avnet requested for below shutdown use case and patch is based works for below use case

  1. Turn off board completely using matchbox gui shutdown power button press.
  2. Using "shutdown" command from linux console terminal.
  3. On pressing "power button" (single press) on board it should shutdown.
Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
0 Kudos
Observer andycap
Observer
891 Views
Registered: ‎09-18-2017

Re: Ultra96 BSP - Power Off not working

Hi Sandeep,

 

Thanks for the reply.

What I am trying to say is that it doesn't always work.

On my board, maybe 20% of the time the board does not power off when pressing the power button.

 

Many thanks 

Andy

0 Kudos