Minimizing System Off current when using PWM

I'm developing with an nRF52832, NCS v2.6.1 and Zephyr 3.5.99

I've been forcing my MCU into System Off when I don't need it to do anything, then triggering it out of that state with a GPIO signal. That's working OK and I'm getting sub-uA current drain in my nRF52.

Ive just added Stepper motor control functionality using the pwm0 device, and am now noticing significant current (in the mA range!) of current during System OFF.

Do I need to explicitly disable the pwm0 device prior to calling sys_poweroff()?

if so, how do I do this when I'm using 4 channels on pwm0. I've got these predefined in my .dts file for my custom board.

Thanks,

Mike

Parents
  • Hello Mike,

    GPIO configurations are retained in System OFF mode, so an PWM output can continue to drive the output high or low in this state. Depending on what it is connected to, this may lead to excessive current draw. To stop the PWM and bring the GPIOs back to their default reset state, you can use the power management suspend task just before calling sys_poweroff().

    In your prj.conf

    ...
    CONFIG_PM_DEVICE=y

    Add suspend task before sys_poweroff():

    	...
    	/* Disable PWM and reset GPIO configuration */
    	err = pm_device_action_run(<pwm dev>, PM_DEVICE_ACTION_SUSPEND);
    	if (err) {
    		LOG_ERR("Could not suspend PWM (%d)\n", err);
    	}
    	
    	sys_poweroff();
    	
    	

    Best regards,

    Vidar

Reply
  • Hello Mike,

    GPIO configurations are retained in System OFF mode, so an PWM output can continue to drive the output high or low in this state. Depending on what it is connected to, this may lead to excessive current draw. To stop the PWM and bring the GPIOs back to their default reset state, you can use the power management suspend task just before calling sys_poweroff().

    In your prj.conf

    ...
    CONFIG_PM_DEVICE=y

    Add suspend task before sys_poweroff():

    	...
    	/* Disable PWM and reset GPIO configuration */
    	err = pm_device_action_run(<pwm dev>, PM_DEVICE_ACTION_SUSPEND);
    	if (err) {
    		LOG_ERR("Could not suspend PWM (%d)\n", err);
    	}
    	
    	sys_poweroff();
    	
    	

    Best regards,

    Vidar

Children
No Data
Related