[PSR] PWM on new boards
Jiri Hubacek
hubacji1 at fel.cvut.cz
Sat Dec 30 17:10:36 CET 2017
On 12/30/2017 02:25 PM, klapajar at fel.cvut.cz wrote:
>
>> Good afternoon,
>> I would like to ask for some help on the matter of PWM on new boards.
>> This question appeared after a long time of me trying to find some
>> >information on this issue or a manual.
>> The question is well described for the old boards but the situation is
>> a bit different with the new ones. I have taken it the way that I
>> would have control of the motor if PWM_ENABLE is set to 0,
>> PWM_B_DIRECT and PWM_A_DIRECT to 1, PWM_PERIOD to 5000 and DUTY_DIR_B
>> and DUTY_DIR_A changing oppositely from 0 to 1 depending on polarity
>> of width and DUTY is set to any width less than period, it will work
>> somehow. Apparently, it doesn't.
>> I would appreciate any hints or a manual.
>> Thank you in advance.
>>
>> -- Sincerely yours, Aleksandra Pereverzeva
>
> Hello,
> in order to make motor spin, try to set CR register to zero (especially
> PWM_x_DIRECT to zero). I think these bits are used to generate your own
> signal without PWM_DUTY register. The rest should be correct.
I have not tested it yet, so the following is only my understanding of
the documentation [1].
If PWM_ENABLE is 0 the PWM is controlled directly by PWM_B_DIRECT and
PWM_A_DIRECT. It means that the functions for generating PWM signal
needs to be written manually.
If PWM_ENABLE is 1 the PWM is controlled by PWM generator - PWM_PERIOD
defines how long is the PWM period (should be 20kHz, see [1]). Speed of
the motor is then defined by PWM_DUTY register.
The question is how easy is PWM_ENABLE = 0 approach compared to
PWM_ENABLE = 1.
# References
[1]: http://rtime.felk.cvut.cz/psr/cviceni/semestralka/
Have a nice day,
Jiri Hubacek
More information about the PSR
mailing list