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

Not enough timers

My application uses the Softdevice, app_timer and app_pwm. So all timers are in use, but I have to measure two more pwm signals on two input pins. (Those come from HC-SR04 sonar sensors)

I have set up interrupt handlers on raising and falling edges but now I need a time source which is precise enough. When I just use the RTC1 counter which is used by app_timer I get wrong results most of the time. I guess app_timer resets the counter sometimes.

Maybe it would be possible to modify app_timer so I can get a free running timer?(app_timer would have to save the counter value to some variable before reset or something)

So all I need is another time source that just counts up and is at least as precise as the RTC.

Parents
  • Ok, my plan was the following:

    PPI channel 1: Reset timer on raising edge on pin X.

    PPI channel 2: Capture timer value on falling edge on pin X.

    So I get the duration between rasing and falling edge. Brilliant.

    Problem:

    I only have one event per pin. I cant have one event for raising and one for falling edge. At least that is how I understand nrf_drv_gpiote.c.

    What can I do?

    I could connect the pwm signal to two pins so I can get two events for raising/falling edges, but is there a way without modifying the hardware?

Reply
  • Ok, my plan was the following:

    PPI channel 1: Reset timer on raising edge on pin X.

    PPI channel 2: Capture timer value on falling edge on pin X.

    So I get the duration between rasing and falling edge. Brilliant.

    Problem:

    I only have one event per pin. I cant have one event for raising and one for falling edge. At least that is how I understand nrf_drv_gpiote.c.

    What can I do?

    I could connect the pwm signal to two pins so I can get two events for raising/falling edges, but is there a way without modifying the hardware?

Children
No Data
Related