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

GPIO per-pin DETECT signal available?

NRF51822 RM 3.0 section 14.1 states each GPIO pin has DETECT, but where is the register to read per-pin detect?

From the manual: "Each pin has a separate DETECT signal, and the default behaviour is that the
DETECT signal from all pins in the GPIO Port are combined into a common DETECT signal"

I cannot find any information on setting up the non-default per-pin DETECT signal but would like to read the per-pin DETECT.

Is the reference manual wrong about this?

Cheers

Philip

  • well the IN register reads the current state of the pins, is that what you want? Or do you want an event generated on a single pin DETECT? If you want the latter you can have up to 4 pins selected in the GPIOTE module (see section 15) and generate events and interrupts on edge changes. Note that's a higher power mode, details about that power consumption are in the product sheet for the actual chip, not the reference manual which is generic to the series. 

    If you use the much newer nrf52832, and this is from memory, it has a LATCH register which does exactly that and latches any pin detects so you can find out what *was* detected and not just read IN which tells you what *is* the current state. 

    Is there a reason you're sticking to the, now, much older chip? The nRF52 has loads of little improvements like this. 

  • Thanks RK. I am familiar with the items you mention.

    Just to be clear:

    So the NRF51 does not support separate DETECT signals as stated in the manual?  All DETECT signals are OR'ed together and presented in NRF_GPIOTE->EVENTS_PORT as a single bit?

    Cheers

    Philip

  • Each pin does have a separate DETECT signal and you can configure them on and off and positive or negative detects, however the only signal which is output from the GPIO module for you to use is the ORed DETECT. So I supposed you could complain about the words 'by default' but really .. that's rather splitting hairs. 

    This is again why I like the nRF52 which at least lets you have access to what was DETECTed, not I think that I've ever used that feature. 

Related