Increase USB file transfer speed in MQX 4.0

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Increase USB file transfer speed in MQX 4.0

594 Views
pramodk_g_
Contributor III

Hi All,

I am working with K70F120M, MQX 4.0 , CW 10.5 on a custom board. I want to take the my SD card as mass storage on PC. So I integrated the two MQX 4.0 example codes( USB msd Ramdisk and SD card )and it has worked for me. But my issue is that file transfer speed is very low, around 100kbps. Also It is taking around 15 seconds to detect the device in MAC os. Is there any way to improve this speed?. Please find the below code snippet and let me know is there any way to increase the size of read/write block (currently SD_Block_Size = 1). I found the code flow goes to despatch.s when I increased SD_Block_Size to higher values. 

Please share your valuable thoughts.

Thanks,

Pramod.

0 Kudos
1 Reply

375 Views
pramodk_g_
Contributor III

Sorry I forgot to attach the code, Please find the below code.

#if RAM_DISK_APP

            USB_mem_copy(g_disk.storage_disk + lba_data_ptr->offset, lba_data_ptr->buff_ptr, lba_data_ptr->size);

#elif SD_APP //ALL

            sdcard_handle->LOCATION = (lba_data_ptr->offset >> 9); //

            read(sdcard_handle, u8gvlba_data_buff, SD_Block_Size);

            USB_mem_copy(u8gvlba_data_buff + (lba_data_ptr->offset%(uint_32)512), lba_data_ptr->buff_ptr, lba_data_ptr->size);

           

#endif        

            break;

        case USB_MSC_DEVICE_WRITE_REQUEST:

            /* copy data from USb buffer to Storage device

             (Called before after recv_data on BULK OUT endpoints)*/

            lba_data_ptr = (PTR_LBA_APP_STRUCT) val;

            /* read data from driver buffer to mass storage device */

#if RAM_DISK_APP

            USB_mem_copy(lba_data_ptr->buff_ptr, g_disk.storage_disk + lba_data_ptr->offset,lba_data_ptr->size);

#elif SD_APP //ALL

            USB_mem_copy(lba_data_ptr->buff_ptr,

                    u8gvlba_data_buff+ (lba_data_ptr->offset%(uint_32)512), //  

                    lba_data_ptr->size);

            if (3 == u8gvIndex++)

            {

                sdcard_handle->LOCATION = (lba_data_ptr->offset >> 9);

                write(sdcard_handle, u8gvlba_data_buff, SD_Block_Size);

                u8gvIndex = 0;

            }

           

#endif          

0 Kudos