为什么ESP32-S3的SDIO接SD卡,用1bit数据和4bit数据读取文件,速度几乎没有差别

122722629@qq.com
Posts: 20
Joined: Wed Feb 16, 2022 7:01 am

为什么ESP32-S3的SDIO接SD卡,用1bit数据和4bit数据读取文件,速度几乎没有差别

Postby 122722629@qq.com » Sun Apr 17, 2022 2:37 pm

4bit不是应该快很多吗,但是实际并没有快多少,600多K的文件,要700ms才能读完。

这是1bit时的日志:
  1.  
  2. I (0) cpu_start: App cpu up.
  3. I (1218) spiram: SPI SRAM memory test OK
  4. I (1227) cpu_start: Pro cpu start user code
  5. I (1227) cpu_start: cpu freq: 240000000
  6. I (1227) cpu_start: Application information:
  7. I (1230) cpu_start: Project name:     sd_card
  8. I (1235) cpu_start: App version:      ac75c64-dirty
  9. I (1241) cpu_start: Compile time:     Apr  6 2022 14:41:49
  10. I (1247) cpu_start: ELF file SHA256:  9c75e896892f3e6c...
  11. I (1253) cpu_start: ESP-IDF:          v4.4-dirty
  12. I (1258) heap_init: Initializing. RAM available for dynamic allocation:
  13. I (1266) heap_init: At 3FC951D8 len 0004AE28 (299 KiB): D/IRAM
  14. I (1272) heap_init: At 3FCE0000 len 0000EE34 (59 KiB): STACK/DRAM
  15. I (1279) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
  16. I (1285) heap_init: At 600FE000 len 00002000 (8 KiB): RTCRAM
  17. I (1292) spiram: Adding pool of 8192K of external SPI memory to heap allocator
  18. I (1300) spi_flash: detected chip: gd
  19. I (1304) spi_flash: flash io: dio
  20. I (1308) sleep: Configure to isolate all GPIO pins in sleep state
  21. I (1315) sleep: Enable automatic switching of GPIO sleep configuration
  22. I (1322) cpu_start: Starting scheduler on PRO CPU.
  23. I (0) cpu_start: Starting scheduler on APP CPU.
  24. I (1337) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations
  25. I (1346) example: Initializing SD card
  26. I (1350) example: Using SDMMC peripheral
  27. I (1355) example: Mounting filesystem
  28. I (1359) gpio: GPIO[8]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
  29. I (1369) gpio: GPIO[10]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
  30. I (1378) gpio: GPIO[6]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
  31. I (1435) example: Filesystem mounted
  32. Name: SD
  33. Type: SDSC
  34. Speed: 20 MHz
  35. Size: 121MB
  36. I (1436) example: Opening file /sdcard/hello.txt
  37. I (1446) example: File written
  38. I (1450) example: Renaming file /sdcard/hello.txt to /sdcard/foo.txt
  39. I (1452) example: Reading file /sdcard/foo.txt
  40. I (1456) example: Read from file: 'Hello SD   !'
  41. I (1556) example: list: /,open succeed
  42. I (1557) example: file: 2.MJP , size: 622178 , fattrib: 32
  43. I (1557) example: file: FOO.TXT , size: 13 , fattrib: 32
  44. I (1562) example: free_heap_size = 8082979
  45. I (1567) example: free_heap_size = 8078883
  46. I (2279) example: read 622178 bytes in 707 ms
  47. I (2280) example: free_heap_size = 8082979
  48.  
  49. I (2280) example: Card unmounted
  50.  
  51.  

这是4bit时的日志:
  1.  
  2. I (0) cpu_start: App cpu up.
  3. I (1218) spiram: SPI SRAM memory test OK
  4. I (1227) cpu_start: Pro cpu start user code
  5. I (1227) cpu_start: cpu freq: 240000000
  6. I (1227) cpu_start: Application information:
  7. I (1230) cpu_start: Project name:     sd_card
  8. I (1235) cpu_start: App version:      ac75c64-dirty
  9. I (1241) cpu_start: Compile time:     Apr  6 2022 14:41:49
  10. I (1247) cpu_start: ELF file SHA256:  ca6d01d26a856673...
  11. I (1253) cpu_start: ESP-IDF:          v4.4-dirty
  12. I (1258) heap_init: Initializing. RAM available for dynamic allocation:
  13. I (1266) heap_init: At 3FC951D8 len 0004AE28 (299 KiB): D/IRAM
  14. I (1272) heap_init: At 3FCE0000 len 0000EE34 (59 KiB): STACK/DRAM
  15. I (1279) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
  16. I (1285) heap_init: At 600FE000 len 00002000 (8 KiB): RTCRAM
  17. I (1292) spiram: Adding pool of 8192K of external SPI memory to heap allocator
  18. I (1300) spi_flash: detected chip: gd
  19. I (1304) spi_flash: flash io: dio
  20. I (1308) sleep: Configure to isolate all GPIO pins in sleep state
  21. I (1315) sleep: Enable automatic switching of GPIO sleep configuration
  22. I (1322) cpu_start: Starting scheduler on PRO CPU.
  23. I (0) cpu_start: Starting scheduler on APP CPU.
  24. I (1337) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations
  25. I (1346) example: Initializing SD card
  26. I (1350) example: Using SDMMC peripheral
  27. I (1355) example: Mounting filesystem
  28. I (1359) gpio: GPIO[8]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
  29. I (1369) gpio: GPIO[10]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
  30. I (1378) gpio: GPIO[6]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
  31. I (1387) gpio: GPIO[7]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
  32. I (1396) gpio: GPIO[12]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
  33. I (1406) gpio: GPIO[5]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
  34. I (1463) example: Filesystem mounted
  35. Name: SD
  36. Type: SDSC
  37. Speed: 20 MHz
  38. Size: 121MB
  39. I (1464) example: Opening file /sdcard/hello.txt
  40. I (1474) example: File written
  41. I (1530) example: Renaming file /sdcard/hello.txt to /sdcard/foo.txt
  42. I (1532) example: Reading file /sdcard/foo.txt
  43. I (1533) example: Read from file: 'Hello SD   !'
  44. I (1633) example: list: /,open succeed
  45. I (1633) example: file: 2.MJP , size: 622178 , fattrib: 32
  46. I (1633) example: file: FOO.TXT , size: 13 , fattrib: 32
  47. I (1639) example: free_heap_size = 8082979
  48. I (1643) example: free_heap_size = 8078883
  49. I (2356) example: read 622178 bytes in 707 ms
  50. I (2356) example: free_heap_size = 8082979
  51.  
  52. I (2357) example: Card unmounted
  53.  
  54.  

ESP_Yake
Posts: 109
Joined: Mon Mar 06, 2017 12:23 pm

Re: 为什么ESP32-S3的SDIO接SD卡,用1bit数据和4bit数据读取文件,速度几乎没有差别

Postby ESP_Yake » Mon May 09, 2022 12:13 pm

你看下你的 SD 卡速率是多少,很多时候是受限于 SD 卡的速率。用 PC 读写试试速率

Jinsc_esp32
Posts: 7
Joined: Sun Apr 17, 2022 7:16 am

Re: 为什么ESP32-S3的SDIO接SD卡,用1bit数据和4bit数据读取文件,速度几乎没有差别

Postby Jinsc_esp32 » Mon Sep 12, 2022 12:46 am

因为你用的是C语言提供的接口,读写用fatfs的接口就行了

Who is online

Users browsing this forum: Google [Bot] and 57 guests