I want to know the difference of the below 4 cases. Why the results are not as expected. Stm32 board is an i2c master with speed of 400kbps and slave is software simulation using Aardvark Total Phase Control Software.
uint8_t i2c_tra[10] = { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x10 },
i2c_rec[10] = { 0 };
the data i send from the software is 11 22 33 44 55 66 66 77 88 99. This should be received in the i2c_rec.
////////////////////////////////////////////////////////////////////////////////////////////
while (1){
HAL_I2C_Master_Transmit_IT(&hi2c2,0x33<<1,i2c_tra,10);
HAL_I2C_Master_Receive_IT(&hi2c2,0x33<<1,i2c_rec,10);
HAL_Delay(100);
}
only sending is proper and no receiving done
/////////////////////////////////////////////////////////////////////////////////////////////
while (1) {
HAL_I2C_Master_Transmit(&hi2c2,0x33<<1,i2c_tra,10,100);
HAL_I2C_Master_Receive_IT(&hi2c2,0x33<<1,i2c_rec,10);
HAL_Delay(100);
}
sending and receiving only once
//////////////////////////////////////////////////////////////////////////////////////////////
while (1) {
HAL_I2C_Master_Transmit(&hi2c2,0x33<<1,i2c_tra,10,100);
HAL_I2C_Master_Receive(&hi2c2,0x33<<1,i2c_rec,10,100);
HAL_Delay(100);
}
sending and receiving is proper.no issue.
////////////////////////////////////////////////////////////////////////////////////////////////
while (1) {
HAL_I2C_Master_Transmit_IT(&hi2c2,0x33<<1,i2c_tra,10);
HAL_I2C_Master_Receive(&hi2c2,0x33<<1,i2c_rec,10,100);
HAL_Delay(100);
}
only sending is happening nothing is received
/////////////////////////////////////////////////////////////////////////////////////////////////
Please let me know the difference of the above 4 cases.