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

Stop Mode on other families beside Py32f002B #43

Open
garudaonekh opened this issue May 6, 2024 · 1 comment
Open

Stop Mode on other families beside Py32f002B #43

garudaonekh opened this issue May 6, 2024 · 1 comment

Comments

@garudaonekh
Copy link

garudaonekh commented May 6, 2024

Hi,
I try to adapt your code to other families but I have to remark two lines out as it's only available on Py32F002B and it goes to 12ua,

/* STOP mode with deep low power regulator ON */
  //LL_PWR_SetLprMode(LL_PWR_LPR_MODE_LDPR);

  /* SRAM retention voltage aligned with digital LDO output */
  //LL_PWR_SetStopModeSramVoltCtrl(LL_PWR_SRAM_RETENTION_VOLT_CTRL_LDO);

https://github.com/IOsetting/py32f0-template/blob/main/Examples/PY32F002B/LL/PWR/PWR_DeepStop/main.c

I try the OpenPuya git and I can only get 8ua.

I use Py32f002a and Py32f030

@IOsetting
Copy link
Owner

For F002A, F003 and F030, use the following code to enter stop mode

LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR);
/*
 * Set STOP voltage to 1.0V (default 1.2V)
 * For PY32F030 1.0V -> 4.5uA~4.8uA, 1.2V -> 6uA ~ 7uA
 */
LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE2);
/*
 * Enable low power mode, SET_BIT(PWR->CR1, PWR_CR1_LPR)
 */
LL_PWR_EnableLowPowerRunMode();
/*
 * Enable deep stop, SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
 */
LL_LPM_EnableDeepSleep();
 
/*
 * Wait event 
 * Change the following to __WFI() if waiting for interrupt
 */
__SEV();
__WFE();
__WFE();
 
/*
 * Return to sleep mode
 * CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk))
 */
LL_LPM_EnableSleep();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants