Increase Micro SD card performance on Zero3

The Zero3 MicroSD card slot supports SDR104 but the maximum frequency is set to 150 MHz
I have created an overlay to enable the 208Mhz max-frequency. Be aware that the actual frequency might differ because it depends on the CPU frequency (don’t know the exact ratio)
For future reference I have documented the steps:

Using the Radxa Debian XFCE B4 image

in home folder create following dts file

radxa@radxa-zero3:~$ cat radxa-zero3-sdslot-208mhz.dts

/dts-v1/;
/plugin/;

/ {

        metdata {
               title = "Set SD card slot freq to 208MHz";
               compatible = "radxa,zero3";
               category = "misc";
               description = "Set SD card slot freq to 208MHz";
        };

        fragment@0 {
                target = <&sdmmc0>;
                __overlay__ {
                        max-frequency = <208000000>;
                };
        };

};

compile

dtc -@ -H epapr -O dtb -o radxa-zero3-sdslot-208mhz.dtbo -Wno-unit_address_vs_reg radxa-zero3-sdslot-208mhz.dts 

move to correct folder and disable (by renaming the file -> this will allow the rsetup utility to correctly identify the file)

sudo mv radxa-zero3-sdslot-208mhz.dtbo /boot/dtbo/radxa-zero3-sdslot-208mhz.dtbo.disabled

give correct permissions

sudo chmod 755 /boot/dtbo/radxa-zero3-sdslot-208mhz.dtbo.disabled

enable using sudo rsetup and reboot

BEFORE

radxa@radxa-zero3:~$ sudo dmesg | grep -i mmc1
[   12.244192] mmc_host mmc1: Bus speed (slot 0) = 375000Hz (slot req 400000Hz, actual 375000HZ div = 0)
[   12.862919] mmc1: delay init for 600 ms to enable UHS mode
[   12.932561] mmc_host mmc1: Bus speed (slot 0) = **148500000Hz** (slot req 150000000Hz, actual 148500000HZ div = 0)
[   13.072716] mmc1: new ultra high speed SDR104 SDXC card at address 0001
[   13.074651] mmcblk1: mmc1:0001 FD4Q9 119 GiB 

AFTER

radxa@radxa-zero3:~$ sudo dmesg | grep -i mmc1
[   12.282628] mmc_host mmc1: Bus speed (slot 0) = 375000Hz (slot req 400000Hz, actual 375000HZ div = 0)
[   12.901357] mmc1: delay init for 600 ms to enable UHS mode
[   12.972786] mmc_host mmc1: Bus speed (slot 0) = **198000000Hz** (slot req 208000000Hz, actual 198000000HZ div = 0)
[   13.090046] mmc1: new ultra high speed SDR104 SDXC card at address 0001
[   13.091765] mmcblk1: mmc1:0001 FD4Q9 119 GiB 

Maybe not the correct os supported way but it works in my case :slight_smile:

1 Like

Great! Do you know the actual speed difference of copying files?

@dewitte77 do you perhaps know what the theoretical and practical difference in speed will be :)?

Just re-tested on b6 image and this overlay trick still works.
Don’t forget to use a good SD card because the frequency will adjust to the capabilities of the card.

My results when writing to a Sandisk Extreme Pro 128GB Micro SD card from a usb-c attached SSD (Samsung T7)
Before patch: writing 666 files for a total of 10249Mb in 190 seconds = 54 Mb/s write speed
After patch: writing 666 files for a total of 10249Mb in 155 seconds = 66 Mb/s write speed

over 20% improvement seems like worth it.
I wonder why this is not in the default images…

Writing to the internal eMMC = 209 seconds = 49 Mb/s but the system was also running from this eMMC

Also works on DietPi and Armbian

cd /boot
mkdir overlay-user
cd overlay-user


echo "d00dfeed0000019e000000380000015c0000002800000011000000100000
000000000042000001240000000000000000000000000000000000000001
00000000000000016d657464617461000000000300000020000000005365
74205344206361726420736c6f74206672657120746f203230384d487a00
000000030000000c0000000672616478612c7a65726f3300000000030000
0005000000116d6973630000000000000003000000200000001a53657420
5344206361726420736c6f74206672657120746f203230384d487a000000
000200000001667261676d656e7440300000000000030000000400000026
ffffffff000000015f5f6f7665726c61795f5f0000000003000000040000
002d0c65d4000000000200000002000000015f5f6669787570735f5f0000
00000003000000150000003b2f667261676d656e7440303a746172676574
3a30000000000000000200000002000000097469746c6500636f6d706174
69626c650063617465676f7279006465736372697074696f6e0074617267
6574006d61782d6672657175656e63790073646d6d633000" > radxa_sdcard.txt

xxd -p -r radxa_sdcard.txt > radxa_sdcard.dtbo

then edit config file to add user overlay by adding it to the user_overlays line
cat dietpiEnv.txt

rootdev=UUID=8b9585ab-4264-468d-93ab-9e0d55254251
rootfstype=ext4
# The init system logs to the console defined last.
consoleargs=console=ttyS2,1500000 console=tty1 console=ttyFIQ0,1500000
usbstoragequirks=
extraargs=net.ifnames=0
docker_optimizations=off
overlay_path=rockchip
overlay_prefix=rockchip
overlays=
user_overlays=radxa_sdcard #this line is changed 

save file

reboot

root@DietPi:/boot# sudo dmesg | grep -i mmc1
[   11.918805] mmc_host mmc1: Bus speed (slot 0) = 375000Hz (slot req 400000Hz, actual 
375000HZ div = 0)
[   12.005863] mmc_host mmc1: Bus speed (slot 0) = 198000000Hz (slot req 208000000Hz, actual 
198000000HZ div = 0)
[   12.124174] mmc1: new ultra high speed SDR104 SDXC card at address aaaa
[   12.126265] mmcblk1: mmc1:aaaa SR128 119 GiB