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

Minimum GPIOTE "low accuracy" pulse width

I have a device with a programmable output pulse width for its data ready signal. I need to be able to reliable receive the pulse so I don't miss any interrupts, and I'd like to do that in the minimum possible time so I can send the device a "power down" command as quickly as possible.

I'm seeing interrupt latency as high as 60uS while the nRF52840 is "advertising". Is there any sort of maximum guaranteed latency for GPIOTE pins in "low accuracy" mode?

  • FormerMember
    0 FormerMember

    Updated answer 16.06.2017: The reason why a longer pusle width is required for GPIOTE PORT events compared with PIN events is the following: When using port events, GPIOTE_IRQHandler in nrf_drv_gpiote.h checks the status of each gpio to figure out which gpio that was trigged when the PORT event occurred.

    Since the radio has higher priority than GPIOTE when using the softdevice, software processing of the GPIOTE interrupt is delayed until the radio has finished its operations.

    Therefore, since the GPIOTE handler checks the state of each pin for PORT events, the triggered pin has to stay high (or low) until that operation is finished.

    If you only need to know that a PORT event occurred it is not necessary to check the status of each gpio.

    I would recommend you to modify GPIOTE_IRQHandler so that it fits your application and doesn't check the status of each gpio, just reports that a PORT event occurred.

  • Kristin -

    Thanks for the response, but this is for handling an input signal from an external device, not for generating an output signal.

    I have an external chip which performs data acquisition. Once every 100ms it asserts its own, external to the nRF52840, "Ready" signal. That signal is connected to a GPIO pin. When that signal is asserted, data must be retrieved or it will be lost.

    The issue is that if I use "high accuracy", which consumes more power, the "Ready" signal pulse can be as short as 2uS and the interrupt will be posted to the ISR typically within 10uS. In "low accuracy" mode, which uses "PORT" interrupts instead of "PIN" interrupts and consumes less power, the "Ready" pulse must be more than 50 or 60uS long just to guarantee that the 0 -> 1 transition on that GPIO pin will even be recognized and generate an interrupt at all.

  • FormerMember
    0 FormerMember in reply to FormerMember

    Okay, I see. In low accuracy mode, is the chip in system OFF? If so, the chip will have to wake up. However, 50-60 uS sounds like quite a bit.

  • No. The main loop does have the chip executing WFI, but since GPIOTE is based on a PORT interrupt, the chip should awaken from WFI and service PORT interrupt.

    As an aside, the pin is being triggered on the rising edge, so the GPIOTE driver should be able capture the state of the port and defer processing if the soft device were in the middle of something.

    As for 50-60uS, allowed to run long enough, some interrupts were requiring over 120uS for the transition to be captured.

Related