1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[メモ] RaspberryPi: microSDのクロックアップとベンチマーク

Last updated at Posted at 2017-04-10

まとめ

  • Sandisk Extreme microSDHC 16GB Read:74.34MB/s / Write:53.58MB/s (Win7_64 + CrystalDiskBenchにて))

    RPi3
     Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
     									   400        0      50.000 MHz   20.85 MB/s   21.91 MB/s   22.15 MB/s
     dtoverlay=sdtweak,overclock_50=100     400        0     100.000 MHz   22.89 MB/s   34.67 MB/s   34.58 MB/s
    
    RPi2にて
     Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
     									   250        0      50.000 MHz   20.55 MB/s   21.71 MB/s   21.93 MB/s
     dtoverlay=sdhost,overclock_50=63       250        0      62.500 MHz   22.64 MB/s   26.75 MB/s   27.09 MB/s
     dtoverlay=sdhost,overclock_50=84       250        0      83.333 MHz   22.98 MB/s   34.88 MB/s   35.41 MB/s
    
    ASUS_TinkerBoard(参考)
     Overlay config                      core_freq   turbo   mmc0:BusSpeed   WRITE        READ        HDPARM
     									   ???        ?     148.500 MHz   45.88 MB/s   50.97 MB/s   43.67 MB/s
    

概要

  • らずぱいでの microSDのベンチマークでも... と、ぐーぐる先生にお尋ねしてたら、らずぱいで、SDのクロックアップできるよ、という記事を発見。
  • How to overclock the microSD card reader on a Raspberry Pi 3

  • /boot/config.txtを書き換えるだけ。
  • だが、正常に動作しないのもある。(起動できても、計測中におかしくなるのもあった)
  • core_freqを整数で割ったクロックをSDに提供できる、っぽい。
    • RPi3 : core_freq=400なので、overclock_50= 100/80/67/58/50あたり
    • RPi0,1,2: core_freq=250なので、overclock_50= 100/84/63/50あたり
  • RPi2/3とも、READで1.6倍くらい(21->34MB/s)、Writeで 1.1倍(21->23MB/s)速くなった。(うちにある一番速いmicroSDを使って、ベンチマークテストの上では..)

環境

  • Raspberry Pi 3 クーリングファン付

  • Raspberry Pi 2 ヒートシンク付 (SanDisk Extremeのみ計測)

  • Raspbian: 2017-03-02-raspbian-jessie-lite.img (アップデート無し)

    1. sshwpa_supplicant.conf(Wifi設定)をbootパーティションへ
    2. 起動直後: sudo apt-get update && sudo apt-get install -y hdparm curl build-essential
  • config.txtで、sdをクロックアップ

    • sudo bash -c 'printf "dtoverlay=sdhost,overclock_50=100\n" >> /boot/config.txt'

      Wifiがおかしいとき(??)、

    • sudo bash -c 'printf "dtoverlay=sdtweak,overclock_50=100\n" >> /boot/config.txt'

      overclocking~~~というのが出てくる

pi@raspberrypi:~ $ dmesg | grep mmc0
[ 0.879166] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[ 0.936907] mmc0: host does not support reading read-only switch, assuming write-enable
[ 0.983164] mmc0: overclocking to 100000000Hz
[ 0.985417] mmc0: new high speed SDHC card at address 0007
[ 0.988083] mmcblk0: mmc0:0007 SD8GB 7.42 GiB
pi@raspberrypi:~ $


