Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 3 months ago.
kl25z pwmout fixed at max 0.75MHz
I am wondering why this is, and if we can use a smaller divider instead of the 64 hardcoded today
2 Answers
11 years, 3 months ago.
See http://mbed.org/users/Sissors/code/FastPWM/.
Dropin replacement for normal PwmOut, unless you disable it, it automatically sets prescalers depending on the period you want for max resolution.
11 years, 3 months ago.
0xc0170 - I had actually reviewed the code prior to posting, and thus I was questioning why the implementation would hard code the divider to such a low speed. Imho, this should be user selectable, so I was wondering if there were some other reasons this value was chosen, or is it just a random thing? It'd be nice if the default impl described this decision in the comments, as, without any explanation, it seems completely arbitrary and unnecessaary.
Thanks for the FastPWM link. After posting, I did some additional searching and came upon that library. It's just what I need. I think something like that should be the default implementation.
Thanks.
Hello Steve Marmer,
you can actually change it. You have to create your own routines to get proper values. As it is set inside pwmout file for KL25Z by default. There is define which says 0.75MHz and thus to SC register inside TPM, CMOD is set to 1 and PS is set to 6 which is divider as you said 64.
I suggest you to review pwmout_api code file, that will provide you details to form new pwm API.
Regards,
posted by Martin Kojtal 02 Oct 20130xc0170