乐鑫技术交流
直播中

李泽坚

8年用户 1429经验值
私信 关注
[问答]

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

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

这是1bit时的日志:

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

  • I (2280) example: Card unmounted



这是4bit时的日志:


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

  • I (2357) example: Card unmounted



     

回帖(1)

卢表镜

2024-6-14 17:03:11
在ESP32-S3上使用SDIO接口连接SD卡时,1bit和4bit数据传输速率之间的差异可能并不显著,原因可能有以下几点:

1. **硬件限制**:ESP32-S3的SDIO接口可能在硬件层面上并没有完全实现4bit模式的优势。这可能是由于硬件设计或固件实现的问题。

2. **软件实现**:ESP32-S3的固件或驱动程序可能没有充分利用4bit模式的优势。这可能是由于软件优化不足或者对4bit模式的支持不完善。

3. **SD卡性能**:SD卡本身的性能也可能影响数据传输速度。如果SD卡的读写速度较慢,即使使用4bit模式,也无法显著提高整体的传输速度。

4. **文件系统开销**:在读取文件时,文件系统的开销可能会影响实际的传输速度。例如,如果文件系统需要进行大量的元数据操作,这可能会降低数据传输的效率。

5. **测试方法**:测试方法本身也可能影响结果。如果测试方法没有正确地测量数据传输速度,或者测试条件不一致,那么结果可能会有偏差。

6. **其他因素**:还可能有其他因素影响数据传输速度,例如电源稳定性、温度、电磁干扰等。

为了提高数据传输速度,你可以尝试以下方法:

1. **更新固件**:确保ESP32-S3的固件是最新版本,以获得最佳的性能和功能支持。

2. **优化软件**:检查和优化你的代码,确保充分利用了4bit模式的优势。

3. **更换SD卡**:尝试使用不同品牌或型号的SD卡,以找到性能最佳的SD卡。

4. **调整测试方法**:确保测试方法准确无误,并且测试条件一致。

5. **考虑其他接口**:如果SDIO接口的性能无法满足你的需求,可以考虑使用其他接口,例如SPI或UART。


举报

更多回帖

发帖
×
20
完善资料,
赚取积分