AnsweredAssumed Answered

I2C interrupt issue in LPC1788

Question asked by Parth Choksi on Mar 9, 2018
Latest reply on Mar 16, 2018 by danielholala

I've got an LPC1788 that refuses to generate an interrupt or set the Serial Interrupt (SI) flag in I2C1->CONSET after successfully generating a start condition for a Master Transfer.

 

My current setup has an LPC1788 with nothing on the I2C bus except the external pullups (Note: I can drive the lines manually if I set them to GPIO mode and write the registers, so there's nothing wrong hardware wise). My code compiles and runs, and works with other peripherals, but I've stripped out all of the code to just the I2C Code. No slaves have been initialized.

 

I am also attaching my code. 

can anyone get me out of this problem?

 

int main()

{

/*********** Pin discreption ***************/

PINSEL_ConfigPin (0, 0, 3); // SDA Pin for Port 0   
PINSEL_ConfigPin (0, 1, 3); // SCL Pin for Port 1
PINSEL_SetOpenDrainMode(0, 0, ENABLE);
PINSEL_SetOpenDrainMode(0, 1, ENABLE);

 

// Initialize I2C 
I2C_Init( I2C1 , 100000);         // Initialize I2C1 at 100Khz clock rate

 

/* Enable I2C operation */

 

I2C-> CONSET  = 0x40; 

 

// Disable interrupt to ensure code stay stuck in while loop. No change with either On or Off

//NVIC_EnableIRQ(I2C1_IRQn);
//NVIC_SetPriority(I2C1_IRQn,((0x02<<3)|0x01));

 

 

// Reset STA, STO, SI
I2Cx->CONCLR = I2C_I2CONCLR_SIC;
I2Cx->CONCLR = I2C_I2CONCLR_STOC;
I2Cx->CONCLR = I2C_I2CONCLR_STAC;

// Enter to Master Transmitter mode 
I2Cx->CONSET = I2C_I2CONSET_STA;   // Generate start bit

 

whille(1);

}

Outcomes