Why is internal card reader so slow?

Continuing the discussion from Librem 6 Look Ahead Wishlist:

and @WinstonSmith

Edits

  1. Clarify that cellular modem kill switch was used to disable the modem prior to testing. This matters because the cellular modem is on the same USB bus as the card reader.
  2. Add separate test data for desktop using a USB 2.0 port.
  3. Add some information about the spec of card that was used.

/Edits

That is my opinion too.

OK, so I have shut down my Librem 5 and removed the µSD card and booted phone. I have then tested said card in a USB 3.0 card reader dongle.

write speed tested with dd if=/dev/zero of=test bs=1M count=1024 conv=fdatasync
read speed tested with dd if=test iflag=direct of=/dev/null bs=1M

so I am testing with files that are 1,073,741,824 bytes in size i.e. 1 GiB.

from middle-of-the-road desktop
(dongle plugged into USB 2.0 port)
W: 21.5 MB/s      R: 39.5 MB/s

(dongle plugged into USB 3.0 port)
W: 37.7 MB/s      R: 87.7 MB/s

(dongle plugged into USB-C port of phone)
W: 33.9 MB/s      R: 73.8 MB/s

So we can say that the combination of card reader and card is certainly not setting the world on fire and also not going anywhere near the USB 3.0 bus speed, and Librem 5 performance is reasonably close to desktop performance - so very likely the card or card reader is the limiting factor. But at least we know what the card is capable of.

Now shut down the phone and install the µSD card in the internal card reader and boot phone.

(using internal card reader of phone)
W: 12.3 MB/s      R: 10.8 MB/s

You will note that the speed is much much less when using the internal card reader, as compared with using the USB-C port with a dongle, and way way below USB 2.0 bus speed. When reading, the card would be capable of using all of the USB 2.0 bus speed but it doesn’t get anywhere near it.

Why is it so?

Maybe @WinstonSmith would like to repeat at least the last part of that.

My card is a SanDisk Ultra. It is labelled as being able to use the UHS-I bus protocol (not higher).

It is labelled with speed classes C10 and U1. However the testing above tentatively suggests that it is actually capable of U3 speeds when in a suitable card reader.

8 Likes

See also:

4 Likes

According to USB2642’s datasheet, it should be capable of sustained transfer rates “exceeding 35MB/s”. In my experience, it only does about 15MB/s. Why? Who knows. Feel free to investigate.

4 Likes

4 posts were split to a new topic: Punchcard v Librem 5

I believe that you verified that the sdcard read/writes are slow on the L5 due to the fact that it is on the USB2.0 bus is the limiting factor. Right? I had thought you said that wasn’t the case.

The remaining mystery seems to be why the R/W of the sdcard seems to be slower than what people here might expect on the USB2.0 bus. Some facts:

  1. The USB2.0 maximum transfer rate is 60MBps (480Mbps) at half duplex and, so, depending on the bulk data packet size and other protocol overhead, one might maximally get 30MBps-35MBps total.

  2. I believe that this limit is at the USB controller level and is shared between the devices (wifi, cellular modem). I’m not sure about the L5, but it probably has one USB2.0 controller. However, I don’t think this will be significant.

So it’s still a bit of a mystery why it is significantly slower than 30MBps. However, I think the following knowledge-base article about the particular USB2.0 hub (USB2642), it becomes more clear. I should note that I’ve seen similar performance UHS I and UHS II cards over USB2.0 so I don’t think it’s the hub in particular. Microchip Lightning Support

What SD Cards are supported with USB2642?

USB2642 does not support UHS-I and UHS-II bus interfaces as the spec version is not compliant and the bus speeds are above the bus speed of USB2642 (35MB/s)

UHS utilizes a new data bus that will not work in non-UHS host devices. If you use a UHS memory card in a non-UHS host, it will default to the standard data bus and use the “Speed Class” rating instead of the “UHS Speed Class” rating.

i.e. This article suggests that since the USB2.0 hub doesn’t support UHS speeds … it drops to “Normal Speed” (12.5MB/s) or “High Speed” (25MB/s) [And it clarifies that this is MB, not MiB]. And, from the performance, it looks like it’s dropping to the former (“Normal Speed” of 12.5MB/s).

8 Likes

In my brief investigation I managed to know (by a small adopting of this project), that the bus speed for my UHS-1 U3 card is only 30 MHz and there is no way to increase that.

USB2642 also has some configuration capability, but there is no accompanying i2c or spi chip in our case, so it was impossible to play with that and I went to sleep.

By the way, I found one device used the same USB hub: USB-SD-Mux. Someone with the necessary skills could buy it and compare performance…

3 Likes

I don’t think we are having a major disagreement here but maybe there is some subtle distinction being made. My starting point was:

