cancel
Showing results for 
Search instead for 
Did you mean: 

I2C Busy after reset

YuriCh
Associate II
Posted on December 11, 2017 at 10:51

Hello!

i am working with the STM32F437IIT6, i have an issue regarding  the I2C.

While working with some device on the I2C bus i can expirience a situation in which the busy bit in the SR2 register is always high.

when i try to deal with it by re initializing the I2C channel the busy bit stays on and comms on this channel are not working. i also tried reinitializing the GPIOs and the RCC (you can see my re init function):

*********************************

  HAL_I2C_DeInit(&hi2c1);

  HAL_I2C_DeInit(&hi2c2);

 

  HAL_RCC_DeInit();

  SystemClock_Config();

 

  HAL_Init();

  MX_GPIO_Init();

  MX_I2C1_Init();

  MX_I2C2_Init();

 

  HAL_Delay(150);

*********************************

on the other hand, if i restart the MCU the bit returns to low state and the comms work fine once again.

could you please advise on how do i efectivley restart the I2C channel? what am i doing wrong?

1 REPLY 1
Posted on December 11, 2017 at 11:14

Use I2C_CR1.SWRST or RCC_APB1RSTR.I2CxRST.

I don't Cube.

JW