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:

  1. https://github.com/targence/bot_matrix_i2c_master

  2. https://github.com/targence/dreamsteep_i2c_master

  3. https://github.com/targence/cd5c97a0_i2c_master

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?

carduinostm32i2cstm32f1

Answers

comments powered by Disqus