cancel
Showing results for 
Search instead for 
Did you mean: 

Master board i2c don t comm with slave board, between 2 stm board

SDall
Associate II

Hi, I'm giving the example of the two stm32 boards at this link

https://github.com/sogongbang/STM32CubeF4/tree/master/Projects/STM32F4-Discovery/Examples/I2C/I2C_TwoBoards_ComPolling

I made and copied the connection and the code then I checked several times, everything matches, the problem is that when I execute the hall master i2c trasmitt function, it gives me an error, the master does not connect with the slave:

while(HAL_I2C_Master_Transmit(&I2cHandle, (uint16_t)I2C_ADDRESS, (uint8_t*)aTxBuffer, TXBUFFERSIZE, 10000)!= HAL_OK)
{
/* Error_Handler() function is called when Timeout error occurs.
When Acknowledge failure occurs (Slave don't acknowledge it's address)
Master restarts communication */
if (HAL_I2C_GetError(&I2cHandle) != HAL_I2C_ERROR_AF)
{
Error_Handler();
}
}

The code stop in function Error_Handler()

Tanks

1 REPLY 1
jiangfan
ST Employee

Please be sure to use same Hardware configuration as mentioned with 2 STM32F4-Discovery boards:

Hardware and Software environment
- STM32F4-Discovery RevB & RevC Set-up
- Connect Master board PB6 to Slave Board PB6
- Connect Master board PB9 to Slave Board PB9
- Connect Master board GND to Slave Board GND