cancel
Showing results for 
Search instead for 
Did you mean: 

Inprove the speed of the ''Mass storage'' as u disk

power3347
Associate II
Posted on March 13, 2012 at 09:30

hello everybody,

  I was tested using the TF card as a U disk routines.The read speed is 500KB

-700KB / s, write speed of 100KB/ s. Too slow, I would like to increase its 

transmission speed.I will change the way of the USB to transfer data to double 

buffering, speed does not improve, I would like to speed transmission 

bottlenecks on the TF card flash, and do you have any good suggestions?(In 

this post I willcontinue to update content on the USB.)

    (The operation of the TF card SDIO,DMA, 4bit.)

#usb-sdio-tf-card #usb-tf-dma-sdio #usb-tf-card-sdio
15 REPLIES 15
gafsos
Associate II
Posted on July 12, 2012 at 10:23

Tanks you clive1, it's now clear,

please one more questions according to your correction made on my code

1/ I set in prop.c file in Mass_Storage_SetConfiguration following:

void Mass_Storage_SetConfiguration(void)

{

  if (pInformation->Current_Configuration != 0)

  {

    /* Device configured */

    bDeviceState = CONFIGURED;

   ClearDTOG_RX(ENDP2);

 

   ClearDTOG_TX(ENDP1);

 

   ToggleDTOG_TX(ENDP2); /* reset value of the data toggle bits for the endpoint out*/

 

    ClearDTOG_RX(ENDP1);

 

    ClearDTOG_TX(ENDP1); /* clear the data toggle bits for the endpoint IN*/

    Bot_State = BOT_IDLE; /* set the Bot state machine to the IDLE state */

  }

}

and in MASS_NoData_Setup function:

RESULT MASS_NoData_Setup(uint8_t RequestNo)

{

  if ((Type_Recipient == (CLASS_REQUEST | INTERFACE_RECIPIENT))

      && (RequestNo == MASS_STORAGE_RESET) && (pInformation->USBwValue == 0)

      && (pInformation->USBwIndex == 0) && (pInformation->USBwLength == 0x00))

  {

        ClearDTOG_RX(ENDP2);

 

        ClearDTOG_TX(ENDP2);

 

       ToggleDTOG_TX(ENDP2); /* reset value of the data toggle bits for the endpoint out*/

 

       ClearDTOG_RX(ENDP1);

 

        ClearDTOG_TX(ENDP1); /* clear the data toggle bits for the endpoint IN*/    

    /*initialize the CBW signature to enable the clear feature*/

    CBW.dSignature = BOT_CBW_SIGNATURE;

    Bot_State = BOT_IDLE;

    return USB_SUCCESS;

  }

  return USB_UNSUPPORT;

} is it correct ? because I still have code 10 error

tanks

Abdul

gafsos
Associate II
Posted on July 12, 2012 at 11:18

Hi,

should I also update usb_bot.c file ? (Mass_Storage_In/Mass_Storage_Out)

Tanks

Posted on July 12, 2012 at 12:16

Presumably if you wanted initial states correct it would be

ClearDTOG_TX(ENDP1);
ClearDTOG_RX(ENDP1);
ToggleDTOG_RX(ENDP1);
ClearDTOG_RX(ENDP2);
ClearDTOG_TX(ENDP2);
ToggleDTOG_TX(ENDP2);

Now that's not to say you wouldn't need to change other parts of the code. It might take quite some effort, and understanding. The current release MSC code running on an STM32F4 USB-FS (12Mbps) card can read/write to an SD Card at 600/400 KBps. I'm not sure what your target rate is?

http://www.wired.com/images_blogs/photos/uncategorized/2008/04/16/450_cp_tank_leopard_061jpg

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
gafsos
Associate II
Posted on July 12, 2012 at 14:53

Thanks clive for your Help, Yopu are Great;

I'm working on V3.3.0 USB lib from ST, My aim is to implement a double buffering in MSC demo.

1/ The bit toggling : is it the best way to measure Read/write speed ? I have to measure them before and after Double Bufferinh implementation to get #;

2/ Can you please tell me if it is correct about Buffering adress in usb_conf.h:

/* tx buffer base address for Double fuffering */

#define ENDP1_BUFF0ADDR        (0x98)

#define ENDP1_BUFF1ADDR        (0xD8)

/* Rx buffer base address for Double fuffering */

#define ENDP2_BUFF0ADDR        (0x118)

#define ENDP2_BUFF1ADDR        (0x158)

beacuse I have a strange behavi

* On Reset Led1 On and the Off  (used for configuartion)

* it takes about more than 10 s to the device for appearing as Removable in windows

(not the case with simple buffer)

3/ in usb_bot.c is this correct ?

/*******************************************************************************

* Function Name  : Bot_Abort

* Description    : Stall the needed Endpoint according to the selected direction.

* Input          : Endpoint direction IN, OUT or both directions

* Output         : None.

* Return         : None.

*******************************************************************************/

void Bot_Abort(uint8_t Direction)

{

  switch (Direction)

  {

    case DIR_IN :

      SetDouBleBuffEPStall(ENDP1, EP_DBUF_IN);

      break;

    case DIR_OUT :

      SetDouBleBuffEPStall(ENDP2, EP_DBUF_OUT);

      FreeUserBuffer(ENDP2, EP_DBUF_OUT);

      break;

    case BOTH_DIR :

      SetDouBleBuffEPStall(ENDP1, EP_DBUF_IN);

      SetDouBleBuffEPStall(ENDP2, EP_DBUF_OUT);

      FreeUserBuffer(ENDP2, EP_DBUF_OUT);

      break;

    default:

      break;

Tanks you very much

Abdul

Posted on July 12, 2012 at 18:39

1) GPIO Toggling would give you some understanding of the time spent doing various things. For USB/MSC bandwidth testing I use a PC to read/write files that span several dozen MB, and later test some running 500-600 MB. Do large enough individual read requests that require multiple sectors, suggest 32KB (multiple of sector/cluster size, power of 2).

2) Looks reasonable enough, basically floor-planning the memory, allocating 0x40 bytes to each.

3) Don't know. I'm not sure if you need to stall specific buffers or the end point. The available examples don't have enough detail for me to be sure.

http://www.wired.com/images_blogs/photos/uncategorized/2008/04/16/450_cp_tank_leopard_061202.jpg

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
gafsos
Associate II
Posted on July 12, 2012 at 23:47

Thank you