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.

TMS320C6748 read from USB thumb drive and write to SD card

Other Parts Discussed in Thread: TMS320C6748, SYSBIOS, OMAPL138, OMAP-L138

Hi,


Setup: TMS320C6748, XDS200 and CCS 6, USB thumb drive, powered USB HUB, USB Card Reader, SD Card

Goal: I would like to write a simple code to read files from the USB thumb drive and write it to the SD Card.

Skills: I am a complete newbie with CCS and DSP programming.

1) Since the TMS320C6748 only has one USB port, I've got a powered hub to connect the two different types of drives, is this setup acceptable?

2) What packages do I need to achieve this?

3) Does the DSP/BIOS and SYS/BIOS provide a similar Linux filesystem that let's me recognize the drives, do a directory listing of the files, read/write files?

4) What the API's for doing this?  Are there examples?

Any links to the API and examples would be very helpful as I am brand new.  I've got the hello world to work and the LED demo to work so now ready to try communicating to the drives.  I have not connect the drives.  I'm waiting to hear if my setup is ok.


Thank you in advance for any help.

  • We have starterware package which has USB mass storage examples for C6748 LCDK board and MMC example code from DSP/BIOS (PSP package)

    Our USB expert may give you much information on this.

    Thanks for your patience.
  • Sorry for the multiple posts. I was not sure which category to post under and was desperate for help.
  • Any suggestions?
  • Have you looked at the Starterware and PSP libraries that Titus mentioned above?

    The examples and documentation that come with those libraries will address some of your questions.

    Regards,
    RandyP
  • I've downloading the Starterware but have not looked in details due to confusion with different versions. DSP/BIOS changed to SYS/BIOS, so is PSP part of SYS/BIOS? Before I begin dissecting the USB exampples, I wanted to make sure I've got all the right packages.

    It installed the latest version of SYS/BIOS 6.42.03.35 and xdctools 3.30.06.67 and Starterware 1.20.04.01. What version of PSP is compatible with this? What other packages do you think I need?

    Thank you.
  • Also do I need the BIOSUSB package? If you could help me sort out the right packages required to move files across USB that would be a big help.
  • Dear DSP Noop,
    Apologize for the delayed responses.
    Starterware package doesn't use any SYSBIOS or DSPBIOS or XDCtools etc.,
    Its just simple bare metal code.

    You will get those BIOS related packages when you install MCSDK.

    So, please use starterware USB examples.

    processors.wiki.ti.com/.../StarterWare_USB

    If you are looking for any USB examples with BIOS support then please use BIOSUSB package.

    software-dl.ti.com/.../legacy.html

    Please let us know if you need further clarification or questions.
  • OK, using StarterWare 1.20.04.01 USB (usb_host_msc) example, I can read/write data to the thumb drive.

    The next step is to read/write to the SD Card using the SD Card interface WITHOUT a USB Card Reader. I've played with some examples from people on the forum but could not get it to work.

    Is there a TI example somewhere that shows to open, read/write/close SD Card? If not is, is there an example to show most of the functionality.

    Any help would be greatly appreciated.

    Thank you.
  • You can get the MMC/SD example code from the BIOSPSP package.
    C:\ti\biospsp_03_00_01_00\drivers\examples\evm6748\mmcsd_fatfs
    C:\ti\biospsp_03_00_01_00\drivers\examples\evm6748\mmcsd

    software-dl.ti.com/.../index.html

    You can also refer SD/MMC writer reference code from the OMAPL138 flash an boot utils package.

    C:\ti\OMAP-L138_FlashAndBootUtils_2.40\OMAP-L138\CCS\SDMMCWriter
  • Thank you the reply Titus.

    Just curious on why the mmcsd examples were removed from the biospsp_03_01_01_00.  I've already downloaded that thinking the latest version is the best but not true?

  • Actually, no.
    Always we recommend to use the latest source.
    Here, they have released the examples which had issues in previous releases.
    Before download, you can also check out the release notes of the package.
  • Has anyone update the USB Host MSC StarterWare example to use Sys/Bios? Mainly, modifying it to let Sys/Bios manage the interrupts.

    Any help would be apprecitated. Thank you.
  • The alternative is, is there MMCSD example without Sys/Bios?

    How can I modify the PSP MMCSD Bios example to work without Sys/Bios?

    I'm getting desparate here....any help would be appreciated...
  • Hi
    Unfortunately there is no good answer on this one.
    I see that you have already gone through several post here and in starterware forum
    Unfortunately for MMC/SD , we do not have a baremetal/starterware like code from DSP side
    The only available sample code is the one you are working with legacy BIOS PSP

    The following wiki outlines what DSP side peripheral drivers are available in various current and legacy release
    processors.wiki.ti.com/.../OMAPL138_SW_&_HW_Comparison

    You should be able to see if the BIOS PSP code provides a reference to work w/o SYSBIOS , so that it better integrates with the Starterware based USB code. I would recommend to sticking to starterware USB if that is meeting your requirement , instead of looking at the BIOS USB driver (which is a 3P offering , and any changes to it, will require additional licensing you will need to work directly with the 3P etc).
    There is no recipe for how to modify the PSP MMCSD example to work w/o SYSBIOS, but if you get stuck, please post the query here to see how best the support team can help you.

    Regards
    Mukul
  • Can you provide your integrated USB+MMC project ?
    Let me check how best I can support on this.

    You can also post your queries to BIOS forum if you see any hang issue for BIOS APIs.
  • Basically, the problem is with ConfigureIntUSB. Any code in the USB MSC or driver dealing with interrupts have to be updated to use hw_create, and the timers have to be updated to use Sys/Bios clock apis.

    That is sorta my plan.
  • OK, with the help of a very experience DSP guy here, this hack is working with a very small change.

    NOTE: This is working for my purpose only. I've integrated the USB from StarterWare and the MMCSD from PSP (I strip the FAT).

    In the file usb_host_msc.c

    static void USBHostIntHandler( UArg unit )
    {
    if( unit > 0 ) USB1HostIntHandler();
    else USB0HostIntHandler();
    }

    void ConfigureDSPINTCIntUSB (void)
    {
    #if 0
    IntDSPINTCInit();
    IntRegister(4, USB0DeviceIntHandler);
    IntEventMap(4, SYS_INT_USB0);
    IntEnable(4);
    IntGlobalEnable();
    #else
    Hwi_Params hwiParams;
    Error_Block eb;
    UInt32 key;

    Hwi_Params_init(&hwiParams);
    hwiParams.eventId = SYS_INT_USB0;
    key = Hwi_disable();
    Hwi_create(5, USBHostIntHandler, &hwiParams, NULL);
    Hwi_restore(key);
    #endif
    }


    In StarterWare, update sysdelay.c: update all those timer functions with Sys/Bios APIs, do not call those IntDSPINTCInit calls...

    In StarterWare, cpp41dma.c: replace CacheInv and CacheWB with api from Sys/Bios

    Also, since I am only using the usb_host_msc, I did not link in all the libraries in StarterWare. I only link what usb_host_msc required. This helped to simplify the code so that I could do this hack. It turned out that you only need less than 10 of the files in the StarterWare.

    Sorry but I cannot post my project....

    Thanks again for the help....
  • Sounds good.
    Thanks DSPwork for your update.
    I am sure that it would help other community members.
    Thank you.
  • Hi All,

    I am using StarterWare 1.20.04.01 and Bios 6.42.03.35. Now that I've gotten the USB host driver to work, I wanted to upgrade the FatFS in StarterWare to use FatFS in SysBios.

    I replaced the ff.c, ff.h, diskio.c, diskio.h from StarterWare with files in SysBios and a few others. In order to make this work, I had to make one fudge in ff.c around line 1900:

    if( fs->fsize < (szbfat + (SS(fs)-1)/SS(fs) ) ) CHANGED TO if( fs->fsize < ((szbfat + (SS(fs)-1)/SS(fs))-1 ) )

    Somehow the fat size is off by one. I fudge this check and everything is working as before.

    Does anyone know why the fat size is off by one?

    Thank you in advance.
  • If someone has a guess on why the fat size is off by one please post but I decided to stick with FATFS that came with StarterWare. Although it is older, it is faster. I do not know the details why FATFS (2007) in StarterWare is faster than FATFS (2012) that is in SysBios.

    I wanted to upgrade to improve speed but got slightly slower results.
  • Has anyone got the StarterWare USB HMSC driver to run more than 20MBs? I'm getting slightly below this but wondering if anyone has figured how to get this faster.

    I've tried some of the suggestions with ensuring it's configure to use high speed and changed the in/out ep buffers to 512 but no difference.

    Please let me know if you have other suggestions. Thank you.