AnsweredAssumed Answered

I2C Bus not pulsing after the start condition

Question asked by nguyen.ngoc on Oct 31, 2012
Latest reply on Feb 25, 2013 by Amel N
I am communicating with a slave device and after the generation of the start condition, I am not seeing SCL and SDA pulsing. Below is the code: 

void DS2482_Init(void)
        GPIO_InitTypeDef    GPIO_InitStructure;
        I2C_InitTypeDef     I2C_InitStructure;
        /* Enable peripheral clock */
        RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C2, ENABLE);
        /* Enable GPIOB clock */
        RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
        /* Configure I2C2_SCL and I2C2_SDA */
        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;
        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
        GPIO_Init(GPIOB, &GPIO_InitStructure);
        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
        GPIO_Init(GPIOB, &GPIO_InitStructure);
        /* Enable I2C2 reset state */
        //RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C2, ENABLE);
        /* Release I2C2 from reset state */
        //RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C2, DISABLE);
        /* DS2482 peripheral configuration */
        I2C_InitStructure.I2C_Mode = I2C_Mode_I2C; 
        I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
        I2C_InitStructure.I2C_OwnAddress1 = DS2482_I2C_ADDRESS;
        I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
        I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
        I2C_InitStructure.I2C_ClockSpeed = DS2482_I2C_SPEED;

        /* enable the I2C peripheral */
        I2C_Cmd(DS2482_I2C, ENABLE);
        I2C_Init(DS2482_I2C, &I2C_InitStructure);       

int DS2482_channel_select(int channel)
    // select the 1-wire channel on DS2482-800
    // Returns: TRUE if channel selected
    //          FALSE if device not detected

    unsigned char ch, ch_read, check;
    /* while the bus is busy */
    while(I2C_GetFlagStatus(DS2482_I2C, I2C_FLAG_BUSY));
    /* send START condition */
    I2C_GenerateSTART(DS2482_I2C, ENABLE);
    /* test on EV5 and clear it */
    while(!I2C_CheckEvent(DS2482_I2C, I2C_EVENT_MASTER_MODE_SELECT));
    //I2C_AcknowledgeConfig(DS2482_I2C, ENABLE);
    /* Send DS2482 address for write */
    I2C_Send7bitAddress(DS2482_I2C, DS2482_I2C_ADDRESS, I2C_Direction_Transmitter);