Important changes to questions
We’re making some changes to Mbed Questions. From 10th December 2019 this site will be archived and new questions should be asked on our new forum site. Until that date you can continue to reply to existing questions here but can’t ask new questions.
5 years, 6 months ago.
PWM output ratio != 0% on pins 1, 2, 18, but on pin 24?
I'm using all PWM-channels for LED-dimming purposes. When I transferred already working code from LPC1768 to LPC1114 I encountered problems - not all channels dim down towards 'full off' state. Tracking down this strange behaviour lead to the fact that pin 24 uses an 32bit-counter, all others use 16bit-counters (if I got this right).
With a logic-analyzer I can see one spike of 0.7 microseconds at 50Hz, when the PWM-channel is enabled, this is long enough to see the leds shining, which isn't desired.
I can't see a similar spike on the '32bit-resolution-channel', but the sample-rate of the analyzer is limited to 24MHz, so this is no surprise - I guess there is a similar spike, but this can't be seen by human eyes...
Is there an elegant way to switch off the channel in case 'duty-cycle==0', which I could do in my code when dimming down to zero (And switch output on again without a short flash or similar effects)?
Question relating to:
5 years, 5 months ago.
Thanks for providing your code. My code is very similar than yours, but I also modified the pwmout_read() function as well. The pull request was accepted and just merged below:
You can get this fix in next release of the mbed library.