STM32 MPPT Controller Problem, Issue and Fixes

 In this post, I detail several critical corrections and improvements for the LM5101-based converter schematic and Proteus simulation. From swapped pins and regulator issues to MCU wiring and sensing circuits, these fixes ensure proper operation in real hardware and accurate simulation results.

1. LM5101 HO and HS are swapped (U2 pins 3 and 4).

LM5101 in mppt charge controller

Corrected Wiring

LM5101 in mppt charge controller

2. Q9, the 12 V regulator, has its base grounded

emiiter follower in mppt charge controller

  • Q9 is a BC846B emitter follower with its base tied straight to GND. R27 only bleeds the input rail to ground, and there is no ~12 V zener.
  • As drawn it can't produce 12 V. It probably only works in Proteus because the "+12V" power terminal is an ideal source, so real hardware would have no gate-drive rail.
  • Fix: bias the base from the input rail through R27 and add a 12–13 V zener from base to GND.
Corrected Wiring

emiiter follower in mppt charge controller

3. The MCU's VDD is not the buck's 3.3 V output.

wring 3.3V to MCU
  • Label the MCU terminals "+3.3V" so they join the buck output. As it stands, Proteus runs the MCU from its default VCC rail instead of the 3.3 V buck.
Corrected Wiring

MCU terminals "+3.3V" so they join the buck output

4. Inductor-current INA186 (U3) inputs are reversed.

Inductor-current INA186 (U3) inputs
  • IN+ is on the battery side of R10 and IN− is on the inductor side. Charging current therefore pulls the output below REF.
  • main.c expects positive output for charging current. Swap R11 and R12, or invert the sign in firmware.
Solution: I updated it in firmware.

5. The comparator output goes to PB14, not PB12 

TIM1_BKIN is only on PB12, so the hardware break never fires.
comparator output goes to PB12

Corrected Wiring

comparator output goes to PB12

6. There is no NTC circuit, and PA5 is floating

MPPT NTC circuit
  • Firmware turns a low or zero ADC reading into 130 °C.
  • After the first second that triggers a permanent over-temperature fault, and the converter never starts.
  • Add RT1 and R41 with C39 on PA5, (or disable the over-temperature check for now).

Smaller issues

  • Reset button: it is in series with C4 (button → C4 → GND), so there is no direct path to ground. The first press gives a short pulse and later presses do nothing. Wire the button from NRST to GND with C4 across NRST and GND.
STM32 reset button wiring

Corrected Wiring:

STM32 reset button wiring
  • Fuse: its netlist value is 1A, and the symbol has no label. Set it to 25 A.
mppt fuse setting

Corrected:
mppt fuse setting
  • Q1 gate: it is fed through D2 from LO with no gate-source resistor. It stays charged after the converter stops, so add about 1 MΩ.
protection mosfet gate to source resistor

Corrected wiring
pull down resistor
  • Status LED: now active high with a LED_ACTIVE_HIGH switch. PC13 on the F103 should only source about 3 mA, so use a 680 Ω–1 kΩ resistor for R3 instead of 330 Ω.
STM32 Status LED

  • VDDA: the reference filters it with 47 Ω and 2.2 µF. You tie it directly to 3.3 V with 100 nF and 1 µF. Adding the 47 Ω improves ADC noise.
STM32 VDDA pin

Corrected:
STM32 VDDA pin



This post provides a detailed review of corrections and improvements for an LM5101-based converter schematic and its Proteus simulation. Key fixes include swapping HO and HS pins, properly biasing the 12 V regulator, connecting the MCU to the correct 3.3 V rail, correcting inductor-current sensor inputs, updating comparator connections, and implementing an NTC temperature circuit. Additional minor adjustments cover the reset button wiring, fuse labeling, Q1 gate resistor, and LED resistor value. These changes ensure accurate simulation behavior and reliable real-world operation.

Related blog posts:




Post a Comment

Previous Post Next Post