Forum: DSP Use of Fatfs on a TMS320F28335

von koko (Guest)

Attached files:

Rate this post
not useful
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 

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 
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...

von Andreas S. (andreas) (Admin)

Rate this post
not useful
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
von joe vast (Guest)

Rate this post
not useful
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 */
        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

von matzetronics (Guest)

Rate this post
not useful
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:

von matzetronics (Guest)

Rate this post
not useful
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
No account? Register here.