Keeping imx8mp leds on in sleep mode

I’m using an IMX8mp in our device. We’re planning to use the PWM LED on the IMX8mp to provide a basic UI. These LEDs are required to be visible in sleep mode.
I’m under the imopression we need to change the clock source to either osc_23k or osc_24m as this are available when in sleep mode. The issue I’m not sure how. I have tried

&pwm2 {
status = “okay”;
pinctrl-names = “default”;
pinctrl-0 = <&pinctrl_pwm_red>;
clocks = <&osc_32k 0>, <&osc_32k 0>;
clock-names = “ipg”, “per”;
};
Finding in the magic in the settings has alluded me.
Anythoughts, hint or suggestion on how to achieve this.

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello,

To keep the PWM LED on your iMX8MP device active during sleep mode, you need to ensure that the PWM is sourced from a clock that remains active in this state. Typically, the osc_32k or osc_24m clocks are used for this purpose as they are available during low-power modes.

Here’s a step-by-step guide to help you achieve this:

  1. Modify the Device Tree: Locate the PWM node you are using in your device tree source file (e.g., &pwm2).

  2. Set the Clock Source: Update the clocks property to use a clock that remains active in sleep mode. For example:

    &pwm2 {
        status = "okay";
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_pwm_red>;
        clocks = <&osc_32k>, <&osc_32k>;
        clock-names = "ipg", "per";
    };
    

    Ensure that the clock source you choose is indeed available during sleep mode.

  3. Recompile the Device Tree: After making changes, recompile the device tree and deploy it to your device.

  4. Test the Configuration: Verify that the PWM LED remains active when the system enters sleep mode. You can use tools like multimeters or oscilloscopes to check the PWM signal.

  5. Confirm Clock Availability: Double-check that the selected clock source is configured to remain active during sleep mode. This might require additional configuration depending on your specific hardware setup.

By following these steps, you should be able to keep the PWM LED active during sleep mode on your iMX8MP device. If you encounter any issues, ensure that the device tree configuration is correct and that the clock source is available during low-power states.

Best regards,
Toradex AI Assistant.

Please, also check if these links can help you solve your problem:

iMX8MP on Mallow Carrier detection problem.

Using either osc_24m or osc_32k caus the esystem to reboot whilst loading the kernel

Hi @DuncanNapier !

Your idea of using a clock that is available even during sleep makes sense.

You will need to find a clock that (A) is not disabled and (B) can be routed to PWM.

For (A), seems like the chapter 5.2 of the reference manual is useful.

For (B), you can check Figures 5-1 and 5-2 and Table 5-2 of the reference manual

Reference Manual is available at i.MX 8M Plus | Cortex-A53/M7 | NXP Semiconductors

Also, seems like there is the possibility to use an external clock (EXT_CLK_1 - IMX*MP_CLK_EXT1 on the device tree). But I have never done it, so I am not sure if it will “just work”.

Another possibility you could consider is to add an external PWM generator on your carrier board, which could be controlled by the module, but wouldn’t stop when the module goes into sleep mode. Would this be a potential way out for your case?

Best regards,