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

The problem of SPI communication initiated by external interrupt using PPI

Hi, Nordicsemi

At present, although SPI uses easy DMA when reading and sending data, in the actual use scenario, I still use gpiote to detect the interrupt pin of the sensor, and polling the flag bit of the interrupt signal in the main program to trigger reading data. In this way, when polling to read data, it is bound to be interrupted by the Bluetooth protocol stack, resulting in the read sensor data is not continuous. It's just the continuous and complete data that customers need.

So,

1. Can I use PPI module to trigger SPI read / write task with gpiote interrupt event as trigger condition?

2. If you can, can you briefly describe the process or provide simple routines?

3. If PPI + gpiote is used to trigger SPI read-write, can it solve the problem of SPI read-write discontinuity?

4. If PPI + gpiote is used to trigger SPI read / write, will it affect the part that I didn't want to be triggered in this way?

I look forward to hearing from you soon.

Best regards!

June6

Parents
  • Can I use PPI module to trigger SPI read / write task with gpiote interrupt event as trigger condition?

     Yes. 

    If you can, can you briefly describe the process or provide simple routines?

     You must first initialize the SPIM peripheral driver and configure the proper settings for your transfer, ie. frequency , pointer to rx/tx buffers, length of buffers, SPI polarity, etc. The standard SPIM driver API has all that you need. 

    Then you connect the GPIOTE IN_EVENT to the SPIM TASKS_START. Use the PPI example as a reference for how to connect an event to a task. 
    Use nrfx_spim_start_task_get to get the address of the SPIM TASKS_START. 

    If PPI + gpiote is used to trigger SPI read-write, can it solve the problem of SPI read-write discontinuity?

    Yes, but you need to process the buffers at some point. The SPIM is double-buffered so that you can prepare the next buffer immediately after the STARTED event has fired. 

    If PPI + gpiote is used to trigger SPI read / write, will it affect the part that I didn't want to be triggered in this way?

     I don't know what you don't want to get triggered. You need to elaborate. 

  • When there is an external interrupt signal, I only need to perform the operation of reading one register of the external sensor, and I do not want to affect the other parts. Does this mean I need to turn off PPI and clear all event and task addresses when I don't want to do this?

    And, is the module used by the SPI in the peripheral routine a SPIM module?

Reply
  • When there is an external interrupt signal, I only need to perform the operation of reading one register of the external sensor, and I do not want to affect the other parts. Does this mean I need to turn off PPI and clear all event and task addresses when I don't want to do this?

    And, is the module used by the SPI in the peripheral routine a SPIM module?

Children
No Data
Related