cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with I2C4 on STM32H745I-Disk

Maximiliano
Senior

I have two codes, one only with the I2C4 communication working and the other code besides the I2C has the display but in this one the I2C communication does not work, what could be happening?
With a logic analyzer I can see that in both codes the clock and SDA works but the SDA of the code that works seems to send always the same thing (I guess it is because the device is not trying to read the communication) but in the code that fails it sends different words.

I use the I2C4 on pins PD12 and PD13.
I chose them because the arduino connectors were comfortable for me.

Is it also used by the LCD? because from the schematic I see that it connects to the ethernet port which I don't use.

the link to the schematic is https://www.st.com/resource/en/schematic_pack/mb1381-h750xb-b01-schematic.pdf

 

to read I am using:

int readWord(uint8_t func) {

if (HAL_I2C_Mem_Read(&hi2c4, I2C_ADDRESS << 1, func, I2C_MEMADD_SIZE_8BIT, data, 2, 1000) != HAL_OK) {

return -1;

}

}

I tried also this way but directly I see all 553 value in all instead of -1 (probably because I don't use error handling as above.

int readWord(uint8_t func) {

uint8_t data[2];

uint8_t address = func;

HAL_I2C_Master_Transmit(&hi2c4, I2C_ADDRESS << 1, &address, 1, HAL_MAX_DELAY);

HAL_I2C_Master_Receive(&hi2c4, I2C_ADDRESS << 1, data, 2, HAL_MAX_DELAY);

return (int)data[0] | ((int)data[1] << 8);

}

 

1 ACCEPTED SOLUTION

Accepted Solutions
STTwo-32
ST Employee

Hello @Maximiliano 

As you can see on the https://www.st.com/resource/en/schematic_pack/mb1381-h745xi-b03-schematic.pdf the pins PD12 AMand PD13 are mapped to LCD_SCL and LCD_SDA: 

Screenshot_2024-10-18-01-20-42-62_f541918c7893c52dbd1ee5d319333948.jpg

So, those two pins are used by the LCD screen.

Best Regards.

STTwo-32 

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.

View solution in original post

2 REPLIES 2
STTwo-32
ST Employee

Hello @Maximiliano 

As you can see on the https://www.st.com/resource/en/schematic_pack/mb1381-h745xi-b03-schematic.pdf the pins PD12 AMand PD13 are mapped to LCD_SCL and LCD_SDA: 

Screenshot_2024-10-18-01-20-42-62_f541918c7893c52dbd1ee5d319333948.jpg

So, those two pins are used by the LCD screen.

Best Regards.

STTwo-32 

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.

Ho as I didn't see it, I thought it was on the ethernet only. I will have to look for another i2c to use although I suspected it because of the logic analyser. Thank you very much !