2025-09-24 4:13 AM - last edited on 2025-09-24 5:57 AM by Andrew Neil
I am working on a project to replace a legacy ST62 IC in a industrial charger 24V/45A charger with an STM32 microcontroller (STM32F0 series). The main issue is with the PWM signal generation using TIM1 and TIM3. Both timers have 16-bit prescalers (value 0 to 65535), and I need to generate a PWM at 1 kHz with about 1000 steps of resolution.
My timer clock is 8 MHz. Based on calculations, prescaler and ARR values can generate correct frequencies, but the PWM output voltage is only around 2.7V instead of the expected 5V, and there is no effective voltage output for charging.
I suspect this issue is linked to the STM32CubeMX pinout or timer configuration:
Correct PA6 pin configuration for TIM3 PWM output.
Proper timer frequency setup: prescaler around 725 with ARR 0 tested, but PWM not as expected.
Possible problem in software initialization or timer start sequence affecting PWM output.
Relay control pins and PWM outputs may not be correctly activated or sequenced.
I have tested a new STM32 board without programming, same issue persists, suggesting it’s not hardware damage but configuration.
Would appreciate help reviewing timer config, pin assignments, and software steps to properly initialize and start PWM on TIM1/TIM3 for reliable voltage output.
2025-09-25 8:37 AM
@Andrew Neil @Ozone @TDK thanks guys about your responds
and this an introduction about my project:
This project involves developing a modern microcontroller-based control system for a SHARP industrial battery charger, replacing an obsolete ST62 microcontroller with a contemporary STM32F030F4 solution. The system manages a high-power 24V/45A battery charging process with comprehensive safety features and intelligent regulation.
The original charger uses an outdated ST62T20CB microcontroller that is no longer manufactured, making maintenance and repairs increasingly difficult. A modern replacement was needed that could:
Complete redesign of the control board using the STM32F030F4P6 microcontroller, maintaining electrical compatibility with the original power stage while adding modern safety features and improved control algorithms.
The controller manages a high-power battery charging system through:
The system operates through a state machine with four primary states:
The system software is fully functional, but the charger is not producing output voltage. Investigation indicates this is likely a hardware issue rather than software, as:
This project successfully modernizes a critical industrial charging system, replacing obsolete technology with a contemporary solution that maintains backward compatibility while adding significant safety and functionality improvements. The software implementation is complete and validated, with final hardware integration as the remaining milestone for full deployment.
2025-09-25 8:47 AM
Missing from "Technical Competencies Demonstrated" appears to be an understanding that a 3.3V microcontroller is not going to give a 5V output!
2025-09-25 10:01 AM
When the charger is powered by the 220V mains, I measured the output voltage of the original ST62 IC on pin 15 and found it to be 14V DC. After I replaced the IC with an STM32F030F4P6 and programmed it, I noticed that pin 15 now outputs only 12V DC. This is just one example; there are other pins with similar behavior
2025-09-25 10:27 AM
15V on an STM32 pin will damage it.
You should certainly not have 15V on any STM32 pin !!
You still haven't shown any schematics of your system.
We have no idea what this mystery "charger" is.
Again, please read this: How to write your question to maximize your chances to find a solution
2025-09-25 10:20 PM
> When the charger is powered by the 220V mains, I measured the output voltage of the original ST62 IC on pin 15 and found it to be 14V DC.
This is implausible either.
The ST62xx are 5V devices, the datasheet gives a maximum of 7V.
The old design must have contained a level-shifting logic, which could be quite simple.
But connecting voltages twice or more the maximum rating to a pin will kill every MCU.
2025-09-26 8:25 AM
First, I do not have the schematic of the charger. We have a 24V/45A charger that uses an ST62T20CB IC, but this circuit is damaged. After some research, I found that the ST62 is an old technology and there is no longer a compiler available to reprogram it. Then, I discovered that the STM32F030F4P6 microcontroller is a suitable equivalent to the ST62.
I took a working charger with the ST62 and made the following measurements:
Pin 8 - VSS = 14 V
Pin 12 - VSS = 2 V
These are examples of values I included in my program.
So, my problem is how to get an output voltage to charge the batteries, since the pin voltages I measured are the same as those with the ST62.
2025-09-26 9:25 AM - edited 2025-09-26 9:25 AM
How To Use Transistors For Voltage Level Shifting
You will most likely need to modify the hardware. Or at the very least, understand what you currently have.
2025-09-27 3:52 AM
for more understanding project @Ozone @TDK @Andrew Neil :
Objective: Replace legacy ST62T20CB microcontroller with STM32F030F4P6 in Industrial 24V/45A battery charger system.
MCU Specifications:
Pin Function Voltage Current Notes
VDD (Pin 1) | MCU Power | 3.3V ±5% | ~50mA | Regulated from 5V input |
VSS (Pin 16) | Ground | 0V | - | Common ground |
VDDA (Pin 5) | ADC Power | 3.3V | ~5mA | Clean analog supply |
VSSA (Pin 4) | ADC Ground | 0V | - | Analog ground |
Pin GPIO Function Voltage Levels Load Notes
14 | PB1 | LED Red | 0V/3.3V | 20mA | Error/charging indicator |
20 | PA14 | LED Green | 0V/3.3V | 20mA | Charged/ready indicator |
19 | PA13 | LED Orange | 0V/3.3V | 20mA | Standby indicator |
10 | PA4 | Relay Soft-Start | 0V/3.3V | Via driver | Controls 24V relay coil |
13 | PA7 | Relay Main | 0V/3.3V | Via driver | Controls main power relay |
11 | PA5 | Fan Control | 0V/3.3V | Via driver | Cooling fan control |
Pin GPIO Function Voltage Levels Frequency Duty Cycle Notes
12 | PA6 | PWM Regulation | 0V/3.3V | 1kHz | 10-90% | TIM3_CH1 output |
Pin GPIO ADC Channel Input Voltage Range Measured Parameter Scaling Factor
6 | PA0 | ADC_IN0 | 0-3.3V | Battery Voltage | 24V → ~1.2V via divider |
7 | PA1 | ADC_IN1 | 0-3.3V | Charge Current | 45A → ~2.4V via shunt |
8 | PA2 | ADC_IN2 | 0-3.3V | Temperature | NTC → 0.5-2.5V |
9 | PA3 | ADC_IN3 | 0-3.3V | Mains Voltage | AC detection |
Pin GPIO Function Input Voltage Pull-up/Pull-down Notes
15 | PA8 | Reset Button | 0V/3.3V | Internal pull-up | Manual reset input |
17 | PA9 | Polarity Detection | 0V/3.3V | Internal pull-up | Battery polarity check |
Pin GPIO Function Voltage Levels Notes
18 | PA10 | SWDIO | 0V/3.3V | SWD data line |
2 | PF0 | SWCLK | 0V/3.3V | SWD clock line |
3 | PF1 | NRST | 0V/3.3V | Reset line |
12-bit ADC Resolution: 4096 steps for 0-3.3V range
Battery Voltage (ADC) | PWM Duty | LED Status | Action ---------------------|----------|------------|-------- < 1200 (< ~26V) | 10-75% | Red ON | Active charging ≥ 1200 (≥ ~26V) | 30-35% | Green ON | Maintenance mode > 3650 (> 27V) | Reduced | Green ON | Float charging
This documentation provides complete technical details for implementation, testing, and troubleshooting of the Industrial 24V battery charger controller system.
2025-09-27 7:02 AM
Is there a question here?
2025-09-29 1:48 AM
@boulganamed wrote:First, I do not have the schematic of the charger.
But you must, surely, have a schematic of the ST62 part?
otherwise, how can you have built an STM32 substitute?
You need to show at least
A block diagram of the system would help - focussing around the MCU.
@boulganamed wrote:SHARP industrial battery charger
Do you have a model number for that? documentation?
Are you trying to hack the internals of this commercial charger, or just making some sort of external controller for it?