This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

finit hangs

finit hangs

Hi,
I'm having a problem with the finit call on an SD card. I get the same behavior whether I try the call prior to starting RTX, or from within an RTX task. The behavior is sporadic - sometimes it works, and other times it hangs (about one in 3 tries). Once it hangs I have to power cycle the board to clear it. When it does hang, I'm stuck in the following loop in the file SDIO_LPC18xx.c.

for (; {
ints = LPC_SDMMC->RINTSTS;

if (ints & (SDIO_RINTSTS_RE | SDIO_RINTSTS_RCRC | SDIO_RINTSTS_RTO)) {
/* Response error, CRC error, response timeout */
return (__FALSE);
}

if (ints & SDIO_RINTSTS_HLE) {
/* Hardware locked write */
LPC_SDMMC->CMD = cmdval;
}

if (ints & SDIO_RINTSTS_CDONE) {
/* Command done */
if (cmdval & SDIO_CMD_DATA_EXP) {
if (ints & (1 << 3)) {

break;

}
} else break;
} }

the program is not dead and I can step through this loop in the debugger. All of the if statements are false, except for the last one - the "command done" one. In that one the statement " if (ints & SDIO_RINTSTS_CDONE) {" succeeds, and so it falls into the next statement: "if (cmdval & SDIO_CMD_DATA_EXP) {" and that succeeds, and so it falls into the next statement: " if (ints & (1 << 3)) {", but here "ints" is always 0x424 and so we don't hit the break, the end result being that we cycle in the for loop forever.

I have no idea what this code is trying to do, but it doesn't do it very effectively in my case - at least not always. Can anybody help me?

Thank You,
Chuck

0