跳转至

4.sdmmc_sd_speedtest

功能:sd卡读写速度测试

WRITE (file): 67108864 bytes in 11996 ms => 5.33 MB/s
READ (file): 67108864 bytes in 5735 ms => 11.15 MB/s

编译

1
2
3
  west build -p always -b art_pi -d build 4.sdmmc_sd_speedtest -- \
  -DCONFIG_BOOTLOADER_MCUBOOT=y \
  -DCONFIG_MCUBOOT_SIGNATURE_KEY_FILE="\"$HOME/zephyrproject/bootloader/mcuboot/root-rsa-2048.pem\""

下载

west flash

log

*** Booting MCUboot v2.2.0-118-gaa4fa2b6e173 ***
*** Using Zephyr OS build v4.2.0-3958-gb42209d06c5c ***
I: Starting bootloader
D: context_boot_go
I: Image index: 0, Swap type: none
D: boot_validate_slot: slot 0, expected_swap_type 0
D: bootutil_img_validate: flash area 0x8009ed8
D: bootutil_img_hash
D: bootutil_tlv_iter_begin: type 65535, prot == 0
D: bootutil_img_validate: TLV off 60448, end 60780
D: bootutil_tlv_iter_next: searching for 65535 (65535 is any) starting at 60448 ending at 60780
D: bootutil_tlv_iter_next: TLV 16 found at 60452 (size 32)
D: bootutil_img_validate: EXPECTED_HASH_TLV == 16
D: bootutil_tlv_iter_next: searching for 65535 (65535 is any) starting at 60484 ending at 60780
D: bootutil_tlv_iter_next: TLV 1 found at 60488 (size 32)
D: bootutil_img_validate: EXPECTED_KEY_TLV == 1
D: bootutil_find_key
D: bootutil_tlv_iter_next: searching for 65535 (65535 is any) starting at 60520 ending at 60780
D: bootutil_tlv_iter_next: TLV 32 found at 60524 (size 256)
D: bootutil_img_validate: EXPECTED_SIG_TLV == 32
D: bootutil_verify_sig: RSA key_id 0
D: bootutil_tlv_iter_next: searching for 65535 (65535 is any) starting at 60780 ending at 60780
D: bootutil_tlv_iter_next: TLV 65535 not found
D: Left boot_go with success == 1
I: Bootloader chainload address offset: 0x0
I: Image version: v0.0.0
I: Jumping to the first image slot
*** Booting Zephyr OS build v4.2.0-3958-gb42209d06c5c ***
[00:00:00.323,000] <inf> app: Mounted /SD:

=== FATFS throughput bench: 64 MiB, chunk 131072 B ===
WRITE (file): 67108864 bytes in 11996 ms => 5.33 MB/s
READ (file): 67108864 bytes in 5735 ms => 11.15 MB/s
READ sink=0xfe000000
[00:00:18.099,000] <inf> app: Done.

测试速度与分频相关

clk-div = <4>;
&sdmmc1 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <
    &sdmmc1_d0_pc8
    &sdmmc1_d1_pc9
    &sdmmc1_d2_pc10
    &sdmmc1_d3_pc11
    &sdmmc1_ck_pc12
    &sdmmc1_cmd_pd2
    >;

    clocks = <&rcc STM32_CLOCK(AHB3, 16)>,
         <&rcc STM32_SRC_PLL2_R SDMMC_SEL(0)>;

    bus-width = <4>;
    cd-gpios = <&gpiod 5 (GPIO_PULL_UP|GPIO_ACTIVE_HIGH)>;
    disk-name = "SD";
    resets;
    reset-names = "sdmmc1_reset";

    clk-div = <4>;
};