-
Notifications
You must be signed in to change notification settings - Fork 1k
wrong error management in i2C functions? #1774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Previously, i2c_master_write and i2c_master_read returned I2C_OK if first HAL call returned HAL_BUSY which was not correct. Now make sure the i2c is ready, which guarantees a good initialization of the read or write sequence. Fixes stm32duino#1774 Signed-off-by: Frederic Pillon <[email protected]>
Hi @camelator I've made a fix. Could you try it with your use case? Thanks |
I can't see your changes. Where did you put it? Which branch? |
Fix is available in a Github Pull Request: |
And it is referenced by the issue 😉 |
Previously, i2c_master_write and i2c_master_read returned I2C_OK if first HAL call returned HAL_BUSY which was not correct. Now make sure the i2c is ready, which guarantees a good initialization of the read or write sequence. Fixes stm32duino#1774 Signed-off-by: Frederic Pillon <[email protected]>
Previously, i2c_master_write and i2c_master_read returned I2C_OK if first HAL call returned HAL_BUSY which was not correct. Now make sure the i2c is ready, which guarantees a good initialization of the read or write sequence. Fixes stm32duino#1774 Signed-off-by: Frederic Pillon <[email protected]>
Previously, i2c_master_write and i2c_master_read returned I2C_OK if first HAL call returned HAL_BUSY which was not correct. Now make sure the i2c is ready, which guarantees a good initialization of the read or write sequence. Fixes #1774 Signed-off-by: Frederic Pillon <[email protected]>
Sorry for the delay, but to me the fix is nott complete: |
Previously, i2c_master_write and i2c_master_read returned I2C_OK if first HAL call returned HAL_BUSY which was not correct. Now make sure the i2c is ready, which guarantees a good initialization of the read or write sequence. Fixes stm32duino#1774 Signed-off-by: Frederic Pillon <[email protected]>
I have an issue I don't know where it comes from... After some seconds, the I2C line remains high... but calling I2C functions always return good results.
1/ During debugging my problem I can see that the i2c_master_read function returns I2C_OK although the I2C line is crashed:
if the result of the first receive call is not HAL_OK, it returns I2C_OK because there is no else block attached to the first 'if' , instead of returning an error code.
2/ and it is the same issue within the function i2c_master_write:
it returns I2C_OK although the result of the first call to Transmit_IT is not HAL_OK
I am not sure but I think the impact of the change on the read function is neutral but some other changes should be done in the requestFrom function:
3/ if the i2c_master_write function returns an error code, it is well managed in the endTransmission function but not in the request_from function.
having endTransmission(false) without error management means you can try to read data even the write is not done.
The text was updated successfully, but these errors were encountered: