2007-08-29 06:33 AM
2011-05-17 12:43 AM
Hi,
I want to read 4 bytes from a I2C device using interrupts. After reading 4 bytes, I get continue an I2C interrupt with no event flag set (I2C_Getlastevent(I2C0) = 0). Any idea ? Kind regards Luc Vercruysse Source code in attachment.2011-05-17 12:43 AM
I don't know if you are still having this problem, but I had a similar behavior. This is the last method I call before my system really starts running.
Code exhibits behaviorvoid VIC_Initialize( void )
{
VIC_DeInit();
VIC_Config( DMA_ITLine, VIC_IRQ , 0 );
VIC_ITCmd( DMA_ITLine, ENABLE );
VIC_Config( ENET_ITLine, VIC_IRQ, 1 );
VIC_ITCmd( ENET_ITLine, ENABLE );
VIC_Config( I2C0_ITLine, VIC_IRQ, 2 );
VIC_ITCmd( I2C0_ITLine, ENABLE );
VIC_Config( EXTIT3_ITLine, VIC_IRQ, 5 ); // IMAGER_FRAME_VALID
VIC_ITCmd( EXTIT3_ITLine, ENABLE );
VIC_Config( EXTIT1_ITLine, VIC_IRQ, 4 ); // FIFO_HALF_FULL
VIC_ITCmd( EXTIT1_ITLine, ENABLE );
VIC_Config( EXTIT2_ITLine, VIC_IRQ, 6 ); // FIFO_FULL_FLAG
VIC_ITCmd( EXTIT2_ITLine, ENABLE );
}
Code does not exhibit behavior
void VIC_Initialize( void )
{
VIC_DeInit();
VIC_Config( DMA_ITLine, VIC_IRQ , 0 );
VIC_ITCmd( DMA_ITLine, ENABLE );
VIC_Config( ENET_ITLine, VIC_IRQ, 1 );
VIC_ITCmd( ENET_ITLine, ENABLE );
VIC_Config( EXTIT3_ITLine, VIC_IRQ, 5 ); // IMAGER_FRAME_VALID
VIC_ITCmd( EXTIT3_ITLine, ENABLE );
VIC_Config( EXTIT1_ITLine, VIC_IRQ, 4 ); // FIFO_HALF_FULL
VIC_ITCmd( EXTIT1_ITLine, ENABLE );
VIC_Config( EXTIT2_ITLine, VIC_IRQ, 6 ); // FIFO_FULL_FLAG
VIC_ITCmd( EXTIT2_ITLine, ENABLE );
VIC_Config( I2C0_ITLine, VIC_IRQ, 2 );
VIC_ITCmd( I2C0_ITLine, ENABLE );
}
All I did would move the I2C enable to the last. And everything works correctly. I move it up and I get the interrupts non-stop.