so what you are proving is that the USB 2.0 bus is not the limiting factor. The limiting factor may be the SD interface or the chip that implements it.

I guess one test that I did not conduct in the OP is to do the same thing on my desktop but with the card reader plugged into a USB 2.0 port. That would then show what USB 2.0 is capable of if the card and card reader are up to the job.

So in terms of “subtle distinctions” the issue here may not be “the USB 2.0 bus” but actually “the USB 2.0 hub” i.e. the specific chip that implements both the hub and the SD interface.

For completeness, the diagram above shows and I believe it to be the case anyway that

  • the WiFi is not using USB at all - the WiFi is interfaced with using one of the two built-in SD controllers i.e. SDIO, and
  • (even though I didn’t state it in the OP) I had the cellular modem switched off (killed) and hence it could not possibly interfere with the measuring.

So there should be no sharing with the test conditions as set by me (as distinct from what might happen in the real world).

If your analysis is correct then that would seem to justify the original inclusion of this topic in a Librem 5v2 wishlist i.e. a wish for an SD card interface that can support ‘normal’ speeds for today - let’s say at least UHS-I (@ 50 MB/s, or better still @ 104 MB/s), which would bring it within sight of the eMMC drive. @WinstonSmith

Even though I did not state it, I was testing with a UHS-I card.

4 Likes

Could you provide the part number of your card?
My is MB-MC512KA and Class 10 is not in the list of supported protocols…

1 Like

My understanding is that “Class 10” is a speed rating for a card, not a statement directly about what SD bus protocols it supports.

C10 means: can sustain at least a sequential write speed of 10 MB/s (and must also be able to sustain at least a sequential read speed of the same amount - but usually read speed ≥ write speed anyway).

You could infer from the above testing that my card could legally bear a marking of C10.

However C10 has also come to imply a bus protocol as well because “C” ratings are only used with the SD default (normal) or high speed buses - not with the UHS-I, -II or -III buses.

As for my card, exact part number probably not but it’s a SanDisk Ultra. And I think the testing and discussion shows that there is no point having a better card.

3 Likes

Is it possible that the problem is with the card? It wants to use UHS-1 but when it discovers, mutually with the card reader, that UHS-1 is not possible, it just says “bugger it” and drops all the way down to the default normal speed (12.5 MB/s).

I think these days it might be a struggle to buy a µSD card that uses the HS bus protocol (not higher i.e. not UHS).

3 Likes

FWIW, Microchip has a “Benchmark and Media Compatibility Report” included in their SDK package and the highest performing cards tested there reached about 20MB/s, while most were in 10-15MB territory.

Ultimately it all depends on the bus clock as already noticed above. Seems like the question “why?” has been now sufficiently answered in this thread :slight_smile: At least I’m satisfied with the answers.

4 Likes

Everyone beware technology is not here yet. Be patent for now,: The SD cards are only rated at a V30 speed. The V60’s are not here yet at 1 or 2 Tb. If you want faster speed you must use a SSD external Drive with external power supply. This is for watching video’s or games and etc with large memory’s for fast up loads and downloads. Of Course; can you see someone with wires hanging everywhere connected to their phone looking like a idiot. :upside_down_face:

2 Likes

Update: I bought this SD and formatted it at FAT-32. Then used my Ubuntu computer(my files) downloaded and loaded it onto the micro card then place it in my L5 Phone. It is usable at lower speeds but tolerable. Like I had made my last comment until SD comes up with a V60 card. We just have to wait for faster card speed. This is the link to the card I had bought and used.
https://www.amazon.com/SanDisk-Extreme-microSDXC-Memory-Adapter/dp/B07P9W5HJV?th=1
w7eet

1 Like

Can you measure and report actual speeds, referring to the commands in the OP?

A full review of this topic suggests that that is not true. A V60 card will never give you V60 speeds using the Librem 5’s internal card reader - so an even faster card will not help. At least those are my conclusions.

4 Likes

V60 microSD cards are already available, with options like the ProGrade Digital microSDXC UHS-II V60 512GB card, offering high speeds for professional video and photography needs.
Ref to: Google Search

2 Likes

V60 micro SDs should be a lot faster.

1 Like

I need a 1TB

1 Like

I will tell you a little secret. You are not the only one and that is me. I can not hardly wait for the 1 or 2tb at V60 to be available.

2 Likes

It’d be great!

1 Like

Dudes, please actually read what has been written in this topic. Due to the particular chip that has been used, you will never get V60 speeds. In fact, that kind of speed would be pushing it on a USB 2.0 bus anyway (so even with a better chip, as long as it is a USB 2.0 chip, you will not get spectacular speeds).

So bottom line is that that kind of speed is a wishlist item for Librem 5v2 - which is where this discussion started.

5 Likes