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

How to measure two wave delay?

I have two square waveforms coming out of a pin each. I want to measure the delay between them. Which command should I use? How can I do this?

Parents
  • Hi,

    If you are willing to use two extra GPIO ports, I think it should be possible to achieve what you want by using GPIOTE, PPI and TIMERS.

    Connect the output pins to two new input pins that are configured to sense rising edge of a signal using GPIOTE. Use PPI channels to connect the sensing event of one input pins to the start task of a timer, and the sensing event of the second input pin to the stop and capture task of the timer allows you to measure the delay between the rising edge of the two output pins.

    I have created an example showing how this can be achieved using the drivers in SDK 12.3. Note that you have to connect PIN_OUT_1 to PIN_IN_1 and PIN_OUT_2 to PIN_IN_2 using cables. The timer runs at at 16 MHz, and the result reported is number of ticks. To convert it to seconds you can divide by 16000000. Let me know if anything is unclear.

    delay_between_pin_rise.zip (SDK12.3.0)

    delay_between_pin_rise_sdk11.zip

    Best regards,

    Jørgen

Reply
  • Hi,

    If you are willing to use two extra GPIO ports, I think it should be possible to achieve what you want by using GPIOTE, PPI and TIMERS.

    Connect the output pins to two new input pins that are configured to sense rising edge of a signal using GPIOTE. Use PPI channels to connect the sensing event of one input pins to the start task of a timer, and the sensing event of the second input pin to the stop and capture task of the timer allows you to measure the delay between the rising edge of the two output pins.

    I have created an example showing how this can be achieved using the drivers in SDK 12.3. Note that you have to connect PIN_OUT_1 to PIN_IN_1 and PIN_OUT_2 to PIN_IN_2 using cables. The timer runs at at 16 MHz, and the result reported is number of ticks. To convert it to seconds you can divide by 16000000. Let me know if anything is unclear.

    delay_between_pin_rise.zip (SDK12.3.0)

    delay_between_pin_rise_sdk11.zip

    Best regards,

    Jørgen

Children
Related