For starters, to actually use FastPWM, you also need to make a FastPWM instead of an PwmOut object:
Next, I quickly checked with F401 (should be similar enough), latest mbed lib and latest FastPWM lib, and it compiles fine for me. Can you update both also? (Right mouse button on them, click update). I wonder if you accidentally changed something in the code. (If you get an error that you have uncomitted changes, you did :P).
You don't need to define the prescaler yourself: It defaults to -1 if you don't define anything, only if you want it different, of if you set it different but want to put it back to default, you need to do it manually.
Btw: What I just see, reading the duty cycle using the read function only works if you wrote it using the write function: If you just set a period and pulsewidth it doesn't work. (Yes yes, it would be nicer if I make it work, might do it in the future, but in my defense, this is alot more efficient :P. The 'problem' is a bit that this lib actually has two goals in one: First one is for PWM beyond normal mbed PWM limits, second is to have reduced overhead (available). Third one which now is also true: Fewer glitches when changing period/pulsewidth than the Mbed libs generates nowadays).
Hey guys,
i am a beginner in the STM32 World. At the moment i am using the online STM32 Editor and i found a FastPWM library by Erik Olieman which i tried to use. But it didn't work. I Used the following source code
and it produces the following error message "Error: Expression must have (pointer-to-) function type in "FastPWM/FastPWM_common.cpp", Line: 6, Col: 6"
in the manuial is written that i have to define the prescaler e.g. with -1. but it didn't work as well.
So can you tell me how i can fix this problem?
On the other hand does anybody have a fastPWM library with which it is possible to generate a PWM above 1 MHz?
I am using the Nucleo F411Re board.
thank you very much!