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.

Trying to use the sample code in starterware to write to a USB drive

I've been playing around with the USB code that ships with the starterware for the LCDKC6748. I've got it running and can properly read a file from the USB key. There is no write command so I tooke the read (cat) command code and modified it to write to a file. The fat-fs function f_open works and returns the proper status when I open a file for writing and the f_write finction seems to return OK. When I call f_sync or f_close I get an error and no data is written to the USB key. Does the low level code that ships with the example work properly? Has anyone got it writing to a USB key? Sorry if this is the wrong form, if so just let me know the proper one and I'll post my question there.

Thanks,

Blair

  • Hi Blair,

    Are you using TI-RTOS? If so, which version?

    Steve
  • At the moment no, but I'm planning to in the end. This is the other end of the McASP question I had last week. We want to read data from 4 ADC's filter and decimate then store the data to either SD or USB. We have the SD system up and running, but it won't run fast enough. It is close at 7 MB/sec using fat-fs but I'd like to be on the high side of 12 mB/sec if I can. That will allow for other processes and overhead.

    At the moment I am just playing around with the starterware version of the USB code and got it writing yesterday by turning on edma mode. Could not get it to write otherwise. This is not really a problem as we will be using edma anyway. The performance is quite bad at the moment, but I see from other posts on the forms that this is to be expected and I'm working my way through the suggestions now. Is there a TI-RTOS driver for the USB port for the C6748 or is the code in the starter ware install all there is?

    Blair
  • Blair,

    I believe the code for starterware is all there is, as there is no USB driver support in TI-RTOS for the C6748.

    I'll see about getting this thread moved to the proper forum for starterware questions. This is the right forum for TI-RTOS questions, by the way. So, you should post back here once you have started with that and have questions.

    Steve
  • Blair,

    I went ahead and moved this thread over to the device forum in hopes that you can get a further response there.
  • Hi Blair,

    Good attempt.

    Yes, it is true that the write command doenot exist in the USB host mass storage starterware code. And under the third party, "fat_fs" code, we will be able to see the required functions like f_open, f_write and f_close exist.

    Blair said:
    The fat-fs function f_open works and returns the proper status when I open a file for writing and the f_write function seems to return OK. When I call f_sync or f_close I get an error and no data is written to the USB key.

    Make sure that the filesystem is mounted. Debug and check inside the f_write function that the return values are valid without any error.

    Though a file is not created, as a first step, verify whether any content is written inside the USB key using "Disk Investigator" ( an windows tool ).

    What error you received when you do f_close()?... Debug inside the f_sync() function to know what type of error it is.....

  • Thanks for the reply. The file system is mounted and I can read from the drive. Once I turn on edma mode I can write to the drive, but not without enabling edma mode.

    I'll check on the error code and post it later today.

    Blair
  • Hi Blair,

    oh, great!!.

    Sure, post about the error code.