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/TMS320F28379D: cannot write to sd card using f_write()

Part Number: TMS320F28379D

Tool/software: Code Composer Studio

I am using the sd card example code to learn the FATFS library. I am trying to make a file and write some data to it. The file contents are empty. Please find below the code :

    FRESULT fresult;
    FIL fil;
    char line[] = "Hello World";   

fresult = f_mount(0, &g_sFatFs);
    if(fresult != FR_OK)
    {
        UARTprintf("f_mount error: %s\n", StringFromFresult(fresult));
        return(1);
    }


    WORD bw =0;
    fresult = f_open(&fil, "message2.txt",FA_WRITE | FA_OPEN_EXISTING);
    fresult = f_write(&fil, line, (WORD)strlen(line), (void *)&bw);
    f_sync(&fil);
    f_close(&fil);

I am not getting any error in any of the steps.