Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

samples: boards: stm32 power_mgt stdby and shutdown #79548

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

FRASTM
Copy link
Collaborator

@FRASTM FRASTM commented Oct 8, 2024

Polarity low is wrong : wakeup pin 2 is active low
so the wakeup must be detected on the rising edge
This is the default wakeup pin2 config.
Apply the recommended sequence to enter low power standby

Fixes #79451

@FRASTM FRASTM force-pushed the issue79451 branch 3 times, most recently from 66024c7 to 9fa64e2 Compare October 8, 2024 12:28
@FRASTM
Copy link
Collaborator Author

FRASTM commented Oct 8, 2024

Running the samples/boards/st/power_mgmt/standby_shutdown/ on the samples/boards/st/power_mgmt/standby_shutdown/

*** Booting Zephyr OS build v3.7.0-4029-g9fa64e2d3a39 ***

Reset cause: Reset soft

Device ready: disco_l475_iot1


Press and hold the user button:
  when LED2 is OFF to power off
  when LED2 is ON to enter to Standby Mode

Is not possible automatically as the test is waiting for user button pressed

User button pressed
Powering off
Release the user button to wake-up
*** Booting Zephyr OS build v3.7.0-4029-g9fa64e2d3a39 ***

Reset cause: Shutdown mode or power up

Device ready: disco_l475_iot1

or

User button pressed                                                             
Standby Mode requested                                                          
Release the user button to exit from Standby Mode                               
�*** Booting Zephyr OS build v3.7.0-4029-g9fa64e2d3a39 ***                      
                                                                                
Reset cause: Standby mode                                                       
                                                                                
Device ready: disco_l475_iot1 

@FRASTM FRASTM marked this pull request as ready for review October 9, 2024 13:34
@zephyrbot zephyrbot added platform: STM32 ST Micro STM32 area: Samples Samples labels Oct 9, 2024
Polarity low is wrong : wakeup pin 2 is active low
so the wakeup must be detected on the rising edge
This is the default wakeup pin2 config.
Apply the recommended sequence to enter low power standby

Signed-off-by: Francois Ramu <[email protected]>
After flashing the board, the reset pin and the software
reset are detected as reset cause by the device
Put this in the sample to match the rule

Signed-off-by: Francois Ramu <[email protected]>
@FRASTM
Copy link
Collaborator Author

FRASTM commented Oct 14, 2024

sample tested with disco_l475_iot1

Reset cause: Reset soft
Device ready: disco_l475_iot1


Press and hold the user button:
  when LED2 is OFF to power off
  when LED2 is ON to enter to Standby Mode

User button pressed
Standby Mode requested
Release the user button to exit from Standby Mode
�*** Booting Zephyr OS build v3.7.0-4291-g9ffe7a3b9df5 ***

Reset cause: Standby mode
Device ready: disco_l475_iot1


Press and hold the user button:                                                 
  when LED2 is OFF to power off                                                 
  when LED2 is ON to enter to Standby Mode                                      
                                                                                
User button pressed                                                             
Powering off                                                                    
Release the user button to wake-up                                              
*** Booting Zephyr OS build v3.7.0-4291-g9ffe7a3b9df5 ***                       
                                                                                
Reset cause: Shutdown mode or power up                                          
Device ready: disco_l475_iot1                                                   
                                                                                
                                                                                
Press and hold the user button:                                                 
  when LED2 is OFF to power off                                                 
  when LED2 is ON to enter to Standby Mode   

@FRASTM FRASTM force-pushed the issue79451 branch 2 times, most recently from a01c4dc to 2b02e7b Compare October 15, 2024 08:24
This PR is changing the method to use the user button
to be the wakeup source to exit from lower power mode

Signed-off-by: Francois Ramu <[email protected]>
@JarmouniA
Copy link
Collaborator

I don't think setting wake-up pin polarity to low is incorrect, since it's the push-button that determines it, & in this case it's Active low.

this is done through the WakeUp pin config, isn't it

@FRASTM Yes, but only when wkup-pins-pol property is present in pwr node, which was removed in board overlay.
The presence of this property result in the definition of the PWR_STM32_WKUP_PINS_POLARITY flag

#define PWR_STM32_WKUP_PINS_POLARITY DT_INST_PROP_OR(0, wkup_pins_pol, 0)

which guards the polarity cfg code
#if PWR_STM32_WKUP_PINS_POLARITY

@FRASTM
Copy link
Collaborator Author

FRASTM commented Oct 23, 2024

@FRASTM Yes, but only when wkup-pins-pol property is present in pwr node, which was removed in board overlay. The presence of this property result in the definition of the PWR_STM32_WKUP_PINS_POLARITY flag

@JarmouniA , I do not catch, Could you please detail your request

Add the wakeUp pins selection on its GPIO
for all the stm32l4xx devices
Change if needed (see the corresponding datasheet/RefMan)

Signed-off-by: Francois Ramu <[email protected]>
@erwango erwango added this to the v4.0.0 milestone Oct 24, 2024
@mmahadevan108 mmahadevan108 modified the milestones: v4.0.0, 4.1 Nov 8, 2024
@nashif nashif modified the milestones: 4.1, v4.1.0 Nov 8, 2024
@kartben
Copy link
Collaborator

kartben commented Dec 22, 2024

Ping @JarmouniA

@JarmouniA
Copy link
Collaborator

Ping @JarmouniA

I think my comment was clear, I don't see how I can clarify it further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Samples Samples platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The STM32 standby_shutdown sample has a simple mistake
7 participants