cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F030F4P6 - PWM output voltage

boulganamed
Associate III

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.

38 REPLIES 38

@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.


You may need to analyze in deep what you are measuring here. 14V measured on a chip pin having a power supply of 5V doesn't have any sense. I'm pretty sure there is something wrong in the method of your measurement or on the source you are probing. ..

What device are you using to measure the voltage: oscilloscope, multimeter? 

 


@boulganamed wrote:

Pin 8 (VSS) = 14V, and Pin 12 (VSS) = 2.03V..


Of which device? of ST6 itself? of the board that contains that MCU? 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

> 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.

And measured against what ?
To determine voltages at the STM32 pins, you need to measure against the STM32 GND potential.
For the ST62xx, against the respective GND pins as well.

If the values you are quoting were correct, the ICs would be fried within milliseconds.

@Andrew Neil @Ozone @mƎALLEm @TDK 

i think my measurement good because i put positive in the pin and negative in vss pin (st62 connected with charger).

and also the charger work good with original application

You still haven't said what you're using to make the measurement.

But clearly it is way outside the chip's Absolute Maximum ratings - so there has to be something wrong!

This is why it's so important that you have the schematic of the circuit you're working with.

 

The facts remain:

  1. The ST62 is a 5V chip - so it cannot generate more than 5V at its output pins.
  2. The STM32 is a 3.3V chip - so it cannot generate more than 3.3V at its output pins.
  3. You can't just plug a 3.3V chip into a circuit designed for a 5V chip - you will damage it
  4. Exceeding a chip's Absolute Maximum ratings is going to damage it.
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.

@Andrew Neil i used multimeter


@boulganamed wrote:

This documentation provides complete technical details for implementation, testing, and troubleshooting of the Industrial 24V battery charger controller system.


Well, it gives you a specification for if you were developing a new charger from scratch.

But you're not doing that.

You are trying to modify an existing design.

For that, you need details of the existing design - schematics, etc.

 

@boulganamed wrote:

 I am not trying to hack or reverse engineer a commercial charger system.


It very much seems that you are!

 

@boulganamed wrote:

My goal is to undertake this project myself as a way to upgrade my skills in both hardware and software programming.


This project is clearly some way beyond your current hardware skills & knowledge.

You need to set this aside, and spend some time gaining experience with electronics.

 

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.

@boulganamed wrote:

@Andrew Neil @Ozone @mƎALLEm @TDK 

i think my measurement good because i put positive in the pin and negative in vss pin (st62 connected with charger).


Sorry I don't think so. I'm pretty sure there is something wrong either in your description or in the way you are measuring the voltage level. I think you are not measuring directly on the MCU pins but on the board pins... 14V is a level of the battery voltage during the charge process not the voltage generated by the MCU.. Sorry.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

> I think you are not measuring directly on the MCU pins but on the board pins... 14V is a level of the battery voltage during the charge process not the voltage generated by the MCU.. Sorry.

... unless the MCU section is thoroughly fried, in a high-impedance zombie state, and the measured voltage is back-fed from the battery charger.

Andrew Neil
Super User

The original question, "STM32F030F4P6 - PWM output voltage", has been answered long ago.

Further discussion seems pointless, as the OP can't/won't provide necessary info - schematics etc.

@mƎALLEm I think it's time to close this thread?

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.