Zephyr PWM and GPIO in System Off

Hi,

I am developing on a nRF52840dk. I control a LED2 (line P0.14) with PWM in normal operation and want to leave the LED2 ON when I go to System Off mode.

I tried setting the line to constant active with the Zephyr PWM driver by setting the pulse equal to period.

I tried setting the line to constant inactive with the Zephyr PWM driver by setting the pulse equal to 0 and then setting the active level with the GPIO driver.

In both cases the LED was off after going to System Off.

I can't find any obvious way to do what I want.

Parents Reply
  • Hi,

    Looks like it's the device driver Power Management implementation that sets the pin to this state as part of the process of going into System Off mode. I haven't tested it, but something like this might work to avoid that:

    1) ret = pm_device_action_run(pwm, PM_DEVICE_ACTION_SUSPEND); // unit the PWM
    2) ret = pm_device_state_lock(pwm); // Lock the PWM DEVICE

    3) Use GPIO API to set the pin as you like

    4) Enter system off mode

Children
Related