AnsweredAssumed Answered

PWM input

Question asked by jm.buis@forze-delft.nl on Aug 2, 2018
Latest reply on Aug 10, 2018 by jm.buis@forze-delft.nl

Hi,

I am using a LPC4357 microcontroller and I am trying to decode a PWM input signal using the PWM peripherals on the chip. What I want to do comes down to this: I want to use 2 (out of the 3 available) counters to count the high and low time of my PWM signal. With that information, I can deduct the duty cycle and frequency of the signal, which is the information I need for my application to work.

However, from the manual (UM10503) I cannot really tell if what I want is possible. First I was thinking I could create capture events on the falling and rising edges so that the counter values (the high and low times respectively) are written to their capture registers and I can just poll those anytime if I want to read out my PWM signal. Now, my problem is that I can't find a way to have the counters start at the right time. From the manual I see that I can start the counters/timers/TC by writing a bit to the control register, but I want the counters to start counting only when my signal has a falling or rising edge. There is an option to have the counter advance whenever a falling/rising edge is detected, but I don't want the counter to just increase by 1 when that happens, I want it to keep counting using the base/peripheral clock. Is what I want possible? I feel like it should, otherwise having PWM input would be pretty useless.

Thank you in advance.

Outcomes