Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 2 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:
6 years, 1 month 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.