cancel
Showing results for 
Search instead for 
Did you mean: 

I2C3 interrupt not working

edgar
Associate II
Posted on August 29, 2013 at 15:54

Hi all,

I have some problems with I2C3 interrupts, I have enabled the interrupt but the handler interrupt never executes. Here is the interrupt configuration:

NVIC_InitTypeDef NVIC_InitStructure;
/* Configure the I2C event priority */
NVIC_InitStructure.NVIC_IRQChannel = I2C3_EV_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);

And here is the interrupt handler:

/**
* @brief Interrupt handler for i2c interface.
* @param None
* @retval None
*/
void I2C3_EV_IRQHandler(void)
{
STM_EVAL_LEDInit(0); // Enciende led rojo
vTaskDelay(5000);
switch(I2C_GetLastEvent(I2C3))
{
case I2C_EVENT_SLAVE_RECEIVER_ADDRESS_MATCHED :
break;
case I2C_EVENT_SLAVE_BYTE_RECEIVED:
i2c_read_packet[Rx_Index] = I2C_ReceiveData(I2C3); // Store the packet in i2c_read_packet.
Rx_Index++;
break;
case I2C_EVENT_SLAVE_STOP_DETECTED :
Rx_Index = 0;
packets_recv_i2c++;
i2cProcessPacket();
break;
case I2C_EVENT_SLAVE_TRANSMITTER_ADDRESS_MATCHED:
I2C_SendData(I2C3, i2c_packet_to_send[0]);
Tx_Index++;
break;
case I2C_EVENT_SLAVE_BYTE_TRANSMITTED:
I2C_SendData(I2C3, i2c_packet_to_send[Tx_Index]);
Tx_Index++;
break;
case I2C_EVENT_SLAVE_ACK_FAILURE:
Tx_Index = 0;
packets_sent_i2c++;
break;
default:
break;
}
}

Any idea? BR, Edgar.
0 REPLIES 0