7 years, 8 months ago.

Can i use PTA1 and PTA2 as a PWM output ?

I read the datasheet of FRDM kl25z where it says that i can use PTA1 and PTA2 as a PWM output. I am not getting any output pulse through those pins. Can anyone suggest me how can i use them /change the timer channel in mbed. So that i can use them as a PWM output.

According to KDS, TPM1_CH0 are allocated to the other PWM outputs that i am using in my project. PTA 1 and PTA 0 seems to be associated with TPM2.

However I am not getting an output when i try to give a PWM from either of these ports.

1 Answer

7 years, 8 months ago.

What kind of program are you using? A problem for sure is that those pins are also the USBTX and USBRX pins. For some reason (yes it was a bad idea on later ones they tried to avoid it) they followed Arduino pinout there, and made the pins used for the communication with PC also the Serial pins at those locations.

In general I think if you make PWM it should override that, although of course than communication with your PC is not possible anymore. If however you for example first do the PWM, and then add a printf, or Serial pc(USBTX, USBRX) definition, it will set it back to Serial. That, or something is wrong in the source code and no one ever noticed because they are normally not used as PWM pins.