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.

RTOS/AM5728: how to save file to eMMC

Guru 10235 points
Part Number: AM5728
Other Parts Discussed in Thread: TMDSEVM572X,

Tool/software: TI-RTOS

Hello, TI Experts,

 

Our customer sent us a question about "how to save file to eMMC" with PROCESSOR-SDK-RTOS-AM57X by using TMDXIDK5728.

 

Question:

Are there any document or sample code for saving file to eMMC on the TMDXIDK5728?

 

We would appreciate if you tell us the recommended way of saving file to eMMC on the TMDXIDK5728.

 

Best regards,

  • Which Processor SDK RTOS version is this?

    Best Regards,
    Yordan
  • Hi,

    The easiest way to save file to EMMC would be from the host PC side. The idea is to use the USB interface of the AM57x as USB device mode to connect to a PC, and expose the MMCSD or EMMC as a USB memory thumb drive.

    Please see software-dl.ti.com/.../index_device_drv.html Topic: USB device Mass Storage Class with MMCSD card. This idea applies to AM57 as well.

    First, use the existing CCS project USB_DevMsc_mmcsd_evmAM572x_armExampleProject to make sure it worked, that is, host PC can R/W the files on the MMCSD card. Then change the MMCSD instance from MMCSD to EMMC. You should be able to see the EMMC detected as a USB drive in host PC. Then you can format it to FAT32, R/W files.

    Regards, Eric
  • Hi,

    Thank you very much for your kindness.
    I really appreciate your help.

    USB_DevMsc_mmcsd_evmAM572x_armExampleProject seems to be sample project for TMDSEVM572X.
    But we also found to run this project on TMDXIDK5728.

    If there are any code modification or notice for using this sample project on TMDXIDK5728, please tell us.
    Because our customer use TMDXIDK5728 for their product design.

    Best regards,
  • Hi,

    In the CCS project creation file, it has:

    -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/usb/example/bios/am57xx/usb_mmcsd_arm_am572x_evm.cfg"

    -ccs.setCompilerOptions "-c -mcpu=cortex-a15 -mtune=cortex-a15 -marm -mfloat-abi=hard -DevmAM572x -DSOC_AM572x -DUSB_DEVICE_EMMC -Dgcc -g -gstrict-dwarf -Wall -mno-unaligned-access -I${PDK_INSTALL_PATH}/ti/drv/usb -I${PDK_INSTALL_PATH}/ti/drv/usb/example/bios/ -I${PDK_INSTALL_PATH}/ti/drv/usb/example/common/ -I${PDK_INSTALL_PATH}/ti/drv/usb/example/usb_dev/msc/ -I${PDK_INSTALL_PATH}/ti/drv/usb/example/ramdisk -I${PDK_INSTALL_PATH} -I${PDK_INSTALL_PATH}/ti/drv/usb/src/usb_func/include -I${PDK_INSTALL_PATH}/ti/drv/usb/src/include " -rtsc.enableRtsc


    -ccs.setLinkerOptions " -lrdimon -lgcc -lm -nostartfiles -static -Wl,--gc-sections "
    -rtsc.setConfiguroOptions "-b ${PDK_INSTALL_PATH}/ti/build/am572x/config_am572x_a15.bld -DBOARD=evmAM572x"

    You need to port those AM572x GP EVM specific to IDKAM572x. The source code should be same. Please check and make sure the MMCSD instance number for EMMC is correct for IDK EVM.

    Regards, Eric

  • Hi,

    Thank you very much for your kindness.

    I really appreciate your help.

    I'd like to send the answer to the customer.

    We also checked the eMMC connection in both TMDXIDK5728 and TMDSEVM572X schematic.

    And we found the eMMC connection looks same in those both EVM schematic.

     

    Our customer sent us additional questions.

    They would like to read/write files in eMMC to create application by TIーRTOS.

    We found related sample like below;

    http://software-dl.ti.com/processor-sdk-rtos/esd/docs/latest/rtos/index_device_drv.html#fatfs

     

    Question:

    1: Could you tell us the difference of below 3 examples?

       - FATFS_Console_idkAM572x_armExampleProject

       - MMCSD_FatfsConsole_idkAM572x_armExampleProject

       - MMCSD_FatfsConsole_idkAM572x_DMA_armExampleProject

     

    2: Could you tell us which sample we should use for using eMMC.

    3: Could you tell us how to modify the sample code for using eMMC on the TMDXIDK5728.

           - We cannot find below statement in those samples.

             So, please tell us how to modify the code we should modify exactly.

             http://software-dl.ti.com/processor-sdk-rtos/esd/docs/latest/rtos/index_device_drv.html#id89

               mmcsdInitCfg[MMCSD_INSTANCE].cardType = MMCSD_CARD_EMMC;

               mmcsdInitCfg[MMCSD_INSTANCE].supportedBusWidth = MMCSD_BUS_WIDTH_8BIT;

               MMCSD_init();

     

    Best regards,

  • Hi,

    1. - FATFS_Console_idkAM572x_armExampleProject: Example will initialize card and checks for valid FAT partition. When a valid FAT partition is detected console interface for command execution is provided. Supported console commands include ls (to list files of directory), cd (change directory), pwd (present working directory) and cat (text file read operation).

    - MMCSD_FatfsConsole_idkAM572x_armExampleProject: Example initializes the card and checks for valid FAT partition. When a valid FAT partition is detected console interface for command execution is provided. Console commands supported are ls (to list files of directory), cd (change directory), pwd (present working directory) and cat (text file read operation).

    - MMCSD_FatfsConsole_idkAM572x_DMA_armExampleProject: above with EDMA enabled for write and read

    There is no difference between FATFS_Console_idkAM572x_armExampleProject or MMCSD_FatfsConsole_idkAM572x_armExampleProject, because they all used the MMCSD for test.

    2. You can use first two for EMMC test without using EDMA, the last for EDMA.

    Regards, Eric
  • Hi,

    All the test examples above by default test the MMC instance 0, which is MMCSD. The EMMC is MMC instance 1 on AM572x EVMs

    If you using above projects, there should be a call FATFS_open(0U, NULL, &fatfsHandle); where you need change "0" to "1". Let us know if this worked.

    Regards, Eric
  • Hi,

    Thank you very much for your kindness.

    I really appreciate your help.

     

    I tried to rebuild & run "FATFS_Console_idkAM572x_armExampleProject" by changing from"0" to "1"

    in FATFS_open(0U, NULL, &fatfsHandle) like attached pdf.

     

    But it seems no response.

    - There is no message in Teraterm console.

    - Expected message is like below;

      

     

    We would appreciate if you check the behavior with your TMDXIDK5728.

     

    Best regards,

    fat.pdf

  • Hi,

    I tried and didn't work. We don't have any such test case and need to debug.

    Regards, Eric
  • Hi,

    Thank you very much for your kindness.
    I really appreciate your help.

    Our customer plan to use eMMC for their product by using AM5728.
    If you get some update including how to modify the sample code for using eMMC on the TMDXIDK5728, please tell us.

    Best regards,
  • Hi,

    This need three parts of works:
    #1. Access the un-formatted EMMC via an interface on AM57x. We have an example to access the MMCSD via the USB interface. See software-dl.ti.com/.../index_device_drv.html USB device Mass Storage Class with MMCSD card
    This work needs to be extended to EMMC, this is ongoing.

    #2. Formatting the EMMC from host machine. When #1 is done, you can see an "USB thumb drive" from your host PC, then you can format it as FAT 32.

    #3. W/R file to EMMC: you can either use the host PC to R/W file. Or, use the "FATFS_Console_idkAM572x_armExampleProject" mentioned earlier with some modification to W/R the EMMC. This is also ongoing.

    Do you have a schedule when your customer need EMMC access from AM57x?

    Regards, Eric
  • Hi,

    Thank you very much for your detail explanation.
    I really appreciate your help.

    We'd like to check the behavior.
    And I'd like to answer to the customer including your question about their schedule.

    Best regards,
  • Hi,

    Thank you very much for your kindness.

    I really appreciate your help.

     

    We tried to "FATFS_Console_evmAM572x_armExampleProject" on TMDSEVM572X based on your guide.

    (Because USB_DevMsc_mmcsd_armExampleProject is prepared only for TMDSEVM572X.)

    But we failed to open eMMC with like below Error message on teraterm console".

    Question:

    Do you have same experience with below detail procedure with "pdk_am57xx_1_0_13" in PROCESSOR-SDK-RTOS-AM57X  05_02_00_10?

       1: build "USB_DevMsc_mmcsd_evmAM572x_armExampleProject".

       2: Formatting the EMMC to FAT32 by Windows-PC under running "USB_DevMsc_mmcsd_evmAM572x_armExampleProject".

           (We can copy a "txt-file" to eMMC of TMDSEVM572X and open the txt-file with text-editor on Windows-PC.)

       3: At first, build & run "FATFS_Console_MultiPartition_evmAM572x_armExampleProject".

           (This sample seems to be support eMMC by default such as "#ifdef MULTI_PARTITION, CONSOLE_EMMC".)

           -> But we found Error such as "eMMC Fails to open".

       4: We also tried to modify code of "FATFS_Console_evmAM572x_armExampleProject".

           -> We also found Error such as "eMMC Fails to open".

    We would appreciate if you check the behavior with your TMDSEVM572X and tell us how to solve this problem.

     

    Best regards,

     

  • Hi,

    Please use the pdk_am57xx_1_0_13 for the test. There is a USB_DevMsc_mmcsd_evmAM572x_armExampleProject, it has -DUSB_DEVICE_EMMC in the compiler option, so this project is used to access the EMMC from the USB port. I tested it on AM572x GP EVM, my Windows PC detected a unknown USB driver. You can format it. If this is the first time you access the EMMC, it is not partitioned so formatting will fail. You can use the Windows PC, administrative tools====>computer management=====>Storage====>disk management to partition it. After that, I was able to write/read files from EMMC.

    Then, there is a FATFS_Console_MultiPartition_evmAM572x_armExampleProject used for accessing multiple partitions: it has -DMULTI_PARTITION and -DCONSOLE_EMMC in the compiler options. So it opens both MMCSD and EMMC. When you run it, the console asked you to select a partition to access, like below:

    0:/
    1:/
    2:/
    Select drive :

    This showed there are 3 partitions (depending how many partitions in the MMCSD), EMMC should be the last one, the first ones are from MMCSD. It worked for me on AM572x GP EVM as well. I can access the EMMC.

    Above two projects are available on AM572x GP EVM, you need to port them to idkAM574x.

    Regards, Eric
  • Hi,

    Thank you very much for your kindness.

    I really appreciate your help.

    I'd like to check the behavior.

    But we fail the format by windows7 like below, at that time.

    Best regards,

  • Hi,

    I explained you need to Windows PC, administrative tools====>computer management=====>Storage====>disk management to partition it. Please search internet how to use disk management if it worked.

    Regards, Eric