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!

1 ACCEPTED SOLUTION

Accepted Solutions

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?

View solution in original post

20 REPLIES 20
TDK
Guru

Does the slave board have power? Are SDA/SCL connected appropriately and does the bus have external pullups on both of these lines?

Note that HAL expect a left-shifted slave address.

I'd recommend first using HAL_I2C_IsDeviceReady and ensuring you get HAL_OK back before using I2C.

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

Yes, the slave board is powered through ST-Link. SDA/SCL lines both have external pullups from two boards. The slave address is left-shifted by one bit already.

"HAL_I2C_IsDeviceReady" does not find any device that is connected with I2C1. It looks like the I2C1 is disabled on the EVAL board by STM32CubeMX. The status of I2C1 in "Connectivity" of CubeMX shows "Partly disabled conflict with USB_OTG_HS: External Phy Device_Only" (see the attachment). My question is, how to disbable "USB_OTG_HS" and enable I2C1 on this EVAL board?

TDK
Guru

If CubeMX is generating I2C functions, it's not disabled.

Seems like the slave is not responding.

If you have a logic analyzer, hook that up to SDA/SCL to ensure the signal is valid.

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

It looks like the I2C extension connector (CN4) on the STM32H753I EVAL2 board is not enabled at all. When the slave board is disconnected from CN4, I use "HAL_I2C_IsDeviceReady" to enumerate all slave devices on the EVAL board and 3 addresses (MFX, audio and the LCD screen) are found to be connected with I2C1. When the slave board is connected through CN4, none of slave devices of I2C1 are detected. I use an oscilloscope on SCL/SDA lines of CN4, no signal was detected when "HAL_I2C_IsDeviceReady" is executed. 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.

Pavel A.
Evangelist III

> The pin 5 of CN4 should have 3.3v signal when the power is on, however it is always 0v 
Is the board connected to external power supply or ST-LINK only? Use external supply, check the jumper that selects the power source.

 

It is powered by a 5V DC adapter, which is connected to CN10. The JP10 of the power jumper is set to PSU (5V).

Foued_KH
ST Employee

Hello @phoenixjia , 

Could you please share you .ioc file ?

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.

Please find it in the attachment. I use it as the I2C master device.

Here is the ioc file of the slave device (updated), which is the STM32F769I discovery board. My question is, since the I2C1 is already used on this board for display and audio, can I use it as an I2C slave device?