cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 STOP2 System abnormal restart

daniaoday
Associate III

Environment: STM32L4 + 32.768K LSE
Function: Wake up and work once every hour, then enter stop2 mode. During the one-hour sleep, wake up every ten minutes to feed the external watchdog.
Problem: The device resets directly when waking up every ten minutes.
Current known information: The device was tested in the company for over twenty days without any issues (including restarts, freezes, etc.). After the prototypes were given to customers, problems started to occur in about 10 to 20 days. Currently, there are two failed devices. After power cycling, the devices did not return to normal. External reset also did not restore them to normal. Re-flashing the devices allows them to operate normally, and they are currently under continuous pressure testing to see if the issue will recur.
Current debugging progress: When the device restarts, the nRST pin has a low-level time of less than 1ms. The 3.3V power supply pin of the MCU is stable as observed by the oscilloscope. The TP5010_DONE_Pin has a 40ms high-level time during each ten-minute wake-up period (HAL_Delay(1) --> SystemCoreClock configured at 80M, after low-power wake-up, it switches to the default 4M of MSI, reducing by 20 times, plus the HAL_GPIO_WritePin time, which is exactly 40ms), but during the first low-power entry, it has a high-level time of over 20ms (caused by unstable PLL switching to MSI?).

 

 

------------------------------------------------------------------------------------

 

2026/02/03 23:18 UPDATE:

Environment:
50 mAh battery + STM32L4 MCU + 32.768 kHz LSE crystal + 4G module + GPS module + solar charging panel

Functionality:

  • The device wakes up once per hour to collect sensor data.
  • Every 8 hours, it uploads the accumulated data to a server via the 4G module.
  • Immediately after completing its tasks, the MCU enters STOP2 low-power mode.
  • Data collection and logging are stored in the internal Flash memory.
  • During the long sleep period, the MCU wakes up every 10 minutes solely to feed an external watchdog timer.

Problem:
The device occasionally resets during these 10-minute wake-up intervals.

Known Information:

  • Our LDO can only supply a peak current of 300 mA.
  • There is approximately 10 µF of capacitance on the 3.3V power rail.
  • The 4G module’s datasheet specifies a peak current requirement of 1 A. During RF transmission, significant voltage droop occurs—oscilloscope measurements show the 3.3V rail dropping as low as 2.4V.
  • The GPS module draws about 100 mA during operation, causing ~100 mV voltage pulses visible on the oscilloscope.
  • The Brown-Out Reset (BOR) threshold is configured at 1.7V.

Current Observations & Issues:

