Skip to content
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

Possible external I2C bus issue #210

Open
goran-mahovlic opened this issue Jul 14, 2021 · 1 comment
Open

Possible external I2C bus issue #210

goran-mahovlic opened this issue Jul 14, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@goran-mahovlic
Copy link

Summary:

While using library for AS7341 sensor I have noticed that I2C HAL sometimes fails and returns HALL ERROR. That is problematic as at that point I cannot send commands to sensor and this sensor needs to be set into sleep mode via commands. If I do not check HAL fail I end up with higher consumption in sleep mode. And after some time, and wake HAL starts to work - so it is not noticeable by sensor readings. It happens maybe once every 100 wakes, so it is not easy to catch.
After adding small delay before HAL_I2C_Mem_Write I get this error really rare
https://github.com/goran-mahovlic/generic-node-se/blob/develop/Software/lib/AS7341/AS7341.c#L38
I still did not find why this is happening so I just implemented check for HAL error and if it happens before sensor ends in sleep mode I just do system reset. That way I will know it is still happening, and I am not in risk of high consumption on the device.
...

Steps to Reproduce:

I did not try, but maybe looping HAL_I2C_Mem_Write some external sensor would bring same results.

What do you see now?

...

What do you want to see instead?

...

How do you propose to implement this?

...

Environment:

...

What can you do yourself and what do you need help with?

...

@elsalahy
Copy link
Contributor

elsalahy commented Jul 15, 2021

Hello @goran-mahovlic ,

Thanks for opening the issue.

First:

I think it is good to mention in the description that this issue is related to the external sensor bus I2C2, and your own personal integration with an external AS7341 sensor.

Second:

HAL_I2C_Mem_Write returns either HAL_OK, HAL_ERROR or HAL_BUSY
Any failure to communicate with the external sensor (mainly a timeout) would result in a HAL_ERROR.

Since you are mentioning that:

  1. This maybe happens once every 100 read
  2. The added delay made it rare to catch the fault

It feels like this is an integration issue with the external sensor.

We will do our best to try to reproduce it, but I would appreciate it if you can provide us with more description on the error and the time it takes the sensor to start responding again after an error.

@elsalahy elsalahy self-assigned this Jul 15, 2021
@elsalahy elsalahy added the bug Something isn't working label Jul 15, 2021
@elsalahy elsalahy added this to the Next Up milestone Jul 15, 2021
@elsalahy elsalahy modified the milestones: Next Up, Backlog Sep 24, 2021
@elsalahy elsalahy changed the title Possible I2C HAL issue Possible external I2C bus issue Sep 24, 2021
@johanstokking johanstokking removed this from the Backlog milestone Nov 29, 2021
@NicolasMrad NicolasMrad assigned azerimaker and unassigned elsalahy Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants