7 years, 5 months ago.

Nucleo F411RE board - MBed PWM max frequency

Hi to all, I'm developing a device based on the Nucleo F411 RE boad programmed by MBed.

I need to generate a 1MHz PWM signal, but with PwmOut object I can obtain 200Khz max.

Is there something to do to obtaing 1Mhz with PwmOut? Or in another way?

1 Answer

7 years, 5 months ago.

Without looking up the specifics of this board, I am going to answer generally. But there is a good chance this holds for this board. On any micro I have encountered, the max PWM output frequency is always related to the clock frequency of the micro. The PWM can only transition on a clock tick. The FR411RE seems to be 100MHz. The relationship between clock speed, pwm frequency and pwm steps or resolution is:

clock_hz / pwm_hz = pwm_steps

If we take the max clock, 100Mz and divide by the desired pwm requency, 1MHz, we see there are 100 steps in here. You should be able to get a PWM working that has a max of 100 steps. Whether that is good enough or not is up to you.

You will need to import the FastPWM library which unlocks faster PWMs in the hardware.