2024-04-15 07:29 PM
I am trying to implement a USB mass storage using USB3300, STM32H723, and e eMMC.
Project Setup:
* Clock config
USB_HS Config
USB Device config
eMMC config
In the code I made these addons in the "usbd_storage_if.c" file:
Currently, my custom board is working as a Mass storage USB at a speed of 14MBps.
I found that when I removed the code line in function
"STORAGE_Read_HS()", and "STORAGE_Write_HS()":
while (HAL_MMC_GetCardState(&hmmc1)!=HAL_MMC_CARD_TRANSFER){
};
The transfer speed can be reached at 40MBps, but the data saved to the USB went wrong.
How can I speed up my USB?
2024-04-18 01:18 AM
Hello @GnasUhn
Would you please check your USB clock config. The controller requires a dedicated 48 MHz clock that is generated by a PLL connected to the HSE oscillator.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-04-19 12:44 AM
Hi, FBL
I adjusted my USB clock to 48Mhz, but I noticed that the speed of the USB still did not improve (13MBps).
In STORAGE_Read_HS() and STORAGE_Write_HS() function, when we using HAL_MMC_ReadBlock() and HAL_MMC_WriteBlock(). we have to wait for CardState != HAL_MMC_CARD_TRANSFER to continue the next step.
Can I use DMA to read and write in these functions, and How can I change file IOC file to do that?
2024-04-19 02:04 AM - edited 2024-04-19 02:35 AM
Hi @GnasUhn
We recommend reserving a minimum of 0x100 for EP1 bulk transfer (double buffer).
The fifo setting for MSC HS:
HAL_PCDEx_SetRxFiFo(&hpcd, 0x200);
HAL_PCDEx_SetTxFiFo(&hpcd, 0, 0x40);
HAL_PCDEx_SetTxFiFo(&hpcd, 1, 0x100);
Theoretically, it is possible to reach 60MBps but in practice using DMA we can reach around 40MBps. In your application, you may need to implement a non-blocking delay or yield if using an RTOS.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-04-22 01:52 AM - edited 2024-04-22 02:17 AM
Hi, we followed the config of the EP1 transfer that you recommended but the speed of the USB did not change.
In my application, we do not use RTOS, the USB device is initiated by MX_USB_DEVICE_Init().
Are there any reasons that need attention in the firmware that can cause issues with the speed of the USB MSC?
The source code of the project is shared in the link below.