Dialog Semiconductor customer support - i2c; peripheral; interrupt; irq https://support.dialog-semiconductor.com/resource-keywords/i2c-peripheral-interrupt-irq en I2C主人使用中断模式 https://support.dialog-semiconductor.com/i2c-master-mode-using-interrupts

Hi. I am working through some I2C code, and we would like to be able to trigger reads and writes from/to the I2C interface and use interrupts to handle completed events. We don't wish to have I2C interrupts on all the time, nor do we wish to deal with all the various interrupts (Tx Empty, Rx Over, etc.)--just Rx Full, mostly.

For instance, we would like to trigger 30 reads (that number could change) and get an I2C interrupt when the receive FIFO exceeds the threshold (Rx full condition).

I can't get the R_RX_FULL interrupt to fire, however.

Here's what I've tried so far:

  • In i2c_init( ), call NVIC_DisableIRQ(I2C_IRQn) and NVIC_SetPriority(I2C_IRQn,1) just for initial setup
  • Unmask the Rx FIFO Full Interrupt with
    SetWord16(I2C_INTR_MASK_REG, 0x0000);
    SetBits16(I2C_INTR_MASK_REG, R_RX_FULL, 1);
  • Clear pending IRQs with NVIC_ClearPendingIRQ(I2C_IRQn);
  • When the Rx FIFO Full interrupt is desired to be enabled, I first set the Rx FIFO threshold with SetWord16(I2C_RX_TL_REG, numBytesToRx - 1).
  • Then I send the read commands in a tight for loop. This loop should be done much faster than the bytes can be read from the I2C interface.
  • I then enable and clear pending IRQs with NVIC_EnableIRQ(I2C_IRQn) and NVIC_ClearPendingIRQ(I2C_IRQn).
  • Any thoughts? Am I doing something wrong here?

Device: 
Tue, 07 Jun 2016 19:31:01 +0000 joe.brackman 3826 at https://support.dialog-semiconductor.com https://support.dialog-semiconductor.com/i2c-master-mode-using-interrupts#comments