This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nRF5 can or cannot generate GPIO interrupts at MHz frequency?

Hi,

I would like to generate interrupts triggered by an input clock pin at 2 MHz to sample an 8-bit digital signal. I am trying this with an nRF5340. Up to this point, I was not successful. Searching in the forum, I found that the GPIO ports run at 16 MHz (ticket 1, ticket 2). On one hand, In ticket 2 there is a good explanation considering the interrupt latency of the ARM Cortex-M microcontrollers, which apparently makes it impossible to trigger interrupts at frequencies in the MHz range with the GPIO clock of 16 MHz. On the other hand, the author of ticket 1 says that it was possible to generate interrupts triggered by reference signals with frequencies as high as 4 MHz (Not clear if at these high frequencies every cycle of the input clock triggers one interrupt). 

Finally, is it possible or not to generate interrupts at the MHz frequency? 

Is there a Nordic BLE module that has GPIO running at higher frequencies than 16 MHz?

Thanks.

Parents
  • It is very inefficient, it will require much CPU time and high current consumption to continously sample an input at 2MHz. You may not have time to process anything else if you sample an input this way, so I suggest to try to solve this in a different way. For instance maybe you can configure an SPI slave on the nRF5340, then connect the clock pin to the SPIS.SCK pin, and data pin to the SPIS.MOSI pin, then the data will be clocked into the SPIS buffer when there is data on the clock pin automatically without the CPU needing to read the data pin.

    Kenneth

  • Kenneth has a good suggestion, although that solution only handles a single bit for each SPIS available. The trick is to get all 8 bits into a single bit, and that can be done with an 8-bit serialiser (parallel to serial) which can run at 2x8=16MHz or faster. A 16MHz clock has to be generated, synchronous to the 2MHz clock, so preferably by the external device, and that clock is the one input to the SPI Slave. A simpler solution is to instead use a nRF52 16MHz SPI Master, which generates the required 16MHz clock for you, and that clock now needs to be synchronised with the external 2MHz clock, or better still generate that 2MHz synchronous clock from the nRF52 and feed it to the external device. A typical serialiser is cd00161471.pdf although you might prefer a single-ended output with a different device.

Reply
  • Kenneth has a good suggestion, although that solution only handles a single bit for each SPIS available. The trick is to get all 8 bits into a single bit, and that can be done with an 8-bit serialiser (parallel to serial) which can run at 2x8=16MHz or faster. A 16MHz clock has to be generated, synchronous to the 2MHz clock, so preferably by the external device, and that clock is the one input to the SPI Slave. A simpler solution is to instead use a nRF52 16MHz SPI Master, which generates the required 16MHz clock for you, and that clock now needs to be synchronised with the external 2MHz clock, or better still generate that 2MHz synchronous clock from the nRF52 and feed it to the external device. A typical serialiser is cd00161471.pdf although you might prefer a single-ended output with a different device.

Children
No Data
Related