cancel
Showing results for 
Search instead for 
Did you mean: 

unable to use External I2C connector on STM32H753I-Eval2 board

phoenixjia
Associate III

I am trying to use the external i2c connector (CN4) on the STM32H753I-Eval2 board to connect with the i2c connector (CN2) on STM32F769I discovery board. STM32H753I works as master and STM32F769I works as slave.

On STM32H753I, the function "HAL_I2C_Master_Transmit(&hi2c1, 0x20, TxBuffer, TXBUFFERSIZE, 1000)" is used to write data. It always fails at "I2C_WaitOnTXISFlagUntilTimeout(hi2c, Timeout, tickstart)" with the error of timeout. It seems the slave ACK is never received on the master board. I use STM32CubeMX to create the code and "MX_I2C1_Init()" return without any error. I also follow steps here to set up I2C1 in STM32CubeMX (https://wiki.st.com/stm32mcu/wiki/Getting_started_with_I2C#I2C_settings).

Any insight is appreciated! Thanks!

20 REPLIES 20

You can check the datasheet (alternate function mapping) 
https://www.st.com/resource/en/datasheet/stm32f765bi.pdf

Foued_KH_1-1698158903629.png

Foued

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.

In CubeMX, I already set PB8 and PB9 for I2C1 on STM32F769I discovery board, and PB6 and PB7 for I2C1 on STM32H753I-Eval2 board. What else should I do?

Just Connect 
SCL -- SCL 
SDA -- SDA 
GND -- GND 

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.

I already did it.

did you try to use HAL in interrupt mode : HAL_I2C_Master_Transmit_IT(&hi2c1, 0x20, TxBuffer, TXBUFFERSIZE); ?

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.

No, the problem is the slave device is not found with "HAL_I2C_IsDeviceReady".

Isn't the problem that the slave board isn't powered? From your comments before:

> The pin 5 of CN4 should have 3.3v signal when the power is on, however it is always 0v when I measured it from the oscilloscope.

No sense troubleshooting I2C when the board doesn't have power.

If you feel a post has answered your question, please click "Accept as Solution".

The slave board is powered by ST-Link. CN4 (I2C extension connector) is on the master board (STM32H753I-Eval2). According to the datasheet below, Pin 5 shall have 3.3v, however it is always measured 0v. The master board is powered by a 5v PSU adapter. 

phoenixjia_0-1698168994701.png

 

I understand, but that's that problem that needs solved, not any I2C related code. This is a hardware problem, not a software problem (at least, not yet).

Disconnect the slave board and measure pin 5. Still 0V? Download the schematic and trace the +3.3V net to see where/why it should be getting power but isn't.

If it's 3.3V after you disconnect the slave board, figure out what on the slave board is causing it to be shorted.

Make sure you are measuring the right pin. Measure all pins to verify pin 1  and 3 and 3.3V as well.

If you feel a post has answered your question, please click "Accept as Solution".

Now I got 3.3v from pin 5 (I don't know why it was measured 0v yesterday, maybe wrong pin was taken). But "HAL_I2C_IsDeviceReady" still can not find the slave device. With the slave board disconnected, the master board found 3 slave I2C devices (display, MFX and audio) on I2C1. With the slave board connected by I2C extension connector, none slave device is detected. I think it is because the I2C1 on the slave board is used as a master too (display and audio), it can not be used as a slave. I have to use I2C2/3/4 instead?