cancel
Showing results for 
Search instead for 
Did you mean: 

How to drive an output GPIO as HIGH even during sleep / suspend ?

Dinesh K
Associate

Hi ST Community,

We are using STM32MP157C-DK2 board and OpenSTlinux Firmware (v3.1-Openstlinux-5-4-dunfell-mp1-20-11-12) for our development. We have a requirement to drive the Blue LED (LD8) always ON even during sleep / suspend. Currently the GPIO PD11 connected to the LED becomes LOW when we issue "systemctl suspend" command in Linux.

Below is the DTS snippet:

     led {

        compatible = "gpio-leds";

        led-blue {

            label = "heartbeat";

            gpios = <&gpiod 11 GPIO_ACTIVE_HIGH>;

            linux,default-trigger = "heartbeat";

            default-state = "off";

            retain-state-suspended;

        };

    };

3 REPLIES 3
Uwe Bonnes
Principal III

Use an external transistor to drive the LED. Static switch on the transistor by a pullup. To switch off, use the GPIO to short the Base/Gate to ground with GPIO as open Drain, switched low.

Is it actually low or just floating. You could reverse the sense of the diode and connect to VCC rather than GND, and then it would illuminate in the LOW case.

People tend not to have LEDs on or pull ups as these leech current, which you're typically looking to avoid.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
PatrickF
ST Employee

Hi,

Above answers from @Uwe Bonnes​ and @Community member​ are valid, an external pull-up resistor and a transistor are usually required if you want to have a LED forced ON by default. Note that LED will also be ON during platform reset/startup (otherwise, might need a much more complex circuitry which sound overkilling for just a LED).

I confirm that on most STM32 (including the STM32MP1 series), whenever the VDDCORE is shutdown, all the GPIOs are forced in High-Z (except obviously those which do system control and those related to backup domain such are TAMP, RTC, etc... when enabled).

To avoid a transistor, it might be possible to add a second drive pin for the LED (up to few mA like other GPIOs) by ANDing PWR_ON pin and the heartbeat GPIO using diode(s). PWR_ON signal is driven LOW in system Standby mode, even if VDDCORE is shutdown.

Need to have the LED active-low, i.e. connected to VDD.

This is just an idea, to be checked for potential side effects.

Regards,

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.