Closed mtk11 closed 1 year ago
depending on the chip/module model, pins 35 to 37 might be in use by OPI flash/psram. Any chip/module that ends on R8 will be using OPI PSRAM and have those pins reserved.
@me-no-dev , The module does not have ext SPI RAM was N8R2, after changing it to N8 had no issues, except the slow speed.. Esp-idf’s SD Card example (SDMMC) works fine. Recently esp-idf had some updates - sdmmc/sdspi: allow custom setup of SD card frequency ? Do you intend to include them soon ?
That fix will be part of ESP32 Arduino 3.0.0: https://github.com/espressif/arduino-esp32/issues/6225#issuecomment-1264289718
Could this be related to [SDMMC] ESP32-S3-N8R8 fails to start a microSD card in SDMMC_FREQ_HIGHSPEED mode (IDFGH-6901)?
It looks like @igrr has a patch there, but I don't know if it's already included in Arduino-esp32
@timknapen Can you please fix the link to the related issue? Thanks
I'm sorry about that I don't know how that happened. Link should work now.
@mtk11 @timknapen I was able to test SD_MMC on ESP32-S3-EYE board, which has SD_MMC 1-bit mode only available. When used default frequency (40 MHz), I was sometimes seeing errors:
E (4613) sdmmc_req: sdmmc_host_wait_for_event returned 0x107
E (4613) diskio_sdmmc: sdmmc_read_blocks failed (263)
When changed frequency to 20 MHz, all errors were gone. Can you try that? I have used the example sketch SD_MMC->SDMMC_Test with following changes:
#define SDMMC_CLK 39
#define SDMMC_CMD 38
#define SDMMC_D0 40
void setup(){
Serial.begin(115200);
delay(2000);
SD_MMC.setPins(39, 38, 40);
if(!SD_MMC.begin("/sdcard", true, false, 20000, 5)){
Serial.println("Card Mount Failed");
return;
}
// the rest of setup() as in example
}
Hi @P-R-O-C-H-Y , I only have a custom PCB with an ESP32-S3-WROOM-1 (N4R8) and I'm using 4 data lines, all short traces with 10K pull-ups. I've never had any issues using 20MHz. Everything works perfectly fine (but slowly) at 20Mhz. Only at 40MHz I start getting problems. Just like the ESP-IDF issue I referred to above.
@P-R-O-C-H-Y , ESP32-S3-EYE board uses ESP32-S3-WROOM-1-N8R8 (8MB PSRAM). I had experienced issue with N8R2 (2MB PSRAM) version and I replaced the module with N8 (no PSRAM) version. After the replacement I haven’t experienced the presented issues with the default config. ESP3D 3.0 also works fine, however the file upload speed via WiFi is still slow around 110-120 kB/s.
@timknapen @mtk11 There is an investigation by ESP-IDF team. We can just wait, once the fix is released. I will inform you about any updates about this issue.
@P-R-O-C-H-Y thank you! looking forward to have this solved! Side note: Is it possible for me to clone the Arduino-esp project and recompile the ESP-IDF in it myself? (to for example test the patch myself) I have looked but can't find documentation on how to do this.
该修复将成为 ESP32 Arduino 3.0.0 的一部分:#6225(评论)
Hello, when is the 3.0.0 release expected? If it takes too long, is it possible to pre-release a small fix for SDMMC speed issues.
Hello @HelloDB, we don't have exact date for 3.0.0 as we recently started on it. This is on hold for 3.0.0 milestone.
Hello,is there a way to see the patch? there is some problems with sd_mmc driver, and switching to 20MHz (in 1-bit mode) does not solve them (write block error). Also on PIO it is particularly not working well. And finally i notice something concerning, allocating a large working buffer in PSRAM (64K) affects the sd_mmc driver, to the point it cannot intilize in many cases (dma errors).
@timknapen @mtk11 Can you try to retest the issue with 40 MHz with the latest version 2.0.11 please? Thanks
I just tested on two different PCBs with esp32-s3. 40.000 is still buggy. But I don't think I'm running latest 2.0.11...
When I compile it says PACKAGES: - framework-arduinoespressif32 @ 3.20009.0 (2.0.9)
And when I edit platformio.ini to include
platform = https://github.com/platformio/platform-espressif32.git
framework = arduino
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#master
as documented here: https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html#how-to-update-to-the-latest-code
I get PACKAGES: - framework-arduinoespressif32 @ 2.0.6+sha.099b432
I'm confused. Both 2.0.9 and 2.0.6+sha... give me read errors like these at 40.000
E (499) sdmmc_cmd: sdmmc_read_sectors_dma: sdmmc_send_cmd returned 0x109
E (500) diskio_sdmmc: sdmmc_read_blocks failed (265)
E (500) sdmmc_req: handle_idle_state_events unhandled: 00000000 00000002
@timknapen Thanks for trying, but it needs to be the latest version based on ESP-IDF 4.4.5. I am not familiar with PlatformIO so I'm not able to help you with updating it. @Jason2866 Can you please help how to use the latest 2.0.11 version? Thank you
Try this
platform = https://github.com/platformio/platform-espressif32.git
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
@P-R-O-C-H-Y Thanks for the hint! I assumed platformio would automatically be able to grab the latest version of the arduino-esp32 package from Github, but that does not seem to be the case..
@Jason2866 Thank you for the suggestion but I still get the same results with platformio: (using your suggestion or my previous settings)
PLATFORM: Espressif 32 (6.3.2+sha.f1fdbc5)
HARDWARE: ESP32S3 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-builtin, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-arduinoespressif32 @ 2.0.6+sha.099b432
- tool-esptoolpy @ 1.40501.0 (4.5.1)
- toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
- toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5
This looks like it's using version 2.0.6 ( I don't know what the sha.099b432 means) It doesn't look like esp IDF version is mentioned during compile.
When I just compile with my 'normal' settings, it uses 2.0.9!
// normal settings:
platform = espressif32
framework = arduino
gives this:
PLATFORM: Espressif 32 (6.3.2)
HARDWARE: ESP32S3 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-builtin, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-arduinoespressif32 @ 3.20009.0 (2.0.9)
- tool-esptoolpy @ 1.40501.0 (4.5.1)
- toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
- toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5
@timknapen Here's how I specify specific version of framework-arduinoespressif32:
platform = espressif32
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.11
board = esp32-s3-devkitc-1
framework = arduino
gives this:
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-s3-devkitc-1.html
PLATFORM: Espressif 32 (6.3.2) > Espressif ESP32-S3-DevKitC-1-N8 (8 MB QD, No PSRAM)
HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB Flash
DEBUG: Current (esp-builtin) On-board (esp-builtin) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-arduinoespressif32 @ 2.0.11+sha.ae9dae4
- tool-esptoolpy @ 1.40501.0 (4.5.1)
- tool-openocd-esp32 @ 2.1100.20220706 (11.0)
- toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
- toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5
It picks the correct tag (2.0.11) and commit (ae9dae4)
Thanks @mikaeltulldahl. @timknapen can you give it another try please?
Thank you @mikaeltulldahl !! That does indeed get me to compile with 2.0.11 output:
PLATFORM: Espressif 32 (6.3.2+sha.f1fdbc5)
HARDWARE: ESP32S3 240MHz, 320KB RAM, 4MB Flash
PACKAGES:
- framework-arduinoespressif32 @ 2.0.11+sha.ae9dae4
- tool-esptoolpy @ 1.40501.0 (4.5.1)
- toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
- toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5
Looks good! Testing on my hardware right now!
Thank you @P-R-O-C-H-Y , @mikaeltulldahl and @Jason2866 Just tested with one of my ESP32-S3-WROOM-1 (N4R8) based prototypes and I can confirm 2.0.11 works much better at 40Mhz. I have another board here that I can test later too. I have done a bunch of file reads and listing of files from microSD and haven't seen one error so far! This looks very promising!
One weird thing: the read speed is barely faster than at 40Mhz compared to 20Mhz. Does anyone see this too? I'll have to investigate further.
@timknapen Thank you very much for testing.
Good to hear that the errors are gone now, so this fix was included in ESP-IDF 4.4.5. and the other which is related to lower speeds than 20 MHz is included in ESP-IDF-5.1 release so will be included in 3.0 version or Arduino ESP32 (already tested on esp-idf-v5.1-libs
branch).
So I assume we can close this issue as solved.
About the speed I am not that much sure, why the speed is jus barely faster than at 20 MHz. If you find out anything interesting about the speeds, feel free to comment there or if you find something that needs to be fixed, please open a new PR :)
Hi @timknapen , I tried in 1bit mode it worked with 40mhz config. but when use 4bit mode, it only worked with 20mhz config and 40mhz not worked. do you have same issuse? Thank You
Hi @timknapen , I tried in 1bit mode it worked with 40mhz config. but when use 4bit mode, it only worked with 20mhz config and 40mhz not worked. do you have same issuse? Thank You
No I don't have any issues at the moment with 4bit mode at 40mhz. By now I've tested this with at least 3 completely different hardware designs. All work without problems.
Board
Custom ESP32S3 board
Device Description
Custom board
Hardware Configuration
SDMMC_CMD 35 SDMMC_CLK 36 SDMMC_D0 37 SDMMC_D1 38 SDMMC_D2 39 SDMMC_D3 40
Version
v2.0.5
IDE Name
Arduino
Operating System
Windows 7
Flash frequency
80 MHz
PSRAM enabled
no
Upload speed
921600
Description
Errors appear.ed
Sketch
Debug Message
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide