AnsweredAssumed Answered

STM32l152c Discovery board, I2C Slave problem

Question asked by gardner.julian on Oct 9, 2015
I have I2C slave working to a point but have an event code which causes the isr to trigger continuously. Simplified code below.

Now I am using a "Total Phase Aardvark" to ask for 8 bytes of data and on the scope i see all the data and is correct, including the NAK on the last byte.

My problem is at this point i get ISR calls with the event code 0x60480.

What is this and how do i clear it?

joolz

static void I2C_EV_IRQHandler(I2C_Driver_Def *driver)
{
uint32_t event = I2C_GetLastEvent(driver->I2C);
 
  switch (event) {
    case I2C_EVENT_SLAVE_RECEIVER_ADDRESS_MATCHED:
      break;
 
    case I2C_EVENT_SLAVE_BYTE_RECEIVED:
      I2C_ReceiveData(driver->I2C);
      break;
 
    case I2C_EVENT_SLAVE_TRANSMITTER_ADDRESS_MATCHED: // prepare for transfer response
      break;
 
    case I2C_EVENT_SLAVE_BYTE_TRANSMITTED:
        I2C_SendData(driver->I2C, 0xff);
      break;
 
    case I2C_EVENT_SLAVE_BYTE_TRANSMITTING:
      break;
 
    case I2C_EVENT_SLAVE_STOP_DETECTED:
      I2C_ClearFlag(driver->I2C, I2C_FLAG_STOPF);
      break;
 
    case I2C_EVENT_SLAVE_ACK_FAILURE:
      break;
 
    default:    // Error flag?
      break;
  }
}

Outcomes