2024-03-18 02:28 AM - edited 2024-03-18 02:37 AM
I am running USB in Mass Storage host mode. On connecting the device, USB FLASH stick, it takes around 20 seconds to change the Appli_Sate from APPLICATION_START to APPLICATION_READY in usb_host.c file.
It is normal ? Can the time be reduced ?
Thanks
Solved! Go to Solution.
2024-03-19 08:02 AM - edited 2024-03-19 10:57 AM
ok, so via swd + DWT counter ->
about 9,2 ms from inserted to fatfs mounted ok;
is 64 GB (noname chinese..) USB stick, exfat , 50GB free.
btw
How often you call the MX_USB_HOST_Process(); ?
I call it in main loop about every some 5us ....nothing else to do now, waiting for first command.
So this might be maximum speed, that can be achieved .
ed
+
Just for fun - had the idea, to try an old SanDisk 32GB stick, fat32, also, got ->
about 15ms insert to mounted. Ok for this piece of plastic shi.t , i think.
2024-03-18 06:02 AM
Hello @Nico3
Are you sure you are not printing to VCP/ UART or any terminal while debugging? It seems like an amount of time taken for printing debug information.
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-03-19 01:57 AM - edited 2024-03-19 02:01 AM
Hi
Please note I am not printing anything. I also commented my remaning code and just checked the change in state on inserting the USB stick. It takes ~30 second to go from APPLICATION_START to APPLICATION_READY.
I checked both on STM32F4 discovery as well on board designed by me. It is coming same ~30 seconds.
The USB stick is 32 GB, SCANDISK & FAT formatted.
2024-03-19 06:12 AM - edited 2024-03-19 07:11 AM
Then the contrary, add some prints/traces to understand where it spends its time.
Do not set breakpoints because USB requires realtime reaction from the device.
Of course, 30 sec. delay is not normal.
2024-03-19 06:48 AM
Please suggest what should I trace.
2024-03-19 07:02 AM
Hi,
i never tested , but if you want, i could try to catch the time : Appli_Sate from APPLICATION_START to APPLICATION_READY
on my H743 , at 200M core (so not too far away from your F4 ?? cpu ).
2024-03-19 07:07 AM
please check if you can..
I used 32 GB flashstick and formatted in FAT mode.
2024-03-19 07:17 AM
@Nico3 Trace:
- where the host reads various device (the USB stick) descriptors and strings
- where the host decides that the MCS device is fully detected and starts sending class-specific requests
- where the host successfully receives data from MSC device
- where errors and timeouts are detected in the above steps, and the app retries them
2024-03-19 08:02 AM - edited 2024-03-19 10:57 AM
ok, so via swd + DWT counter ->
about 9,2 ms from inserted to fatfs mounted ok;
is 64 GB (noname chinese..) USB stick, exfat , 50GB free.
btw
How often you call the MX_USB_HOST_Process(); ?
I call it in main loop about every some 5us ....nothing else to do now, waiting for first command.
So this might be maximum speed, that can be achieved .
ed
+
Just for fun - had the idea, to try an old SanDisk 32GB stick, fat32, also, got ->
about 15ms insert to mounted. Ok for this piece of plastic shi.t , i think.
2024-03-19 03:51 PM - edited 2024-03-19 03:53 PM
> about 9,2 ms
> about 15ms insert to mounted.
This is what should be.
Time individual MSC class requests to find where it wastes time. The capacity in bytes vs block numbers look suspicious.