I2C on explorer 16 board not working

i2coscilloscopepic

I am using the Explorer 16 Board for building a Accel connected by I2C .
Currently I have only the I2C part done and I am trying to tap scl1 & sda1 using oscilloscope. The accel has to connected yet to the the MCU!

But on oscilloscope I dont see any signals on both SCl1,SDA1, any help ? here is the code :

UINT config1 = 0,i=0;
UINT config2 = 0;

/* Turn off I2C modules */
CloseI2C1();    //Disbale I2C1 mdolue if enabled previously

ConfigIntI2C1(MI2C_INT_OFF);  //Disable I2C interrupt

config1 = (I2C_ON  | I2C_7BIT_ADD );
config2 = 157;
OpenI2C3(config1,config2);   //configure I2C1

IdleI2C1();
StartI2C1();
while(I2C1CONbits.SEN );  //Wait till Start sequence is completed
MI2C1_Clear_Intr_Status_Bit;

Best Answer

The documentation for OpenI2Cx() says that it configures the I2C control register and the I2C baud rate generator. You still need to set up the GPIO lines themselves.

What I did in my PIC24 I2C application is:

  • Configure PPS (may not be necessary for you)
  • Disable ADC on the I2C lines
  • Set the TRIS registers on the I2C lines as inputs