Current Analysis:

  1. Power supply IC limitation: Although we haven’t captured the exact 3.3V waveform at the moment of reset, we have observed dips down to 2.4V. It’s reasonable to assume that under real-world outdoor conditions—especially with poor cellular signal requiring higher 4G transmit power—the voltage could drop even further. (See image showing a 2.8V dip: https://community.st.com/t5/stm32-mcus-products/stm32l4-stop2-system-abnormal-restart/m-p/875903/highlight/true#M292050.)
  2. Power cable issue: The current wiring uses approximately AWG16 gauge, which may be too thin, contributing to additional voltage drop.
  3. Flash corruption during write operations: Data logging, Flash writes, and 4G transmission occur simultaneously. Therefore, it’s highly likely that a voltage droop-induced reset happens during a Flash write, potentially corrupting the memory contents.

Current Questions:

  1. Regarding point #3 above: If a reset caused by voltage droop occurs during Flash read/write, will it permanently damage the Flash memory or only partially corrupt its contents?

Next Steps:

  1. Redesign the power circuit: Replace the current LDO with one capable of handling higher peak currents, then conduct further testing.
  2. Use thicker power cables (lower gauge) to reduce resistive losses.
  3. Investigate and resolve the STM32CubeProgrammer read failure—either recover the root cause or implement mitigation strategies (e.g., robust Flash write protocols, power monitoring before writes).
54 REPLIES 54

So very much a possibility of brownouts if the battery gets low ...

Do you monitor the battery level to ensure that you don't try to run on a flat battery?

In particular, that you don't try to write to Flash on a low battery?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
MM..1
Chief III

@daniaoday wrote:

Environment: STM32L4 + 32.768K LSE
Function: Wake up and work once every hour, then enter stop2 mode. During the one-hour sleep, wake up every ten minutes to feed the external watchdog.
Problem: The device resets directly when waking up every ten minutes.

 

Try little match : your bat in OK state can do 45mA one hour. Every hour your code work time on 80M is how long ??? STOP2 isnt hour when every ten min exist next wakes ... How is complete current your design on run mode and on stop ?  My tip is MCU 8mA + 7mA other =15mA  If run time is one minute every hour , then your design deplete bat after 3x 60 hours around 7days 

 

You dont reply how batery type and voltage used?

TDK
Super User

Guys, if the battery was failing or running out, the 3V3 line would be dropping, no? And it wouldn't be recovering after a reset.

If you feel a post has answered your question, please click "Accept as Solution".

@TDK wrote:

Guys, if the battery was failing or running out, the 3V3 line would be dropping, no?


I get the impression the 3V3 line has only been verified in the lab ?

But the devices are failing in the field - where the state of the battery (and, thus, 3V3) are unknown ?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

This cleared it up for me. But I could be missing something.

> The oscilloscope captured 3.3V on one channel and nRST on the other, with the nRST channel set to trigger mode. It was found that when the nRST signal had a falling edge, there was no fluctuation on the 3.3V line.

It would always be good to see actual scope plots with this information rather than just text. Sometimes things are left out or misinterpreted.

If you feel a post has answered your question, please click "Accept as Solution".
daniaoday
Associate III
Battery:
Specification for Lithium-ion cell: 65 mAh, 3.7 V.
Failed device issue:
We currently have two pilot customers, each with approximately 20 devices.
  • Scenario 1: The first customer has already deployed the devices on birds. Within three days, about ten devices exhibited anomalies one after another, followed by occasional additional failures in the subsequent days. The failures occurred too rapidly to identify any clear pattern.
  • Scenario 2: According to feedback, the second customer has not yet deployed the devices on birds (they may still be in storage). On a certain day between 4:55 and 7:26, nine devices rebooted. Afterward, they began rebooting every few hours. After some time, the reboots became irregular again.
  • Scenario 3: We conducted our own test with devices placed on a balcony, and two units showed anomalies, named test1 and test2:
    • test1: Tested by colleague J. Confirmed as an internal reset with stable 3.3 V power. A new firmware version with added RCC status logging was reflashed, and the issue did not reoccur within three days—still under monitoring.
    • test2: Tested by colleague K. Also confirmed as an internal reset with stable 3.3 V power. I will now read the MCU’s internal status via J-Link.
All lab-test-related information I’ve shared with you so far is based on testing results from test1 and test2.
In all three scenarios, when anomalies occurred, our platform reported battery voltages between 4.0 V and 4.2 V.
 
Device configuration:
The device currently collects data once per hour and uploads data via the 4G module every 8 hours.
 
Device workflow:
Under normal operation:
Power-on / Reboot → Log reboot event → Collect data once → Upload all historical data to the platform → Enter 1-hour sleep → Upload all historical data → Collect data → Sleep 1 hour (repeat this cycle 8 times) → At the 8-hour mark, upload all historical data → Collect data → Sleep 1 hour (repeat this cycle again) → LOOP.
The “1-hour sleep” is implemented via the device_enter_lowpower function, which internally splits the hour into six 10-minute intervals. The relevant code has already been shared previously.

At the time of reboot, logs from both test1 and test2 indicate that the reset occurred inside the device_enter_lowpower function. Similarly, for Scenario 1 and Scenario 2, reboots observed on the platform also follow this pattern—i.e., the interval between reboots and logged events is always a multiple of 10 minutes.
 
scope plots -->

daniaoday_0-1769737149650.png

 



OK then forget to Vdd issue. Trouble is sw. Check PLL recovery waiting is ok in your sw.

Good practice use only MSI without PLL. 

Check if some code on fail dont have sw reset call in code etc. For example stack fail...

PLL? This is an unexpected possibility: the PLL derived from HSI, and the repeated switching between PLL and MSI when entering and exiting Stop mode—could this cause a reset?
I only saw in the reference manual that MSI may exhibit overshoot during clock switching, and that it needs to stabilize before being used. In practice, however, I started using it without waiting for it to stabilize.
 
daniaoday_0-1769774437061.png

 

daniaoday
Associate III
Everyone, latest update:
  • When using J-Link with STM32CubeProgrammer or J-Flash to read a normal device, communication works fine and Flash can be read successfully.
  • However, when attempting to read a faulty device with the same setup, various errors occur.

Additionally, STM32CubeProgrammer occasionally crashes when connecting to the faulty device.

 

daniaoday_0-1769776577540.pngdaniaoday_1-1769776601289.png

daniaoday_3-1769776676800.pngdaniaoday_2-1769776642595.png

 

 

 

daniaoday_4-1769776796537.png

daniaoday_5-1769776821187.png

 

Regarding the issue where STM32CubeProgrammer cannot read the Flash, I came across a forum post mentioning that the problem is often due to the chip not being correctly selected. However, in my case, the chip has already been properly recognized.

 

https://community.st.com/t5/stm32cubeprogrammer-mcus/missing-database-files/td-p/81261 

 

daniaoday_6-1769777382889.png

 

daniaoday_7-1769777580852.png

 

SWD communication should be fine.

And the device has already been correctly identified.