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

Delete i2c cmd_mux semaphore more cleanly #1

Merged

Conversation

dhalbert
Copy link

Adding this xSemaphoreGive(p_i2c->cmd_mux) or removing the xSemaphoreTake(p_i2c->cmd_mux, portMAX_DELAY) prevents this crash:

import board,busio

i2c = busio.I2C(board.SCL, board.SDA)
i2c.deinit()

import wifi

Fixing this also depends on other changes in CircuitPython, reverting the i2c driver managment back to i2c_driver_install() and i2c_driver_delete(), and not trying to keep the instances around.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dhalbert
Copy link
Author

Despite the fact that this change seems to fix the problem, I'm suspicious of this because the original code is not inherently wrong, it appears. So this may just be avoiding some other bug elsewhere. I inquired about the idiom in the FreeRTOS forums: https://forums.freertos.org/t/vsemaphoredelete-immediately-after-xsemaphoretake/11956/4.

@dhalbert dhalbert marked this pull request as ready for review March 12, 2021 01:01
@dhalbert dhalbert merged commit f30a865 into adafruit:circuitpython Mar 12, 2021
@dhalbert dhalbert deleted the circuitpython-i2c-cmd_mux-fix branch March 12, 2021 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants