2020-08-17 03:49 AM
CubeIDE version 1.4.1
STM32Cube FW_F3 V1.11.0
I had the problem, that my I2C communication (alternating rx/tx on slave) works on the first rx/tx cycle but fails on the second tx.
The transmission skips the first byte and thus sending n-1 bytes. I found out that, after calling I2C_ITSlaveCplt() on line 4744, the execution of the function continues and decrements the XferCount on line 4802.
I fixed the driver as follows (original line 4740-4745):
/* Check if STOPF is set */
if ((I2C_CHECK_FLAG(tmpITFlags, I2C_FLAG_STOPF) != RESET) && (I2C_CHECK_IT_SOURCE(ITSources, I2C_IT_STOPI) != RESET))
{
/* Call I2C Slave complete process */
I2C_ITSlaveCplt(hi2c, tmpITFlags);
}
/* Check if STOPF is set */
if ((I2C_CHECK_FLAG(tmpITFlags, I2C_FLAG_STOPF) != RESET) && (I2C_CHECK_IT_SOURCE(ITSources, I2C_IT_STOPI) != RESET))
{
/* Call I2C Slave complete process */
I2C_ITSlaveCplt(hi2c, tmpITFlags);
// BEGIN BUG FIX
__HAL_UNLOCK(hi2c);
return HAL_OK;
// END BUG FIX
}
2020-08-17 04:27 AM
Alternatively the following if-statement could be changed to an else-if-statement which is similar to the previous working driver version.
2020-08-17 09:15 AM
Hi @fal.sch ,
This issue is reported to our development team for farther check and analysis in order to apply the adequate solution.
Thanks for highlighting it.
-Amel
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.