PWM frequency limits on a FEZ Panda II

  1. I’m trying to find out what is the min and max frequencies for the PWM output on the FEZ Panda II are?

  2. I assume if I set the frequency for one pin it changes it for the others as well, but the duty cycle can be different on each pin?



Yes they all share the clock but not duty cycle. Max would be the CPU clock divided by 2 IIRC and minc can be really low if you touch the registers using register class.

Gus is right. If you want to lower the PWM frequency, you’ll have to set the PR register (PWM1PR, for example). The PWM timer is incremented every PR+1 cycles of the PCLK. Since it’s a full 32-bit register, you can basically set any PWM frequency that you want. I think setting it to the maximum value (2^32), you’d get almost a minute for the period – pretty slow!

More information can be found in the Pulse-Width Modulator section of the LPC23XX user manual, available here:

Hope that helped!

Thanks Gus and Jay. So without touching the registers can I set it to 1Hz ?


Sorry for not getting back to you sooner – I didn’t see your reply.

No, as I said, you’d have to modify the appropriate PWM period register (PWM1PR, for example). Different PWM pins use different PWM modules, so to answer your question about whether you can have different pins with different periods, it really depends on which PWM pins you’re using and which PWM modules they’re hooked up to internally. You’d have to consult the STM32F4 reference manual for that information.

For what it’s worth, when I hear that someone wants to PWM something with a period of 1 Hz, that’s usually a red flag. There’s probably a better way of doing whatever it is you’re trying to do.

Can you tell us more about your application?