Problem with I2C4 on STM32H745I-Disk
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);
}

