This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TMS320F28377D: FATFS error

Part Number: TMS320F28377D


Tool/software: Code Composer Studio

Hello, I have question about FATFS in F28377D.

I want input the text file to USB memory card.

I connected USB module. (5V to VBUS, V- to 130pin& V+ 131pin(standard PTP pin no.), GND to GND)

and code use 'usb_host_msc', but it is set by UART command.

I want input the text file immediately, So I made code like this.. 

<<usb_host_msc.c>>

int main(void)

{

...

//
// Initialize the file system.
//
f_mount(0, &g_sFatFs);

// under the this point, I made it. I refer to other location function 'f_open() and f_write()'

//
// Open the file for reading.
//
fresult = f_open(&g_sFileObject, g_cTmpBuf, FA_WRITE);

//
// If there was some problem opening the file, then return an error.
//
if(fresult != FR_OK)
{
return(fresult);
}

... end

but, I didn't go next line. It went abort function. At that time fresult state is 'FR_NOT_READY'.

How should I modify this code? please let me know. Thank you.

  • Hi Kyu,

    Have you been able to get the usb_host_msc example working as it is?

    Please do this first.

    sal

  • hello, thank for reply.

    I did 'usb_host_msc' example in c2000.

    Next, I  changed the code to write the value to usb as follows.

    // Initialize the file system.
    h = f_mount(0, &g_sFatFs);

    if(h!=FR_OK) asm(" ESTOP0");
    //
    // Open the file for reading.
    //
    res = f_open(&g_sFileObject, make_file, FA_CREATE_NEW|FA_WRITE);
    // Check the system
    if(res == FR_OK)
    {
        //Write file to USB
        res = f_write(&g_sFileObject, textFileBuffer, sizeof(textFileBuffer) - 1,&br);
        if(res != FR_OK)
        { 
        return(res);
        }

        /*close file*/
        f_close(&g_sFileObject);
    }

    asm(" ESTOP0");
    for(;;){};

    That code worked, but if I flashed usb on my PC, the file was not created.

    Thank you for your advice.

  • Hi,

    Please provide some more clarification and more information.

    You said the code worked. What did it do?

    You said if flashed usb on PC, then it didn't work. What are you trying to do? and what did not work?

    sal

  • Kyu,

    Wanted to check in from the TI side to see if this is still an issue or if you had a comment on Sal's last question.  I'm marking as TI Thinks resolved, but please feel free to reply and this will re-open.

    Best,

    Matthew