AnsweredAssumed Answered

STM32F105 I2C1 problem

Question asked by Nayani.Partha on Mar 15, 2015
Latest reply on Mar 17, 2015 by Nayani.Partha
Hi guys,
Sorry to trouble you frequently. Can't help!! I have an STM32F105VC (100 pin device). Trying to use I2C bus on pins 95, 96. This is I2C1 (PB8, PB9) and requires remap (as per documentation). Did the following init. Not able to read or write. Here is the init code. Same code without remap but on I2C2 worked on a 64 pin device (STM32F103RC).

void I2C1_Configure (void)
{
    // First remap pins.

    GPIO_PinRemapConfig(GPIO_Remap_I2C1,ENABLE);
    GPIO_InitStructure.GPIO_Pin =  I2C_EE_SCL | I2C_EE_SDA;
//    GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_8 | GPIO_Pin_9;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;
    GPIO_Init(GPIOB, &GPIO_InitStructure);

    /* I2C configuration */
    I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
    I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
    I2C_InitStructure.I2C_OwnAddress1 = 0xF0;
    I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
    I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
    I2C_InitStructure.I2C_ClockSpeed = 80000;

    I2C_Init(I2C1, &I2C_InitStructure);
    /* I2C Peripheral Enable */
    I2C_Cmd(I2C1, ENABLE);
}

Outcomes