Hello!
I'm not sure you can control a brushless motor by PWM. This is not a program issue but a
system issue.
- A brushed DC motor gets the proper current at the proper time by using a current collector
ring (I don't know the word in english, sorry) and brushes.
- In the case of a motor that runs continuously for long periods, the brushes would get damaged
vey quickly, therefore the commutation is replaced by position detection with hall or optical
sensors. This means that you have an electronic board aimed at commuting the proper current
at the proper coil. This board works of course in DC.
Now you are apparently experienced with processor. Try to imagine that you are powering
your processor with a PWM signal instead of DC,,,
That said, I can't pretend I know all the brushless motors technology and maybe you can control
some of them in PWM, but I would say you simply can't.
Dora.