STM32F103C8T6 with libopenmc3, how to set i2c in master mode?

Alex Kulagin Source

I use STM32F103C8T6 ("blue pill") with libopenmc3. Trying to set i2c STM32 in master mode to read i2c sensor.

I've tried different options of code based on repositories I found on GitHub, but none of them works:




STM32 freezes as soon as we send data to i2c sensor, and we get no response from the sensor:

i2c_write_v1() and i2c_read_v1 goes into infinite loop.
/* Wait for master mode selected */

while (!((I2C_SR1(i2c) & I2C_SR1_SB)

    & (I2C_SR2(i2c) & (I2C_SR2_MSL | I2C_SR2_BUSY))));

Does anyone know how to solve this problem?



comments powered by Disqus