'HAL_I2C_Slave_Receive_IT issue?
I had a problem using this API HAL_I2C_Slave_Receive_IT(&hi2c1, buff, 100) in case I send 20 bytes for example which is a corrupted frame for me (I am waiting for 100 bytes) then i2c driver will stack this 20 bytes and it does not free them in a manner that the next 100 bytes transmitted will be mixed with that 20 bytes and I will got a corrupted frame in my callback (20 + (100-20))!
Is there a way to avoid this use case other then updating the third parameter in HAL_I2C_Slave_Receive_IT API to 1 instead of 100?
thanks in advance!
Solution 1:[1]
This function does not know what your intentions are. You told it to receive 100bytes and it will do it until 100 bytes are actually received or an error occurs. You can send it in one chunk or in many. It will not discard any data.
You need to implement this logic yourself.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | 0___________ |
