This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Pulse Width Measurement - not power sensitive - low accuracy

We need to measure a pulse width and create an event when it changes. The change will be from 10 to 80 percent, roughly - 1mS to 8mS or more. This is a very loose requirement.

We can have the HFCLK run as we have lots of power.

We have done this with other vendors using a Capture-Compare Peripheral which will directly measure an edge in a waveform - I don't believe you have this.

What do you recommend as the simplest approach to this?

1. Can we use the GPIOTE to generate the event that will trigger the capture on the rising, falling, or either edge of the PWM signal to determine the duty cycle of the incoming signal?

2. Is there a simpler way to use the GPIOTE, Timer, and PPI to measure the duty cycle of an incoming PWM signal?

3. Since we are only interested in a duty cycle that EXCEEDS around 10 percent or is 10 percent or less, is there another approach?

4. Are there any code examples in SDK15 for any of these?

  • Hi,

    1. Can we use the GPIOTE to generate the event that will trigger the capture on the rising, falling, or either edge of the PWM signal to determine the duty cycle of the incoming signal?

    Yes, that is possible.

    2. Is there a simpler way to use the GPIOTE, Timer, and PPI to measure the duty cycle of an incoming PWM signal?

    Using GPIOTE+TIMER+PPI is the way to go here.

    3. Since we are only interested in a duty cycle that EXCEEDS around 10 percent or is 10 percent or less, is there another approach?

    The approach will in either case be very similar(need to use GPIOTE+TIMER+PPI).

    4. Are there any code examples in SDK15 for any of these?

    There is no example in the SDK that does this, but there are several posts here at devzone with code examples.

    See these posts: Link 1, link 2 and link 3.

Related