STML151RB I2C start condition sent but SB not set
I have found out that it is a GPIO configuration issue. Using this code it turned out that my line:

GPIO_PinAFConfig(GPIOB, GPIO_AF_I2C1, GPIO_Pin_6 | GPIO_Pin_7);


set registers incorrectly. The correct way to setup I2C on PB6/PB7 is:

GPIOB-&gt;AFR[0] |= ( 1 &lt;&lt; 30 ) | ( 1 &lt;&lt; 26); // P6/P7 =&gt; AF4


Now I2C works fine.

UPDATE

Ahh.... the joys of C type safety. The proper invocation of ST library function is:

GPIO_PinAFConfig(GPIOB, GPIO_PinSource6, GPIO_AF_I2C1);
GPIO_PinAFConfig(GPIOB, GPIO_PinSource7, GPIO_AF_I2C1);



GPIO_Pin_6 and GPIO_PinSource6 are different defines
Pin argument comes second
Alternate functions argument comes third
Pins have to be configured one-by-one


Lesson learned: use enums for your own code arguments instead of magic numbers!