AnsweredAssumed Answered

USB mass storage device from SD card with TWR-K60

Question asked by Daniel Chai on Jul 12, 2013
Latest reply on Oct 1, 2014 by mircopizzichini

Hi All,

 

I edit the code for msd_usb from RAM to SD card. Now my problem is that every time when I plug in the USB cable to my PC, it asks me to format. But I can not format it. It seems there is something wrong.

I just edit

From

case USB_MSC_DEVICE_READ_REQUEST :         
    lba_data_ptr = (PTR_LBA_APP_STRUCT)val;
    #if RAM_DISK_APP
        USB_mem_copy(g_disk.storage_disk + lba_data_ptr->offset,
                lba_data_ptr->buff_ptr,
                lba_data_ptr->size);
    #endif        
    break;
case USB_MSC_DEVICE_WRITE_REQUEST :
    lba_data_ptr = (PTR_LBA_APP_STRUCT)val;
    #if RAM_DISK_APP
    USB_mem_copy(lba_data_ptr->buff_ptr,
                    g_disk.storage_disk + lba_data_ptr->offset,
                    lba_data_ptr->size);
    #endif                         
    break;

TO

case USB_MSC_DEVICE_READ_REQUEST :    

    lba_data_ptr = (PTR_LBA_APP_STRUCT)val;

    fread(lba_data_ptr->buff_ptr, 1, 1, filesystem_handle);

    break;

case USB_MSC_DEVICE_WRITE_REQUEST :

    lba_data_ptr = (PTR_LBA_APP_STRUCT)val;

    fwrite(lba_data_ptr->buff_ptr, 1, 1, filesystem_hanlde);

    break;

I am new to this, any ideas will be appreciated.


Thank you.


-Daniel

Outcomes