5 Replies Latest reply on May 18, 2015 12:30 PM by ArvindS_76

    I2C

      Hello,

       

      I would like to use the i2c bus to talk to a sensor. With arm cortex m3 MCU I am use of setting up i2c like below:

      void configure_I2C2(void)

      {

        I2C_InitTypeDef I2C_InitStructure;

        //I2C2 peripheral configuration.

        I2C_InitStructure.I2C_Mode = I2C_Mode_I2C; //I2C communications instead of SM bus.

        I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;  //I2C fast mode Tlow/Thigh = 2.

        I2C_InitStructure.I2C_OwnAddress1 = 0x01; //Can be anything when using just one slave device.

        I2C_InitStructure.I2C_Ack = I2C_Ack_Enable; //Acknowledgement is enabled.

        I2C_InitStructure.I2C_AcknowledgedAddress =

        I2C_AcknowledgedAddress_7bit; //Specifies a 7-bit acknowledge address versus 10-bit.

        I2C_InitStructure.I2C_ClockSpeed = 100000; //Clock speed is 400KHz

        /* Enable the I2C2 peripheral */

        I2C_Cmd(I2C2, ENABLE);

        I2C_Init(I2C2, &I2C_InitStructure);

      }


      With the broadcom unit i do not see any header files with such data or any example?


      Is there any good example out there that i can use as a guide?

      or anyone who can help?

       

      Regards,

      Luke.