0
\$\begingroup\$

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;
\$\endgroup\$
2
  • \$\begingroup\$ Usually microcontrollers have pin multiplexing between GPIO and module functionality. Perhaps you have to change those settings so that the I2C module is what the pins are configured for. \$\endgroup\$ Commented Mar 19, 2013 at 19:27
  • \$\begingroup\$ Which PIM are you using with your Explorer 16? \$\endgroup\$ Commented Mar 19, 2013 at 20:30

1 Answer 1

1
\$\begingroup\$

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
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.