0
\$\begingroup\$

I have implemented Media Storage Class on STM32 CPU with USB 480Mbit. CPU is connected to SD card (48MHz, 4 wire). I have checked that read speed from SD card is about 2 MB/s. Compared to USB SD card reader it is too low because with the same SD card it shows 10 MB/s. I have checked everything with oscilloscope and I see that CPU is reading SD card sectors one by one. Issuing CMD17 to read one sector. SD card reader is reading sectors without CMD command between then so I think it is using CMD18 (read multiple sectors). So the time between packets is much smaller in SD card reader than in STM32+SD.

I checked that windows is sending SCSII commands for each single sector. Is that true that windows does not read multiple sectors? If so than how SD card reader is reading multiple sectors? Maybe it is caching sectors by itself? When windows requests sector 10 it is reading 10 11 12 13... into it's internal memory?

SD card reader has the chip Atech 65548GJJ 116H6P854. But I didn't found any information about it?

Is that true that windows is reading sectors one by one and SD card chip is cashing sectors by itself? Maybe there are some documentation about that? Thanks

\$\endgroup\$
2
  • \$\begingroup\$ Which STM32? What mode are you running the sdcard? Have you done a measurement of how fast the STM32 can read sectors directly without using USB? Identify the bottleneck. \$\endgroup\$ Commented Apr 22 at 13:41
  • \$\begingroup\$ It is STM32F769 on a DISCO board. SD card is 4 bit wire and 48MHz clock. Without USB I can read multiple sectors fast enough. 20MB/s. But with USB there is no multiple sector request. Maybe it is windows problem? \$\endgroup\$ Commented Apr 22 at 15:11

1 Answer 1

2
\$\begingroup\$

I checked that windows is sending SCSI commands for each single sector. Is that true that windows does not read multiple sectors?

I've debugged USB mass storage some time ago - and saw READ commands up to cluster size (32KB for FAT32) at least.

There will be quite a few single sector reads for the FAT and the directories.

Can depend on the programs that do the actual reading - remember that "dd" is also available for windows (usually a Linux/Unix command line tool). Very handy if you needed to specify how much data should be read/written at a time.

Note that many µC mass storage stacks implement reads one sector at a time in order to avoid the requirement for a large data buffer.

\$\endgroup\$
3
  • \$\begingroup\$ Hello Turbo J, thanks for reply. Were you debugging USB in a microcontroller or on PC side? \$\endgroup\$ Commented Apr 22 at 15:45
  • \$\begingroup\$ ALL of it including the signal on the wires itself (full speed luckily, digital scope could capture a few seconds). Was tracking a bug. \$\endgroup\$ Commented Apr 22 at 17:54
  • \$\begingroup\$ I have checked that there is a fixed size one sector buffer and this was a limit. I have increased it and speed got higher. Windows was sending multiple sector read but due to limitation's in software no multiple sector read was done. I consider this as an answer. Thanks for help. \$\endgroup\$ Commented Apr 23 at 13:51

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.