2022-07-19 08:56 AM
Hello,
I would like to reach the lowest consumption as possible. I am programming an end node which sends data through TTN. My project is based on the LoRaWAN End Node example with the LoRaWAN middleware.
My fimrware works like that :
The example PWR_STANDBY works without any problem, I reach a consumption of 1.1 µA. I copied the code that configures and turns the board in standby mode into my firmware but at each boot, after reached the function HAL_PWR_EnterSTANDBYMode(), the board resets automatically.
Do you have any idea what I did wrong or miss in my firmware ? I can add the source code if needed.
I am using a custom board with the LoRa E5 STM32WL5EJC module embedded and the STM32WL package.
Thanks you in advance
Regards
2022-07-19 10:29 AM
STANDBY exits via RESET
Check you don't have any other circuits which will POR when the supply goes away.
2022-07-19 12:41 PM
2022-07-20 03:14 AM
I don't have any other circuits and supply on my board
2022-07-20 03:33 AM
Thanks you Piranha, it works !
I copied your code, I changed the wakeup pin because I only use the wakeup pin 1 (A0) and I added some #define because I don't have "PWR_CR1_LPMS_STANDBY". I found the definitions from this post :
In standby mode, the consumption is 1.08 µA and in shutdown mode, 0.39 µA.
But after leaving the standby mode the first time, the consumption reaches 0.5 mA. I must turn off then turn on the supply to have again 1.08 µA. Is there a flag to clear after reset to have the 1.08 µA ?
Regards
2022-07-20 06:22 AM
You don't have to search the register values on the internet - they are documented in the reference manual.
Seems like the issue 3a is still not solved for you. Did you define the NDEBUG for a non-debug build and tested that build?
2022-07-20 08:22 AM
I define NDEBUG and I rebuild the project, but same problem
2022-07-21 01:46 AM
After many attempts, sometimes the consumption stays at 1 µA for 6 consecutive resets, but sometimes it switchs to 0.5 mA after 1 resets.
Before my function EnterStandbyMode() where I copied your code, I put the code from DBG_Init() :
LL_EXTI_DisableIT_32_63(LL_EXTI_LINE_46);
HAL_DBGMCU_DisableDBGSleepMode();
HAL_DBGMCU_DisableDBGStopMode();
HAL_DBGMCU_DisableDBGStandbyMode();
Without this piece of code, the consumption switchs to 0.5 mA after 1 resets each time.
EDIT : the reason why the consumption stayed at 1 µA after consecutive resets was a bug with the button. So my problem doesn't come from there
2022-07-21 04:03 PM
Use the dedicated Code Snippet button, when posting code.
HAL_DBGMCU_DisableDBG***() functions do the same as section 3 in my article. If adding those makes a difference, that means you still have not implemented properly the section 3.
Disabling EXTI is not necessary. Actually disabling any interrupts at peripheral level can potentially create issues. This rises another question... Maybe you are entering the Standby mode from ISR (interrupt service routine)?
2022-07-22 02:52 AM
I am entering in standby mode only with your code after having received an ACK from TTN.
I went back in the reference manual and I found that "All registers are reset after wakeup from Standby except for PWR extended status and status clear register (PWR_EXTSCR)".
In fact at first boot with 1 µA, PWR->EXTSCR = 37376 and after a reset with 0.5 mA, PWR->EXTSCR = 39424. The difference corresponds with the 11th bit C2SBF. However, my project uses only the CPU1 and when I define DUAL_CORE, I get many compilation errors in stm32wlxx_ll_***.h files about member names