9 years, 6 months ago.

PWM generation issue using pc software with usb hid interface

Hello,

I am using seeduino arch development board to generate variable pwm signal based on the input received(period, duty cycle) from pc software via usb hid interface(mbed usb hid library is used for micro). I am able to generate pwm signals, but observing timing issues sporadically. when i disabled usb communication and gave constant parameters for pwm generation, it worked without any issue. I have seen in the LPC11u24 datasheet that Timer interrupts(used for PWM generation) have higher priority than USB interrupt. So what might be the reason for this error?

Thanks & regards Gijo Peter

1 Answer

9 years, 6 months ago.

The LPC11u24 has no real PWM support. The timers do have match outputs, which are used to generate PWM, but they lack the ability to update their registers at the beginning of a new cycle: Other boards can do this, which remove timing glitches.

This can in some situations give glitches when changing duty cycle, and will always result in glitches when changing the period. I do see the mbed lib currently doesn't handle this optimal, https://mbed.org/users/Sissors/code/FastPWM/ should do this better, but still it won't be perfect, the hardware simply isn't there.