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

Simultaneous use of GPIOTE and other peripheral

Short version: can I use a pin both as a GPIO input to trigger GPIOTE PPI event, and as SPI MISO *at the same time*?

Detailed version:

I want to use the SPI peripheral to implement a serial driver for another protocol. The protocol is single wire, the nrf52840 is master, and slaves may want to send messages or replies to the master, by driving the pin low.

Until now, I've let the pin be a GPIO while idle. On falling edge, the GPIOTE IRQ sets the pin to SPI miso (and other appropriate settings), and receives data. This works fine, until another IRQ is running and blocking the GPIOTE IRQ for a millisecond or so. Then the IRQ runs too late and misses bits.

So I am trying to implement all this with PPI.

Is it possible (and supported) to have the same pin configured as GPIOTE input, and SPI miso *at the same time*, and get the PPI to react on GPIOTE and start the SPI transfer?

This section of the GPIO chapter seems to imply that it is possible, but it isn't explicit enough for me to trust it without a confirmation: 

> Other peripherals in the system can attach themselves to GPIO pins and override their output value and configuration, or read their analog or digital input value, see Figure 1.

I cannot see on the Figure 1 where the signal is taken to other peripherals. Maybe because the figure resolution is so low.

Parents Reply
  • This is an unusual use case, and I don't think it has been tested by us. In general we recommend assigning only one peripheral per pin.

    Are you doing the switch between transactions or during a transaction? If it's the former then you can use the CS signal instead to trigger the switch, that should give you a bit more time. If it's the latter then I don't think that it would be doable. Do you know what IRQ that is blocking the switch when it's failing?

Children
Related