cancel
Showing results for 
Search instead for 
Did you mean: 

Enabling PWM using LPTIM that works on low power mode - STM32MP1

ARama.1
Associate II

Hi,

We're using STM32MP157FAA1 for our products. our kernel version version is 5.15 & dunfell Yocto. 

Our system requirement is to enable a pwm using lptimer [ PD13 ] that serves even in low power mode. 

below are our queries:

1. As we understood it needs LSI/LSE to be enabled. is it correct? if it is so, should the clock be exposed via TFA? 

2. Our changes are as below & attached. but still we dont see PWM generated & we see below error in console dmesg. 

 

root@e40-guadalupe-v2:~# dmesg | grep -i failsafe
[ 1.371396] failsafe-clock fail-safe-clk: PWM not available (-22), trying GPIO mode

 

kernel changes: 

 

/* Failsafe clock using LPTIMER1 PWM with LSE for stop mode */
/* Falls back to GPIO if PWM not available (TF-A not updated yet) */
fail_safe_clk: fail-safe-clk {
compatible = "lennox,failsafe-clock";
/* LSE @ 32.768kHz: 100Hz = 327.68 cycles ≈ 10.01ms period */
pwms = <&lptimer1 0 10010000 0>;  /* Channel 0, ~10ms period (100Hz), 50% duty */
pwm-names = "failsafe";
/* GPIO fallback for testing without TF-A update */
clock-gpios = <&gpiod 13 GPIO_ACTIVE_HIGH>;
clock-period = <10>;  /* 10ms period for 100Hz */
clock-width = <5>;    /* 5ms pulse width (50% duty cycle) */
lennox,maintain-state-during-suspend;
status = "okay";
};
 
&lptimer1 {
/* Configure LPTIMER1 for failsafe clock - LSE for stop mode operation */
status = "okay";
 
/* Use LSE (32.768kHz) - active in stop mode, powered down in standby */
clocks = <&rcc LPTIM1_K>;
clock-names = "mux";
assigned-clocks = <&rcc LPTIM1_K>;
assigned-clock-parents = <&rcc CK_LSE>;
 
pinctrl-names = "default", "sleep";
pinctrl-0 = <&lptim1_out_pin>;
pinctrl-1 = <&lptim1_sleep_pin>;
 
pwm {
status = "okay";
};
};
 
lptim1_out_pin: lptim1-out-pin {
pins {
pinmux = <STM32_PINMUX('D', 13, AF1)>;  /* LPTIM1_OUT on PD13 */
bias-disable;
drive-push-pull;
slew-rate = <0>;
};
};
 
lptim1_sleep_pin: lptim1-sleep-pin {
pins {
/* Keep AF1 configuration in sleep/stop to allow PWM to continue */
pinmux = <STM32_PINMUX('D', 13, AF1)>;
bias-disable;
drive-push-pull;
slew-rate = <0>;
};
};
 
TFA changes to enable lsi clock is attached. 
 
can you please suggest changes to enable LSI/LSE to enable PWM in kernel side. Thanks. 
 
BR,
Anantha R
0 REPLIES 0