10 years, 6 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

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,
0xc0170

posted by Martin Kojtal 02 Oct 2013

2 Answers

10 years, 6 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.

10 years, 6 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.

I will find out why is it implemented as it is, thank you for bringing this to my attention.

posted by Martin Kojtal 02 Oct 2013