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

Add error handling for SPI code #237

Open
4 of 5 tasks
PatrickKa opened this issue Dec 22, 2023 · 2 comments
Open
4 of 5 tasks

Add error handling for SPI code #237

PatrickKa opened this issue Dec 22, 2023 · 2 comments

Comments

@PatrickKa
Copy link
Contributor

PatrickKa commented Dec 22, 2023

Description

As discussed in #178 the SPI communication will keep using blocking functions. However, we still want to be able to detect timeouts. Since I don't know of any way to interrupt a blocking function, we can't just add a timeout to the SPI functions directly. The best solution I could come up with is an additional thread that watches the SPI communication and checks if the data transfers are taking too long. This also requires some global state that stores if a transfer is in progress and when it should finish. What I am still not sure about is what exactly to do when a timeout error occurs. An error counter should be updated in any case, but we cannot interrupt or cancel the SPI function, so whatever thread called it might get stuck indefinitely.

Edit: After the discussions in person, online, and in the comments below, I turn this into an Epic, to track all things directly related to our SPI error handling concept.

To do

@PatrickKa PatrickKa changed the title Add a timeout to blocking SPI functions Add timeout error handling to SPI functions Dec 23, 2023
@PatrickKa
Copy link
Contributor Author

Blocked by #38

@PatrickKa PatrickKa changed the title Add timeout error handling to SPI functions Add error handling to SPI functions Dec 23, 2023
@PatrickKa PatrickKa changed the title Add error handling to SPI functions Add error handling for SPI functions Dec 23, 2023
@PatrickKa PatrickKa changed the title Add error handling for SPI functions Add error handling for SPI code Dec 23, 2023
@PatrickKa PatrickKa self-assigned this Dec 25, 2023
@PatrickKa
Copy link
Contributor Author

PatrickKa commented Jan 13, 2024

David and I thought about the whole thing again. We documented it in miro with some nice flowcharts. Basically, the supervisor thread increments error counters and resets. In addition, we also have threads that perform startup tests. These tests can disable the whole FRAM/EPS/flash communication. The rest of the code has to adapt to that. If the FRAM does not work, we just store everything in RAM. If the flash does not work, we cannot use the EDU. If the RF does not work, we are pretty much doomed, so we always reset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant