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

Infinite loop in SDHC driver. #70

Open
jmichiels opened this issue Jul 18, 2023 · 1 comment
Open

Infinite loop in SDHC driver. #70

jmichiels opened this issue Jul 18, 2023 · 1 comment

Comments

@jmichiels
Copy link

jmichiels commented Jul 18, 2023

I ran into an issue due to following line:

while ((${SDHC_INSTANCE_NAME}_REGS->SDHC_PSR & (SDHC_PSR_CMDINHC_Msk | SDHC_PSR_CMDINHD_Msk)) != 0U)

https://github.com/Microchip-MPLAB-Harmony/csp/blob/90adeccd9213d7d66be8a14a17220638f25ef9fd/peripheral/sdhc_u2011/templates/plib_sdhc.c.ftl#L386C25-L386C25

With some specific hardware issues, those bits may never be cleared, which causes an infinite loop. There should probably be some kind of max iteration count, in order to return false if the bits are not eventually cleared.

@jigneshmoradiya1
Copy link
Contributor

@jmichiels , This loop is required to check whether SDHC controller is busy with command or data transfer. Once code is exited from this loop then it ensures that SDHC controller is not busy and then after new command or data transfer can be initiated.

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

No branches or pull requests

2 participants