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.
Solved! Go to Solution.
2025-09-29 2:20 AM
Thank you all for your input and questions.
First, I would like to clarify that I do not have the schematic diagram of the charger or the ST62 IC part. I am not trying to hack or reverse engineer a commercial charger system. My goal is to undertake this project myself as a way to upgrade my skills in both hardware and software programming.
I am a mechatronics engineering technician from Morocco, seeking opportunities to explore and develop my skills internationally, particularly interested in working in the US or Asia.
Regarding my measurements, I always put the negative probe on the GND (VSS) and the positive probe on the pin under test, such as PA0.
I hope this clarifies my intentions and approach. Thanks again to everyone for the support and helpful discussions.
2025-09-29 2:30 AM
@boulganamed wrote:I do not have the schematic diagram of the charger or the ST62 IC part.
So how can you possibly create an STM32 circuit which is equivalent to the old ST62-based design?
@boulganamed wrote:I always put the negative probe on the GND (VSS) and the positive probe on the pin under test, such as PA0.
As has been said many times, If you're seeing anything higher than 3.3V at that point then something is seriously wrong.
An STM32 cannot generate an output at any pin which is higher than its supply voltage - in this case, 3.3V.
2025-09-29 4:01 AM
this is role of charger ;
2025-09-29 4:02 AM
2025-09-29 4:13 AM
None of this helps use to understand the circuits in which you are using these chips.
That's what we need to see.
From those datasheets you can see that there's no way you'll get more than VDD out of any microcontroller pin.
So either your measurements are wrong, or you're going to blow the chips up!
BTW: It's better to go to the manufacturer's own website for documentation whenever possible.
For obsolete stuff like ST62 you may be stuck with 3rd-parties, but STM32 is current:
https://www.st.com/en/microcontrollers-microprocessors/stm32f030f4.html
2025-09-29 4:26 AM
> So either your measurements are wrong, or you're going to blow the chips up!
I got the impression the OP is a bit out his depth here...
2025-09-29 4:28 AM - edited 2025-09-29 4:30 AM
Hello,
As I understood you need to replace a module that contains a very old ST MCU (ST6) family that generated a PWM signal with a STM32 MCU, is that correct?
From the ST6 datasheet, it says that VDD could be between 3V to 6V:
So are you sure that ST6 MCU is generating PWM at 5V level?
As said maybe by others, especially the last post of @Andrew Neil :you cannot in any case to exceed the VDD level on the all GPIOs. So you need to use voltage level shift technique. You can use transistors or SN74AHCT1G126: its VDD =5V and Its VIHmin = 2V that means it could be driven by a voltage of 3.3V (logic high without issue) and outputs 5V which could be a suitable solution for you.
See also this video may help you.
Hope that helps.
2025-09-30 7:25 AM
@mƎALLEm @Ozone @Andrew Neil @TDK
When I take a properly functioning charger equipped with the ST62 IC and measure the voltages on its pins, I obtain values such as: Pin 8 (VSS) = 14V, and Pin 12 (VSS) = 2.03V.
However, when I replace the ST62 with an STM32 microcontroller programmed accordingly, and measure again, I find the following approximate values: Pin PA9 (equivalent to Pin 8 on the ST62) = 12V, and Pin PA4 (equivalent to Pin 12 on the ST62) = 1.97V.
this just a pic i didn't connect my stm32 with charger
These measurements indicate similar but slightly different voltage levels between the original ST62-based charger and the STM32 replacement system.
2025-09-30 8:04 AM - edited 2025-09-30 8:10 AM
None of this makes any sense at all !
@boulganamed wrote:When I take a properly functioning charger equipped with the ST62 IC and measure the voltages on its pins, I obtain values such as: Pin 8 (VSS) = 14V, and Pin 12 (VSS) = 2.03V.
Neither pin 8 nor pin 12 is VSS:
If you mean that you are measuring those pins with respect to VSS then, again, your are exceeding the Absolute Maximum ratings for those pins:
Your readings must be wrong!
@boulganamed wrote:I replace the ST62 with an STM32 microcontroller programmed accordingly, .
What do you mean, "programmed accordingly" ?
How/where have you obtained the code to program the STM32?
And, again, you can't just plug an STM32 into the same place that the ST62 came from.
The ST62 is a 5V chip; the STM32 is a 3V chip: it is not a drop-in replacement - you need to redesign the whole circuit for the STM32's lower operating voltage.
2025-09-30 8:29 AM
okey i understand well