Hi, I have a little problem with the use of Fatfs on my DSP. In fact, opening a file on a microSD doesn't work...:( Smple code: //...Variable initializations... // Mount return FR_OK f_mount(&FatFs, "0:", 0); // Opening fails... f_open(&File, "Tes.txt", FA_OPEN_EXISTING | FA_READ); // It returns FR_NOT_READY because it the disk_initialize function // dosn't work and satisfy the condition STA_NO_INT which return //FR_NOT_READY... So, I have no more idea where I could search. The micro_SD is a Kingston (4GB) class 10 which is inserted in a SD adaptater which is linked to the DSP. On my computer or mobile phones everything is OK on the card, so it's not the health of the card but what ? What can do this kind of error ? The clock speeed of SPI is 300kHz so it's not really great to cause issue... I give you the diskio.c file which is the only one I change to adapt on my target. If somebody could understand something and know the FatFs module, I really thank him/her to help me to understand...
koko wrote: > Mount return FR_OK > f_mount(&FatFs, "0:", 0); f_mount does not actually communicate with the card, so this doesn't help ypi. Did you set up your SPI interface correctly? Do the SPI read commands return something sensible? One of the most common errors is to set the clock phase and polarity incorrectly, so double check if yours is set correctly; try out all possibilities if necessary. If that doesn't solve the problem, try a different card.
:
Edited by Admin
The problem is size of char, which is 16 bits for TMS320F28x. So, the comparisons that include an unsigned char variable and a hex constant will fail. For the disk_initialize function, it fails when wait_ready function is called, since variable res never becomes equal to 0xFF. BYTE wait_ready (void) { BYTE res; Timer2 = 50; /* Wait for ready in timeout of 500ms */ rcvr_spi(); do res = rcvr_spi(); while ((res != 0xFF) && Timer2); // <--- res != 0xFF fails return res; } In order to access single byte value, __byte intrinsic function can be used as the following: __byte(&res,0) != 0xFF
koko wrote: > The micro_SD is a Kingston > (4GB) In this case make sure you have followed the guidelines for FatFS regarding High-Capacity SD Cards. Everything above 2GB today will be SDHC instead of the older SD: http://elm-chan.org/docs/mmc/mmc_e.html
Oops, sory i didn't see that this is a very old posting. Sorry for eating up memory in the database.
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.