cancel
Showing results for 
Search instead for 
Did you mean: 

I2C2 doesn't work

NASI
Senior

Hello,

I am working with a custom board, using STM32F105VC.

The board has some LED drivers, which they use I2C1 and I2C2.

I2C1 works fine but I2C2 doesn't work. Configuration for both I2C are the same.

 hi2c2.Instance = I2C2;

 hi2c2.Init.ClockSpeed = 100000;

 hi2c2.Init.DutyCycle = I2C_DUTYCYCLE_2;

 hi2c2.Init.OwnAddress1 = 0;

 hi2c2.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;

 hi2c2.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;

 hi2c2.Init.OwnAddress2 = 0;

 hi2c2.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;

 hi2c2.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;

 if (HAL_I2C_Init(&hi2c2) != HAL_OK)

 {

  Error_Handler();

 }

Do I need to enable something else?

In clock configuration, there is no setting for I2C1 and I2C2 peripherals. Why? (picture is attached)

Anyone can help me?

Thank you.

2 REPLIES 2
Imen.D
ST Employee

Hello @NASI​ ,

Did you checked the pins assignment/configuration and jumpers?

Have a look to the errata sheet related to the devices to check if you have the same conditions as described in the doc and have an impact.

Please keep me informed about your update.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
T J
Lead

make sure the pin speed is set to high or very high.

make sure all 4 pins have pull ups.