cancel
Showing results for 
Search instead for 
Did you mean: 

I2C1 & I2C2 Difference

Jdogk
Associate III

Hello, this is DK.
I am working on a project using stm32f429IIt6.

I'm currently having an I2C problem at the end of my project.
I2C1 uses PF 0, 1 / I2C2 uses PB 6, 7. The HW PCB completed, and the HW I2C pull up is the same.

In I2C1 HAL code, the entire initialization does not work, and if I2C2 is used with the same code, it works well.

I am using various Pheripherals such as TIM Interrupt. Is there any conflict?

Is there any difference between I2C1 and I2C2?

In the TIMER part, it appears to share APB1.

 

11 REPLIES 11
Amel NASRI
ST Employee

Hi @Jdogk ,

You mean I2C1 on PB6/7 and I2C2 PF0/1.

Is there any I2C error flag set when using I2C1?

Does your PCB allow you to use PB8/9 instead of PB6/7 for I2C1?

-Amel

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


@Jdogk wrote:

The HW PCB completed, and the HW I2C pull up is the same.


Please show the PCB schematic.

Have you used an oscilloscope and/or logic analyser to see what's happening on the wires?

And to add one more question:
> the entire initialization does not work,

What does that mean exactly?  How can the "initialization" not work?  How do you know it doesn't work?  What are you trying to do and what errors get returned from the HAL functions?

Jdogk_1-1737597513302.png

 

Hi Amel,

My HW Setting is like this The first setting was I2C1 and the second setting was I2C2.


Created with Cubeide project,

#include i2c.h 
MX_I2C2_Init();
MX_I2C3_Init();

in Main statement.

 

And I use TIM1(PWM), TIM2(Timer interrupt count), TIM4(PWM), TIM5(for us Delay Timer Count), TIM8(Input Capture mode)

Jdogk_2-1737597979526.png

in Debug mode I2C Master Transmit in to HAL BUSY Flag

Not initialize to HAL_I2C_STATE_READY

 

here is logic analyzer sequence

Jdogk_3-1737605769798.png

 

Jdogk_1-1737597513302.png

 

Hi Amel,

My HW Setting is like this The first setting was I2C1 and the second setting was I2C2.


Created with Cubeide project,

#include i2c.h 
MX_I2C2_Init();
MX_I2C3_Init();

in Main statement.

 

And I use TIM1(PWM), TIM2(Timer interrupt count), TIM4(PWM), TIM5(for us Delay Timer Count), TIM8(Input Capture mode)

Jdogk_2-1737597979526.png

in Debug mode I2C Master Transmit in to HAL BUSY Flag

Not initialize to HAL_I2C_STATE_READY

 

here is logic analyzer sequence

Jdogk_3-1737605769798.png

 

Above one is normal intialzie and normal I2C communication sequence

Jdogk_4-1737605841855.png

 

I Think I2C1 is not working in abnormal initialize 

 

 

Jdogk
Associate III

Jdogk_1-1737597513302.png

 

Hi Amel,

My HW Setting is like this The first setting was I2C1 and the second setting was I2C2.


Created with Cubeide project,

#include i2c.h 
MX_I2C2_Init();
MX_I2C3_Init();

in Main statement.

 

And I use TIM1(PWM), TIM2(Timer interrupt count), TIM4(PWM), TIM5(for us Delay Timer Count), TIM8(Input Capture mode)

Jdogk_2-1737597979526.png

in Debug mode I2C Master Transmit in to HAL BUSY Flag

Not initialize to HAL_I2C_STATE_READY

 

here is logic analyzer sequence

Jdogk_3-1737605769798.png

 

Above one is normal intialzie and normal I2C communication sequence

Jdogk_4-1737605841855.png

 

I Think I2C1 is not working in abnormal initialize 

KnarfB
Principal III

@Jdogk wrote:

Created with Cubeide project,

#include i2c.h 
MX_I2C2_Init();
MX_I2C3_Init();

in Main statement.


I2C3, a typo?

What means typo? 

I can't attach code because of my commpany rules.. 

Jdogk
Associate III

Main issue is I2C1 go to HAL BUSY Flag.. and system locked.

I2C Master Transmit in to HAL BUSY Flag

I think Not initialize to HAL_I2C_STATE_READY

This situation is often seen when you turn it on after first connecting the power, and it's working well afterwards.