2018-09-18 12:50 AM
Hi,
I am trying to establish I2C communication b/w I2C1 and I2C2 on Stm32f4-discovery. I used CubeMx to generate code for standard mode with the following addresses.
I2C1 = 0x5
I2C2 = 0x7
In the while (1) i added the following code.
resp = HAL_I2C_Master_Transmit(&hi2c1, 7<<1, &tsData, 1, 100);
If (resp == HAL_OK) {
resp = HAL_I2C_Slave_Receive(&hi2c2, &rxData, 1, 500);
If (resp == HAL_OK) {
If (rxData == 'a') {
//toggle gpiod.15
rxData =0;
}
}
}
HAL_Delay(500);
Variables are:
uint8_t txData ='a';
uint8_t rxData =0;
HAL_StatusTypeDef resp;
Am I doing somethig wrong,? Any clue will be highly appreciated.
.
I appologize for any typo error as i am typing this question code on mobile.