Using GPIOTE to monitor PWM generation on the same output pin

Dear team,

I would like to have a function to measure the pulse width of the pulse that I generated and  wonder if that is possible.

For example, I can generate one pulse of 50us, and have the GPIOTE to detect the rising edge and falling edge.

I replicate this pulse into two pins 4, and 28 and set GPIOTE on these two pins to trigger two time captures via ppis.

I notice that prior to have gpiote detecting the transition, the PWM sets output  pins direction to output, but when I 

init with gpiote then the gpiote switch the pins direction to input.  

The problem I'm observing is, when I have GPIOTE attach to the same pin of the PWM output pin, the last pulse of the PWM

gets elongated, as if the PWM module lets the output floating when it stops, high-z. I can shorten this by changing pullup/pulldown option. If I

have several pulses, only the last pulse gets affected.  nrfx_gpiote_input_configure() changes GPIO.PIN.CNF and GPIO.DIR 

all into inputs for particular pin; I changed back but that didn't affect the waveform. The only way I could undo the

problem is disconnecting the GPIOTE by setting the GPIOTE.CONFIG[x].mode = disabled. I'm wondering why if I generate multiple pulses,

it's always the last pulse that have the problem but not other pulses. Thanks.

I'm using ncs v2.7.0, shell_module example as the starting point running on nrf52840 devkit. I can upload this experiment source code if needed.

Parents Reply Children
No Data
Related