11-25-2018 11:35 PM - edited 11-25-2018 11:39 PM
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
11-26-2018 01:22 AM
Did you try steps mentioned in below answer record?
Don't forget to reply, kudo, and accept as solution.
11-26-2018 01:36 AM
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
11-26-2018 05:26 PM
I experienced the same issue and dug into it a little. Here is what I found:
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:
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!
11-26-2018 08:39 PM
AR is ready that should be release by this week.
11-26-2018 10:21 PM - edited 11-27-2018 03:10 AM
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.
P.S. I have updated this post with some further detail that I found to be necessary after running a petalinux-build -x mrproper.
11-26-2018 10:29 PM
Thanks very much for all the info, very good of you.
I don't think I would have worked that lot out!
11-27-2018 08:33 AM
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.
11-29-2018 03:07 PM
Here is the AR https://www.xilinx.com/support/answers/71722.html with patch.
12-01-2018 12:55 AM
I have applied this patch.
The button now signals a shutdown but the board still does not power down.
12-01-2018 08:10 AM
some more info:
shutdown -h -P powers the board off correctly.
The button also powers the board off sometimes, intermittently it stays powered up.
12-02-2018 07:28 PM
Avnet requested for below shutdown use case and patch is based works for below use case
12-03-2018 09:45 PM
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.