Forums

Strange FAT auto-mount behavior | RCM4300 | DC 10.72D (debug mode) | 4GB SDHC

Started by "tit...@gmail.com [rabbit-semi]" March 27, 2019
Even if the FAT_SHELL.C sample works flawlessly (the SD card has two 2GB FAT16 partitions) the function "sspec_automount(SSPEC_MOUNT_ANY, ..." returns "2" at the beginning of the "main" in my project.

The problem arises exactly here: https://github.com/digidotcom/DCRabbit_10/blob/master/Lib/Rabbit4000/SDflash/SDFLASH.LIB#L993 https://github.com/digidotcom/DCRabbit_10/blob/master/Lib/Rabbit4000/SDflash/SDFLASH.LIB#L993

At the second iteration (j=1) cmd_reply.reply == 5.

This strange behavior occurs only in debug, and does not occur if I run FAT_SHELL.C right before compiling and executing my code.

For now it's just a little annoying, but I'm posting it anyway: maybe someone has a clue about the possible cause.
Hmmm. This is interesting. It could be a timing issue of some sort.

If cmd_reply.reply is 5, that would somehow indicate (R1_ILLEGAL_COMMAND | R1_IDLE_STATE). We could alter the previous check to see if the R1_IDLE_STATE bit is set, but then we’d be ignore the error.

I’m not clear on why it’s triggering R1_ILLEGAL_COMMAND.

I assume you’ve enabled SDFLASH_SDHC because of the size of your SD card. Are you seeing cmd8_success in the first half of that function?

There could be some issue with the SPI lines going to the SD card and not resetting the card properly when starting up in debug mode.

-Tom
> On Mar 27, 2019, at 6:03 AM, t...@gmail.com [rabbit-semi] wrote:
>
> Even if the FAT_SHELL.C sample works flawlessly (the SD card has two 2GB FAT16 partitions) the function "sspec_automount(SSPEC_MOUNT_ANY, ..." returns "2" at the beginning of the "main" in my project.
> The problem arises exactly here: https://github.com/digidotcom/DCRabbit_10/blob/master/Lib/Rabbit4000/SDflash/SDFLASH.LIB#L993 At the second iteration (j=1) cmd_reply.reply == 5.
>
> This strange behavior occurs only in debug, and does not occur if I run FAT_SHELL.C right before compiling and executing my code.
>
> For now it's just a little annoying, but I'm posting it anyway: maybe someone has a clue about the possible cause.
I see (line 967) cmd8_success = (cmd_reply.reply_buffer[4] == CMD8_CHECK_PATTERN) => cmd8_success equals "true"

The strangest thing is that FAT_SHELL.C always works
If I turn on the card, run FAT_SHELL.C and finally run my program, my program also works.