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.

TM4C123GH6PGE: Writing on USB Pen drive

Part Number: TM4C123GH6PGE

Hello. 

EK_TM4C123GXL to DK-TM4C123G migration and modify

Why can not I write "Hello :)" in the Err1.txt file?

Please let me know what to do.

regards.

static int printFileStructure (void) {



    uint32_t ui32ItemCount;

    FRESULT fresult;
    static char *pcBuf;//[256]="Hello World";
    uint32_t ui32BytesWritten;


             //
            // Open the file by name that was determined above.  If the file exists
            // it will be opened, and if not it will be created.
            //
            fresult = f_open(&g_sFileObject, "Err1.txt", (FA_CREATE_NEW |FA_WRITE));
            if(fresult != FR_OK)
            {
                *(&pcBuf) ="Hello:)";
                f_write(&g_sFileObject, &pcBuf, 20, (UINT *)&ui32BytesWritten);
                return(0);
            }

            *(&pcBuf)="Hello:)"; 
           fresult = f_write(&g_sFileObject, &pcBuf, 20, (UINT *)&ui32BytesWritten);

    //

    // Open the current directory for access.

    //

    fresult = f_opendir(&g_sDirObject, g_cCwdBuf);

f_write reference location
- TivaWare_C_Series-2.1.4.178\third_party\fatfs\doc\en

create File in USB 

- Attach capture

  • Have you gotten the example usb_host_msc to work on your DK_TM4C123G?
    C:\ti\TivaWare_C_Series-2.1.4.178\examples\boards\dk-tm4c123g\usb_host_msc
  • Hi Bob.
    thanks for your reply

    Bob reply > Have you gotten the example usb_host_msc to work on your DK_TM4C123G?
    reply_A> No, this usb_host_msc example shows the file and directory structure in USB on the OLED display.

    Q1> I referred to Charles as an answer to the source code and link error question.
    e2e.ti.com/.../2399967

    The first source code did not work, so I migrated and modified EK_TM4C123GXL to DK-TM4C123G.
    - VBUS EPEN, USB Pin Map is changed and source code is operated.

    Why can not I write "Hello :)" in the Err1.txt file?
    - I added the function f_write, but it is not written to the file when the file is created.

    regards.

    Jame, Shin
  • Hello

    Why can not I write "Hello :)" in the Err1.txt file?

    regards.