cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103CB resets and LCD hangs during USB-to-battery power switching

Shanmugapriya
Associate II

Hey team,

I am working on a project using the STM32F103CB MCU. The device operates from both USB and battery power. The battery configuration consists of four 1.5 V alkaline cells arranged as 2S2P, providing a nominal 3 V supply. USB power is provided at 5 V.

When both power sources are connected simultaneously, the PCB is designed to prioritise USB power.

Shanmugapriya_1-1770439605946.pngShanmugapriya_2-1770439640678.png

 

 

However, when the USB cable is unplugged while the battery remains connected, the MCU core resets and the LCD connected to the PCB hangs, resulting in no further operation.

I am using the Arduino IDE for development. During debugging, I observed that the setup() function executes when the USB is unplugged, confirming that a reset occurs even though the battery supply is present. This indicates that the USB-to-battery transition is causing a reset condition rather than a seamless power handover.

I monitored the MCU supply voltage (VDD) during the USB disconnect event. Initially, the voltage dropped to around 2.0 V. After adding bulk capacitors, the voltage dip has been reduced, and VDD now drops to approximately 2.7–2.8 V, as measured using a multimeter.

To mitigate this issue, I enabled the Programmable Voltage Detector (PVD) with the threshold set to [2:0] = 001; however, the hanging issue still persists.

Could someone suggest a reliable solution or best practice to handle USB-to-battery power switching on the STM32F103CB, ensuring a clean transition without resets or peripheral lockups?

Thanks in advance for your support.

 

 

0 REPLIES 0