# Ethernet and USB Hub Add-on, Only Seeing About 52 MB/S In SD Card Slot despite being in SDR104 mode

Source: https://forum.modalai.com/topic/3860/ethernet-and-usb-hub-add-on-only-seeing-about-52-mb-s-in-sd-card-slot-despite-being-in-sdr104-mode
Category: VOXL 2 and VOXL 2 Mini (https://forum.modalai.com/category/26/voxl-2-and-voxl-2-mini)
Tags: voxl-2
Posted: 2024-10-11 16:43:16 UTC by John Nomikos
Replies: 4 · Views: 1017

## John Nomikos · 2024-10-11 16:43:16 UTC

Good afternoon,

I was wondering if there is anything I can do to increase the speed of the SD card slot on the Ethernet and USB Hub Add-On board.

When an SD card is connected to it, the dmesg output shows that it is in SDR104 mode, and yet it only gives about 52 MB/S upload speed on average. However, the same SD card connected to an external SD card reader over USB 3.0 JST gives about 92 MB/S average upload speed. 

**Dmesg output:**

```
[    0.323948] pm8150a_s3_mmcx_sup_level: regulator get failed, ret=-517
[    0.324633] pm8150a_s3_mmcx_sup_level: supplied by pm8150_s3_mmcx_sup_level
[    0.328906] pm8150a_s4_level: supplied by pm8150a_s3_mmcx_sup_level
[    1.905683] mmc0: SDHCI controller on 8804000.sdhci [8804000.sdhci] using 64-bit ADMA in legacy mode
[    2.168643] mmc0: new ultra high speed SDR104 SDXC card at address aaaa
[    2.169465] mmcblk0: mmc0:aaaa SR64G 59.5 GiB 
[    2.170249]  mmcblk0: p1
[    4.583627] mmc0: data txfr (0x00200000) error: -84 after 0 ms
[    4.583647] mmc0: sdhci: ============ SDHCI REGISTER DUMP ===========
[    4.583658] mmc0: sdhci: Sys addr:  0x00000018 | Version:  0x00007202
[    4.583671] mmc0: sdhci: Blk size:  0x00000200 | Blk cnt:  0x00000010
[    4.583681] mmc0: sdhci: Argument:  0x00000820 | Trn mode: 0x0000003b
[    4.583690] mmc0: sdhci: Present:   0x03f802f6 | Host ctl: 0x0000001e
[    4.583699] mmc0: sdhci: Power:     0x0000000d | Blk gap:  0x00000000
[    4.583708] mmc0: sdhci: Wake-up:   0x00000000 | Clock:    0x00000007
[    4.583718] mmc0: sdhci: Timeout:   0x0000000a | Int stat: 0x00000000
[    4.583728] mmc0: sdhci: Int enab:  0x03bf100b | Sig enab: 0x03bf100b
[    4.583737] mmc0: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
[    4.583745] mmc0: sdhci: Caps:      0x3629c8b2 | Caps_1:   0x0000808f
[    4.583754] mmc0: sdhci: Cmd:       0x0000123a | Max curr: 0x00000000
[    4.583763] mmc0: sdhci: Resp[0]:   0x00000900 | Resp[1]:  0x00000000
[    4.583772] mmc0: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000900
[    4.583779] mmc0: sdhci: Host ctl2: 0x0000000b
[    4.583788] mmc0: sdhci: ADMA Err:  0x00000003 | ADMA Ptr: 0x00000000edc9a224
[    4.583958] mmc0: clk: 201500000 claimer: (null) pwr: 12
[    4.583960] mmc0: rpmstatus[pltfm](runtime-suspend:usage_count:disable_depth)(0:1:0)
[    4.583961] mmc0: sdhci: ============================================
[    4.591617] mmc0: data txfr (0x00200000) error: -84 after 1 ms
[    4.591630] mmc0: sdhci: ============ SDHCI REGISTER DUMP ===========
[    4.591640] mmc0: sdhci: Sys addr:  0x00000180 | Version:  0x00007202
[    4.591650] mmc0: sdhci: Blk size:  0x00000200 | Blk cnt:  0x00000030
[    4.591659] mmc0: sdhci: Argument:  0x00000880 | Trn mode: 0x0000003b
[    4.591668] mmc0: sdhci: Present:   0x030802f6 | Host ctl: 0x0000001e
[    4.591679] mmc0: sdhci: Power:     0x0000000d | Blk gap:  0x00000000
[    4.591691] mmc0: sdhci: Wake-up:   0x00000000 | Clock:    0x00000007
[    4.591701] mmc0: sdhci: Timeout:   0x0000000a | Int stat: 0x00000000
[    4.591711] mmc0: sdhci: Int enab:  0x03bf100b | Sig enab: 0x03bf100b
[    4.591721] mmc0: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
[    4.591730] mmc0: sdhci: Caps:      0x3629c8b2 | Caps_1:   0x0000808f
[    4.591740] mmc0: sdhci: Cmd:       0x0000123a | Max curr: 0x00000000
[    4.591749] mmc0: sdhci: Resp[0]:   0x00000900 | Resp[1]:  0x00000000
[    4.591758] mmc0: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000900
[    4.591766] mmc0: sdhci: Host ctl2: 0x0000000b
[    4.591774] mmc0: sdhci: ADMA Err:  0x00000003 | ADMA Ptr: 0x00000000edc9a3c8
[    4.591933] mmc0: clk: 201500000 claimer: (null) pwr: 12
[    4.591935] mmc0: rpmstatus[pltfm](runtime-suspend:usage_count:disable_depth)(0:1:0)
[    4.591936] mmc0: sdhci: ============================================
[   76.014499] mmc0: data txfr (0x00200000) error: -84 after 0 ms
[   76.014523] mmc0: sdhci: ============ SDHCI REGISTER DUMP ===========
[   76.014533] mmc0: sdhci: Sys addr:  0x00000008 | Version:  0x00007202
[   76.014543] mmc0: sdhci: Blk size:  0x00000200 | Blk cnt:  0x00000001
[   76.014552] mmc0: sdhci: Argument:  0x00000810 | Trn mode: 0x0000003b
[   76.014561] mmc0: sdhci: Present:   0x03f802f6 | Host ctl: 0x0000001e
[   76.014569] mmc0: sdhci: Power:     0x0000000d | Blk gap:  0x00000000
[   76.014577] mmc0: sdhci: Wake-up:   0x00000000 | Clock:    0x00000007
[   76.014586] mmc0: sdhci: Timeout:   0x0000000a | Int stat: 0x00000000
[   76.014594] mmc0: sdhci: Int enab:  0x03ff100b | Sig enab: 0x03ff100b
[   76.014603] mmc0: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
[   76.014612] mmc0: sdhci: Caps:      0x3629c8b2 | Caps_1:   0x0000808f
[   76.014620] mmc0: sdhci: Cmd:       0x0000123a | Max curr: 0x00000000
[   76.014629] mmc0: sdhci: Resp[0]:   0x00000900 | Resp[1]:  0x00000000
[   76.014637] mmc0: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000900
[   76.014650] mmc0: sdhci: Host ctl2: 0x0000000b
[   76.014659] mmc0: sdhci: ADMA Err:  0x00000000 | ADMA Ptr: 0x00000000edc9a20c
[   76.014822] mmc0: clk: 201500000 claimer: (null) pwr: 12
[   76.014824] mmc0: rpmstatus[pltfm](runtime-suspend:usage_count:disable_depth)(0:1:0)
[   76.014825] mmc0: sdhci: ============================================
[   76.017195] mmc0: data txfr (0x00200000) error: -84 after 0 ms
[   76.017206] mmc0: sdhci: ============ SDHCI REGISTER DUMP ===========
[   76.017215] mmc0: sdhci: Sys addr:  0x00000038 | Version:  0x00007202
[   76.017224] mmc0: sdhci: Blk size:  0x00000200 | Blk cnt:  0x00000035
[   76.017232] mmc0: sdhci: Argument:  0x00000840 | Trn mode: 0x0000003b
[   76.017243] mmc0: sdhci: Present:   0x030802f6 | Host ctl: 0x0000001e
[   76.017251] mmc0: sdhci: Power:     0x0000000d | Blk gap:  0x00000000
[   76.017259] mmc0: sdhci: Wake-up:   0x00000000 | Clock:    0x00000007
[   76.017267] mmc0: sdhci: Timeout:   0x0000000a | Int stat: 0x00000000
[   76.017276] mmc0: sdhci: Int enab:  0x03ff100b | Sig enab: 0x03ff100b
[   76.017284] mmc0: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
[   76.017292] mmc0: sdhci: Caps:      0x3629c8b2 | Caps_1:   0x0000808f
[   76.017302] mmc0: sdhci: Cmd:       0x0000123a | Max curr: 0x00000000
[   76.017310] mmc0: sdhci: Resp[0]:   0x00000900 | Resp[1]:  0x00000000
[   76.017318] mmc0: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000900
[   76.017326] mmc0: sdhci: Host ctl2: 0x0000000b
[   76.017333] mmc0: sdhci: ADMA Err:  0x00000003 | ADMA Ptr: 0x00000000edc9a224
[   76.017488] mmc0: clk: 201500000 claimer: (null) pwr: 12
[   76.017490] mmc0: rpmstatus[pltfm](runtime-suspend:usage_count:disable_depth)(0:1:0)
[   76.017491] mmc0: sdhci: ============================================
[   76.326540] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
```

**Test Output For SD Card Slot**
```
voxl2:/$ sync && dd if=/dev/zero of=/media/sdcard/testfile bs=50M count=1 oflag=dsync && sync
1+0 records in
1+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.965705 s, 54.3 MB/s
voxl2:/$ sync && dd if=/dev/zero of=/media/sdcard/testfile bs=50M count=1 oflag=dsync && sync
1+0 records in
1+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.956928 s, 54.8 MB/s
voxl2:/$ sync && dd if=/dev/zero of=/media/sdcard/testfile bs=50M count=1 oflag=dsync && sync
1+0 records in
1+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.970479 s, 54.0 MB/s
voxl2:/$ sync && dd if=/dev/zero of=/media/sdcard/testfile bs=50M count=1 oflag=dsync && sync
1+0 records in
1+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 1.03216 s, 50.8 MB/s
voxl2:/$ 
voxl2:/$ sync && dd if=/dev/zero of=/media/sdcard/testfile bs=50M count=1 oflag=dsync && sync
1+0 records in
1+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 1.06114 s, 49.4 MB/s
voxl2:/$ sync && dd if=/dev/zero of=/media/sdcard/testfile bs=50M count=1 oflag=dsync && sync
1+0 records in
1+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 1.00951 s, 51.9 MB/s
voxl2:/$ sync && dd if=/dev/zero of=/media/sdcard/testfile bs=50M count=1 oflag=dsync && sync
1+0 records in
1+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 1.0044 s, 52.2 MB/s
```
**Test Output For External SD Card Reader Over USB 3.0**
```
voxl2:/$ sync && dd if=/dev/zero of=/media/gfr/testfile bs=50M count=1 oflag=dsync && sync
1+0 records in
1+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.593894 s, 88.3 MB/s
voxl2:/$ sync && dd if=/dev/zero of=/media/gfr/testfile bs=50M count=1 oflag=dsync && sync
1+0 records in
1+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.576349 s, 91.0 MB/s
voxl2:/$ sync && dd if=/dev/zero of=/media/gfr/testfile bs=50M count=1 oflag=dsync && sync
1+0 records in
1+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.597077 s, 87.8 MB/s
voxl2:/$ sync && dd if=/dev/zero of=/media/gfr/testfile bs=50M count=1 oflag=dsync && sync
1+0 records in
1+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.548355 s, 95.6 MB/s
voxl2:/$ 
voxl2:/$ sync && dd if=/dev/zero of=/media/gfr/testfile bs=50M count=1 oflag=dsync && sync
1+0 records in
1+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.585704 s, 89.5 MB/s
voxl2:/$ sync && dd if=/dev/zero of=/media/gfr/testfile bs=50M count=1 oflag=dsync && sync
1+0 records in
1+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.552729 s, 94.9 MB/s
voxl2:/$ sync && dd if=/dev/zero of=/media/gfr/testfile bs=50M count=1 oflag=dsync && sync
1+0 records in
1+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.591907 s, 88.6 MB/s
voxl2:/$ sync && dd if=/dev/zero of=/media/gfr/testfile bs=50M count=1 oflag=dsync && sync
1+0 records in
1+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.550808 s, 95.2 MB/s
voxl2:/$ sync && dd if=/dev/zero of=/media/gfr/testfile bs=50M count=1 oflag=dsync && sync
1+0 records in
1+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.588921 s, 89.0 MB/s
voxl2:/$ 
voxl2:/$ sync && dd if=/dev/zero of=/media/gfr/testfile bs=50M count=1 oflag=dsync && sync
1+0 records in
1+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.559946 s, 93.6 MB/s
```

I am thinking the difference in speeds is hardware related, but I would like to hear others input.

SD Card Specs: SanDisk Extreme PRO 64GB microSD V30
![15a7face-1acc-4296-95dd-0052567fbe56-image.png](https://forum.modalai.com/assets/uploads/files/1728664788208-15a7face-1acc-4296-95dd-0052567fbe56-image.png) 

Note: I also tried a different microsd card, a [ProGRADE 128Gb MicroSD card](https://shop.progradedigital.com/products/microsdxc-uhs-ii-v60-memory-card-250mbps?variant=32277697200205) which is V60 and UHS II, and that one would not get detected in the microsd card slot, despite the card reader I have detecting it. I think that might be due to it being a UHS II card

## Reply by Moderator (ModalAI staff) · 2024-10-16 04:22:19 UTC

@John-Nomikos there's really nothing we can do to affect the SD Card write speed. It's directly connected to the Qualcomm chip

## Reply by Alex Kushleyev (ModalAI staff) · 2024-10-16 16:41:51 UTC

@John-Nomikos , can you repeat a test with a larger file, lets say 500MB instead of 50MB just to eliminate the possibility of some buffering (while still using the write block size of 50MB). Also, block size of 50MB may be too big, you could try smaller size.

Also, using `dsync` may result in unnecessarily slower writes, as users report : https://superuser.com/questions/943952/why-am-i-getting-very-slow-dd-dsync-test-results-in-linux

the USB3 adapter is going through a completely different kernel driver and may be reacting to the sync commands differently.

I think a more realistic test would be sustained write of a larger file using smaller block size and just calling sync at the end and measuring how much time it took:

put the following line into a sd_test.sh, `chmod +x sd_test.sh`:
```
dd if=/dev/zero of=/media/gfr/testfile bs=50M count=10 && sync
```

run the test:
```
sync && time ./sd_test.sh
```

I am curious what you find!

Alex

## Reply by John Nomikos · 2024-10-18 20:26:28 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev 

Thank you for the advice. I did this a couple times, and the results are interesting to say the least.

If the testfile does not already exist, I get 1.4 gb/s. 

If it does exist, I get 20mb/s with 10 blocks of 50M.

```
voxl2:/$ sync && time ./sd_test.sh
10+0 records in
10+0 records out
524288000 bytes (524 MB, 500 MiB) copied, 0.368724 s, 1.4 GB/s

real	0m7.950s
user	0m0.017s
sys	0m0.385s
voxl2:/$ rm /media/gfr/testfile 
voxl2:/$ 
voxl2:/$ sync && time ./sd_test.sh
10+0 records in
10+0 records out
524288000 bytes (524 MB, 500 MiB) copied, 0.365262 s, 1.4 GB/s
    
real	0m7.911s
user	0m0.015s
sys	0m0.383s
voxl2:/$ sync && time ./sd_test.sh
10+0 records in
10+0 records out
524288000 bytes (524 MB, 500 MiB) copied, 22.8395 s, 23.0 MB/s

real	0m24.506s
user	0m0.010s
sys	0m0.880s
voxl2:/$ sync && time ./sd_test.sh
10+0 records in
10+0 records out
524288000 bytes (524 MB, 500 MiB) copied, 22.8774 s, 22.9 MB/s

real	0m24.502s
user	0m0.003s
sys	0m0.870s
voxl2:/$ rm /media/gfr/testfile 
voxl2:/$ 
voxl2:/$ sync && time ./sd_test.sh
10+0 records in
10+0 records out
524288000 bytes (524 MB, 500 MiB) copied, 0.364634 s, 1.4 GB/s

real	0m7.992s
user	0m0.004s
sys	0m0.393s
```

When changing the block size to 5mb rather than 50, I saw faster speeds, even when writing to existing file.
```
voxl2:/$ rm -rf /media/gfr/testfile 
voxl2:/$ ./sd_test1.sh 
10+0 records in
10+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.0784419 s, 668 MB/s
voxl2:/$ 
voxl2:/$ ./sd_test1.sh 
10+0 records in
10+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.412609 s, 127 MB/s
voxl2:/$ ./sd_test1.sh 
10+0 records in
10+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.407672 s, 129 MB/s
voxl2:/$ 
voxl2:/$ ./sd_test1.sh 
10+0 records in
10+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.395725 s, 132 MB/s
voxl2:/$ ./sd_test1.sh 
10+0 records in
10+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.341873 s, 153 MB/s
voxl2:/$ ./sd_test1.sh 
10+0 records in
10+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.42811 s, 122 MB/s
```

Based on these results, I assume that optimizations are done when writing a new file to the SD card, because I thought the theoretical maximum for writing to an SD card via SDR104 was 104 MB/s. Either that, or the test is flawed if the file does not already exist.I know that there's likely more overhead when writing to an existing file.

Also I see that less block size is giving higher speed, so I am assuming that the slower speeds I am seeing is due to the overhead of writing very large blocks of data.

Appreciate the help

## Reply by Alex Kushleyev (ModalAI staff) · 2024-10-21 19:12:55 UTC (in reply to John Nomikos)

@John-Nomikos , 1.4 GB/s is certainly impossible for SD card write speed, so there is definitely some trickery going on here. Because VOXL2 has a lot of RAM, the cache can be substantial, but I thought that `sync` command would solve that issue, but apparently not.

In case of writing on top of an existing file, i believe this is a bad test case because as you are changing contents of an existing file (overwriting on top of existing data), the file system needs to be updated to remove references to old data and i think it can be a bit tricky in case of these unstructured overwriting with various block sizes, etc - so this is probably why that process is slower.

If you find a reliable way of testing the SD card write speed in the SD card slot, please let us know! I will play around with it as well.

Alex
