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

Automated sampling of an input GPIO via EasyDMA

I would like to sample a digital IO input from two IO's into the processor internal memory incrementally per every rising or falling edge of each of the signals. 

Is there a way to use GPIOTE IN via PPI to drive EasyDMA and get a memory buffer with the two io's pattern per any change. For example: { 0, 3, 2, 1, 2, 0, ... }?

Signals may alternate at rate of 10us-500us.

Signals are input from two motor encoders that we have on our circuit board.

Alternatively - is there a way to capture a timer value incrementally into memory using EasyDMA each time one of the above IO's changes? Hook GPIOTE as PPI input to trigger a timer capture transferred incrementally into a memory buffer?

  • Hi,

     

    two IO's into the processor internal memory incrementally per every rising or falling edge of each of the signals. 

    This would require a bit of fiddling, but it depends on what information you need. The GPIOTE IN can be configured to provide an event on the following:

    * Rising edge

    * Falling edge

    * Any change (toggle)

     

    If you need to detect both the amount of rising and falling edge individually, you'll need to use two GPIOTE channels per input, and externally connect two GPIOs to the signal.

     

    Is there a way to use GPIOTE IN via PPI to drive EasyDMA and get a memory buffer with the two io's pattern per any change. For example: { 0, 3, 2, 1, 2, 0, ... }?

    The nRF5 devices do not have a generic DMA channel, so it's not possible to get the GPIOTE IN count directly into memory.

    What you can do is to hook together the GPIOTE->IN event to a timer TASKS_COUNT, then you can manually trigger a TASKS_CAPTURE[n] (remember to do a TASKS_CLEAR afterwards) to read how many pulses you've gotten since the last time.

    Note that since you mention two signals, you have to use a separate TIMER instance, configured in COUNTER mode, for each signal in order to differentiate between the two, and even more if you need to distinguish between rising and falling edges.

     

    Best regards,

    Håkon

Related