## テスト手順
- Windows7 64bitで、CrystalDsiakMarkにて、microSDの速度を測る
    - USB3.0カードリーダ [IOGEAR GFR304SD](https://www.iogear.com/product/GFR304SD/)使用
- `curl http://www.nmacleod.com/public/sdbench.sh | sudo bash`

    ```bash:sdbench.sh
...
HDCMD="hdparm -t --direct /dev/mmcblk0 | grep Timing"
WRCMD="rm -f ${FILENM} && sync && dd if=/dev/zero of=${FILENM} bs=1M count=${DATAMB} conv=fsync 2>&1 | grep -v records"
RDCMD="echo 3 > /proc/sys/vm/drop_caches && sync && dd if=${FILENM} of=/dev/null bs=1M 2>&1 | grep -v records"
...

結果

  • Kingston Digital 8 GB microSDHC Class 10 UHS-1 Memory Card 30MB/s with Adapter (SDC10/8GB)
```txt:RPi3
Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
                                       400        0      50.000 MHz    9.24 MB/s   18.73 MB/s   21.10 MB/s
dtoverlay=sdtweak,overclock_50=100     400        0     100.000 MHz    8.17 MB/s   19.00 MB/s   21.07 MB/s

<!--

CONFIG:
CLOCK : 50.000 MHz
CORE : 400 MHz, turbo=0
DATA : 512 MB, /root/test.dat

HDPARM:

Timing O_DIRECT disk reads: 64 MB in 3.03 seconds = 21.10 MB/sec
Timing O_DIRECT disk reads: 64 MB in 3.03 seconds = 21.10 MB/sec
Timing O_DIRECT disk reads: 64 MB in 3.04 seconds = 21.09 MB/sec

WRITE:

536870912 bytes (537 MB) copied, 55.6614 s, 9.6 MB/s
536870912 bytes (537 MB) copied, 54.1052 s, 9.9 MB/s
536870912 bytes (537 MB) copied, 56.4969 s, 9.5 MB/s

READ:

536870912 bytes (537 MB) copied, 27.3297 s, 19.6 MB/s
536870912 bytes (537 MB) copied, 27.3344 s, 19.6 MB/s
536870912 bytes (537 MB) copied, 27.3414 s, 19.6 MB/s

RESULT (AVG):

Overlay config core_freq turbo overclock_50 WRITE READ HDPARM
400 0 50.000 MHz 9.24 MB/s 18.73 MB/s 21.10 MB/s
pi@raspberrypi:~ $


CONFIG:
CLOCK : 100.000 MHz
CORE : 400 MHz, turbo=0
DATA : 512 MB, /root/test.dat

HDPARM:

Timing O_DIRECT disk reads: 62 MB in 3.07 seconds = 20.22 MB/sec
Timing O_DIRECT disk reads: 66 MB in 3.07 seconds = 21.53 MB/sec
Timing O_DIRECT disk reads: 66 MB in 3.07 seconds = 21.51 MB/sec

WRITE:

536870912 bytes (537 MB) copied, 66.033 s, 8.1 MB/s
536870912 bytes (537 MB) copied, 61.4464 s, 8.7 MB/s
536870912 bytes (537 MB) copied, 60.7893 s, 8.8 MB/s

READ:

536870912 bytes (537 MB) copied, 27.1877 s, 19.7 MB/s
536870912 bytes (537 MB) copied, 27.1025 s, 19.8 MB/s
536870912 bytes (537 MB) copied, 26.5394 s, 20.2 MB/s

RESULT (AVG):

Overlay config core_freq turbo overclock_50 WRITE READ HDPARM
400 0 100.000 MHz 8.17 MB/s 19.00 MB/s 21.07 MB/s
pi@raspberrypi:~ $

-->

- PiZEROのセットを買ったときついてきたmicroSD (Ultimate 3.0 **70MB/s** 8GB とかいてある)<br><img src="https://qiita-image-store.s3.amazonaws.com/0/75594/5b51fe8f-0af8-e462-8468-dcf8e85f4cd6.png" width="240">
リードは 70MB/s超えてるんだけどね...

    ```txt:RPi3
    Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
                                           400        0      50.000 MHz    7.05 MB/s   20.39 MB/s   21.10 MB/s
    dtoverlay=sdtweak,overclock_50=100     400        0     100.000 MHz    7.18 MB/s   30.39 MB/s   28.81 MB/s
  • Sandisk Extreme MICROSDHC 16GB 90MB/S Flash Memory Card(たぶん..)
```txt:RPi3
Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
                                       400        0      50.000 MHz   20.85 MB/s   21.91 MB/s   22.15 MB/s
dtoverlay=sdtweak,overclock_50=100     400        0     100.000 MHz   22.89 MB/s   34.67 MB/s   34.58 MB/s
```

```txt:RPi2にて
Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
									   250        0      50.000 MHz   20.55 MB/s   21.71 MB/s   21.93 MB/s
dtoverlay=sdhost,overclock_50=63       250        0      62.500 MHz   22.64 MB/s   26.75 MB/s   27.09 MB/s
dtoverlay=sdhost,overclock_50=84       250        0      83.333 MHz   22.98 MB/s   34.88 MB/s   35.41 MB/s
```
  • Samsung Electronics 32GB EVO Micro SDHC UHS-I Upto 48MB/s Class 10 Memory Card (MB-MP32D)
```txt:RPi3
Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
                                       400        0      50.000 MHz   18.16 MB/s   21.56 MB/s   21.76 MB/s
dtoverlay=sdtweak,overclock_50=80      400        0      80.000 MHz   18.98 MB/s   23.35 MB/s   24.47 MB/s
```
- 100MHz設定では、カードエラーがでて正常動作しなかった。

その他

  • 追記2017-0411: RPi3 + SanDiskExtreme16GBにて、overclock_50=134=> 133.33MHzは、だめだった(133,125とトライして、100MHzまでおちる)

    overclock_50=134...はだめだった

pi@raspberrypi:~ $ grep overclock_50 /boot/config.txt
dtoverlay=sdtweak,overclock_50=134
pi@raspberrypi:~ $ dmesg | grep mmc0
[ 0.878893] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[ 0.956086] mmc0: host does not support reading read-only switch, assuming write-enable
[ 0.985908] mmc0: overclocking to 133333333Hz
[ 0.988111] mmc0: unexpected command 55 error
[ 0.990268] mmc0: reducing overclock due to errors
[ 0.992463] mmc0: overclocking to 125000000Hz
[ 0.994536] mmc0: unexpected command 55 error
[ 0.996580] mmc0: reducing overclock due to errors
[ 0.998689] mmc0: overclocking to 100000000Hz
[ 1.002811] mmc0: new high speed SDHC card at address aaaa
[ 1.005335] mmcblk0: mmc0:aaaa SE16G 14.8 GiB
pi@raspberrypi:~ $



- おまけ: ASUS Tinker Board にて : `20170330-tinker-board-linaro-jessie-alip-v1.6.img`使用

	```txt
	Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
										   0        0                   45.88 MB/s   50.97 MB/s   43.67 MB/s
    ----
	Linux linaro-alip 4.4.16 #1 SMP Thu Mar 30 22:22:19 CST 2017 armv7l GNU/Linux	
	[    2.998529] mmc_host mmc0: Bus speed (slot 0) = 148500000Hz (slot req 150000000Hz, actual 148500000HZ div = 0)
	```

	```txt:らずぱいと同じスクリプトを実行したので、それっぽいとこでエラーでてるが、測定値はOK、かと。
	sudo apt-get update && sudo apt-get install -y hdparm curl build-essential
	curl http://www.nmacleod.com/public/sdbench.sh | sudo bash
	dmesg | grep mmc0
	uname -a
	...
	...
	...
	grep: /boot/config.txt: No such file or directory
	bash: line 46: vcgencmd: command not found
	bash: line 47: vcgencmd: command not found
	bash: line 48: vcgencmd: command not found
	cat: /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy: No such file or directory
	CONFIG: 
	CLOCK : 
	CORE  :  MHz, turbo=
	DATA  : 512 MB, /root/test.dat

	HDPARM:
	======
	 Timing O_DIRECT disk reads: 128 MB in  3.04 seconds =  42.05 MB/sec
	 Timing O_DIRECT disk reads: 132 MB in  3.02 seconds =  43.70 MB/sec
	 Timing O_DIRECT disk reads: 136 MB in  3.01 seconds =  45.15 MB/sec

	WRITE:
	=====
	536870912 bytes (537 MB) copied, 11.2337 s, 47.8 MB/s
	536870912 bytes (537 MB) copied, 11.0605 s, 48.5 MB/s
	536870912 bytes (537 MB) copied, 11.1862 s, 48.0 MB/s

	READ:
	====
	536870912 bytes (537 MB) copied, 10.2028 s, 52.6 MB/s
	536870912 bytes (537 MB) copied, 11.2799 s, 47.6 MB/s
	536870912 bytes (537 MB) copied, 8.92718 s, 60.1 MB/s

	RESULT (AVG):
	============
	Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
										   0        0                   45.88 MB/s   50.97 MB/s   43.67 MB/s
	linaro@linaro-alip:~$ dmesg | grep mmc0
	[    2.897976] mmc_host mmc0: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
	[    2.998529] mmc_host mmc0: Bus speed (slot 0) = 148500000Hz (slot req 150000000Hz, actual 148500000HZ div = 0)
	[    3.689367] mmc0: new ultra high speed SDR104 SDHC card at address aaaa
	[    3.692071] mmcblk0: mmc0:aaaa SE16G 14.8 GiB 
	linaro@linaro-alip:~$ uname -a
	Linux linaro-alip 4.4.16 #1 SMP Thu Mar 30 22:22:19 CST 2017 armv7l GNU/Linux
	linaro@linaro-alip:~$ 
	```
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?