AnsweredAssumed Answered

I2C2 Busy flag after clock enable

Question asked by Germain on Aug 25, 2015
Latest reply on Aug 28, 2015 by Mikk Leini
I know it's a recurring problem. I could'nt make I2C2 work on my STM32F401VET.

When I use RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C2, ENABLE);
I2C2->SR2 =2

No matter what I do.
I try many work around proposed on this forum but nothing works.

Another weird thing happening is when I set my pin SDA on PB3 to AF, SDA go down.
GPIO_InitStructure.GPIO_Pin           = GPIO_Pin_10;     // use PB3 and PB10
GPIO_InitStructure.GPIO_Mode           = GPIO_Mode_AF;                // set pins to alternate function
GPIO_InitStructure.GPIO_Speed           = GPIO_Speed_50MHz;           // set GPIO speed
GPIO_InitStructure.GPIO_OType           = GPIO_OType_OD;               // set output to open drain --> the line has to be only pulled low, not driven high
GPIO_InitStructure.GPIO_PuPd           = GPIO_PuPd_UP;                // enable pull up resistors
GPIO_Init(GPIOB, &GPIO_InitStructure);                                    // init GPIOB
GPIO_InitStructure.GPIO_Pin           = GPIO_Pin_3;
GPIO_InitStructure.GPIO_Mode           = GPIO_Mode_AF;
GPIO_Init(GPIOB, &GPIO_InitStructure);      // SDA =HIGH

GPIO_PinAFConfig(GPIOB, GPIO_PinSource3,     GPIO_AF_I2C2); // SDA =LOW
GPIO_PinAFConfig(GPIOB, GPIO_PinSource10,      GPIO_AF_I2C2); // SCL

Someone has faced the same issues ?