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

External Interrupt to trigger I2C Write Using PPI

Can I use an external edge-triggered (negative edge) interrupt (on a GPIO pin) to trigger an I2C write via PPI? If so, do the I2C registers need to be reloaded each time? It would be great if these could be setup once and remain static. This is an application in which the I2C write is used to clear an interrupt coming from an external chip. Any example code would be appreciated.

Parents
  • Hi Mike, 

     

    Can I use an external edge-triggered (negative edge) interrupt (on a GPIO pin) to trigger an I2C write via PPI?

     Yes, a GPIOTE event(e.g. EVENTS_IN[0]) can be used to trigger the  TASKS_STARTTX of the TWIM peripheral.  

    If so, do the I2C registers need to be reloaded each time?

    If you're only using the TWIM peripheral on the nRF52 device to send a clear interrupt command, then you will only have to set up the  TXD.PTR of the TWIM peripheral to point to the data to be sent over the TWI bus. If you're using the TWIM to send other types of data, then you would have to make sure that the TXD.PTR always points to the buffer with the clear interrupt command after you finish other transmissions. 

    This is an application in which the I2C write is used to clear an interrupt coming from an external chip. Any example code would be appreciated.

     I am afraid that we do not have any example for this exact scenario, but the PPI Example should be good starting point. 

    Best regards

    Bjørn

Reply
  • Hi Mike, 

     

    Can I use an external edge-triggered (negative edge) interrupt (on a GPIO pin) to trigger an I2C write via PPI?

     Yes, a GPIOTE event(e.g. EVENTS_IN[0]) can be used to trigger the  TASKS_STARTTX of the TWIM peripheral.  

    If so, do the I2C registers need to be reloaded each time?

    If you're only using the TWIM peripheral on the nRF52 device to send a clear interrupt command, then you will only have to set up the  TXD.PTR of the TWIM peripheral to point to the data to be sent over the TWI bus. If you're using the TWIM to send other types of data, then you would have to make sure that the TXD.PTR always points to the buffer with the clear interrupt command after you finish other transmissions. 

    This is an application in which the I2C write is used to clear an interrupt coming from an external chip. Any example code would be appreciated.

     I am afraid that we do not have any example for this exact scenario, but the PPI Example should be good starting point. 

    Best regards

    Bjørn

Children
No Data
Related