Question
STM32F102C8T I2C, GPIOB set up properly but GPIO never gets in START (drain) condition
Posted on August 05, 2016 at 09:07
Hi,
I have a problem regarding I2C comm on STM32F102. I am using CubeMX to generate init code. Every time I try to transmit as master it successfully sets START bit in CR1, and waits until SB in SR1 is sets to 1 (which is) and executes:/* Send slave address */
hi2c->Instance
->DR
= I2C_7BIT_ADD_WRITE(DevAddress);Then nothing happens on GPIO - line remains HIGH and it returns HAL_TIMEOUT in/* Wait until ADDR flag is set */
if
(I2C_WaitOnMasterAddressFlagUntilTimeout(hi2c, I2C_FLAG_ADDR, Timeout) !=HAL_OK
)If you look at I2C->SR1 ARLO (arbitration lost) is set. I have no idea what else could I check to get the bus working. The same code works on nucleo L053R8 board (which is connected to the same line - so pullups and everything else is OK).
You can take a look at entire configuration - CUBE pins, CUBE ''configuration'', and registers of MCU after hi2c->Instance
->DR
= I2C_7BIT_ADD_WRITE(DevAddress); command: Thanks for your help! #i2c #hal #stm32f102