2022-03-07 06:11 AM
Relevant information in the datasheets and reference manual (RM0454) is lacking and/or confusion, but that 128Mhz can be achieved is clearly stated (STM32G030):
Cube also does allow for me to put in a 128 value for the ABP timer clocks (tested for both the STM32G030 and STM32G070), as shown below:
But when I look at the generated code (for TIM1), there is no code change when compared to the version generated for a 64Mhz input value. Note that Cube is erratic after changing values in this area: sometimes it updates the code sometimes it doesn't.
So my question is how to configure 128Mhz operation. Is it through the timer clock, or some center-aligned PWM configuration as suggested below:
That's it. Here's some extra tidbits found (from the refman):
From the datasheet:
Solved! Go to Solution.
2022-03-07 07:18 AM
The STM32G030 datasheet specifies 64 MHz max timer frequency.
https://www.st.com/resource/en/datasheet/stm32g030k8.pdf
Other STM32G0XX chips may support higher, which is consistent with "up to 128 MHz".
2022-03-07 06:20 AM
Seems like a CubeMX bug that lets you edit that field independently. It's not configurable independently of HCLK/APB Prescaler.
I can duplicate but I do get warning messages which indicate abnormal behavior.
2022-03-07 07:04 AM
Hi there, thanks for the reply!
Yes, I got a flaky feeling about that too, especially as the refman suggests the X2 factor in Cube only works when there is a divider in the first place.
Yet the STM32G0 is advertised as having a 128Mhz capability, and I don't think I would be the first to want to use the MCU to its capabilities. This is pretty low hanging fruit to take advantage of.
AN5145 "Migration of applications from STM32F0 Series to STM32G0 Series" also mentions the difference and advertises the increased PWM resolution, to below 8 or 10ns.
Note I also did many (fruitless) searches on the Cube generated code to find a possible match, on terms like TIM1PCLK, PCLK, TIMxPCLK, etc.
2022-03-07 07:18 AM
The STM32G030 datasheet specifies 64 MHz max timer frequency.
https://www.st.com/resource/en/datasheet/stm32g030k8.pdf
Other STM32G0XX chips may support higher, which is consistent with "up to 128 MHz".
2022-03-07 08:04 AM
Ouch. So I tested this with several G0x0 versions, including the STM32G070, and it seems all G0x0 don't feature the 128Mhz PWM.
For those wondering, using the STM32G071 I could configure 128Mhz:
So I guess the Cube bug and the blanket comments about 128MHz TIM1 capability put me on the wrong footing.
I'm glad it's worked out, thanks TDK.