SD card doesn't work while porting example to custom board

julienD
Posts: 32
Joined: Fri Sep 13, 2019 12:38 pm

SD card doesn't work while porting example to custom board

Postby julienD » Wed Jul 26, 2023 3:46 pm

Hello,

I'm "porting" pipeline_recording_to_sdcard example to an aliexpress board YD-ESP32-23 2022-V1.3.
It is equiped with ESP32-S3-WROOM-1. I connected this kind of sd card adapter:
https://fr.aliexpress.com/item/10050052 ... pt=glo2fra

Yet, nothing else is plugged on the board.

I changed this line :

Code: Select all

    audio_board_sdcard_init(set, SD_MODE_1_LINE);
to :

Code: Select all

    audio_board_sdcard_init(set, SD_MODE_SPI);
I created a custom board with this definition for SD SPI:

Code: Select all

#define SDCARD_INTR_GPIO          GPIO_NUM_45     /* You need to define the GPIO pins of your board */

#define SDCARD_OPEN_FILE_NUM_MAX  5

#define BOARD_PA_GAIN             (10) /* Power amplifier gain defined by board (dB) */
#define SDCARD_PWR_CTRL             -1

#define ESP_SD_PIN_CLK              GPIO_NUM_12  
#define ESP_SD_PIN_CMD              GPIO_NUM_16
#define ESP_SD_PIN_D0               GPIO_NUM_17
#define ESP_SD_PIN_D1               -1
#define ESP_SD_PIN_D2               -1
#define ESP_SD_PIN_D3               GPIO_NUM_15
#define ESP_SD_PIN_D4               -1
#define ESP_SD_PIN_D5               -1
#define ESP_SD_PIN_D6               -1
#define ESP_SD_PIN_D7               -1
#define ESP_SD_PIN_CD               -1
#define ESP_SD_PIN_WP               -1
The SD card initialization failed. Here's the log, it shows that sdmmc_init_ocr fails:

Code: Select all

SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x1630
load:0x403c9700,len:0xbb8
load:0x403cc700,len:0x2f2c
SHA-256 comparison failed:
Calculated: 8997d5e526a32f2294c07bdf34d343262dfb9ee14014e6f2b35719cdd002f7b7
Expected: 88e553bc93d09b19aaf34dd544190377eec2cb8e3855712b7b98805996cdc876
Attempting to boot anyway...
entry 0x403c9950
I (43) boot: ESP-IDF v4.4.5-dirty 2nd stage bootloader
I (43) boot: compile time 16:21:38
I (43) boot: chip revision: v0.1
I (45) boot.esp32s3: Boot SPI Speed : 80MHz
I (50) boot.esp32s3: SPI Mode       : DIO
I (55) boot.esp32s3: SPI Flash Size : 16MB
I (60) boot: Enabling RNG early entropy source...
I (65) boot: Partition Table:
I (69) boot: ## Label            Usage          Type ST Offset   Length
I (76) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (83) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (91) boot:  2 factory          factory app      00 00 00010000 00100000
I (98) boot: End of partition table
I (103) esp_image: segment 0: paddr=00010020 vaddr=3c030020 size=0fae8h ( 64232) map
I (123) esp_image: segment 1: paddr=0001fb10 vaddr=3fc94610 size=00508h (  1288) load
I (123) esp_image: segment 2: paddr=00020020 vaddr=42000020 size=2ab48h (174920) map
I (160) esp_image: segment 3: paddr=0004ab70 vaddr=3fc94b18 size=028ech ( 10476) load
I (162) esp_image: segment 4: paddr=0004d464 vaddr=40374000 size=10608h ( 67080) load
I (186) boot: Loaded app from partition at offset 0x10000
I (187) boot: Disabling RNG early entropy source...
I (187) cpu_start: Pro cpu up.
I (191) cpu_start: Starting app cpu, entry point is 0x40375434
0x40375434: call_start_cpu1 at /home/ju/esp445/esp-idf/components/esp_system/port/cpu_start.c:147

I (0) cpu_start: App cpu up.
I (206) cpu_start: Pro cpu start user code
I (206) cpu_start: cpu freq: 160000000
I (206) cpu_start: Application information:
I (206) cpu_start: Project name:     radio-esp32
I (207) cpu_start: App version:      Bouton_PCB_V0.0-37-g5d643b4-dir
I (207) cpu_start: Compile time:     Jul 26 2023 17:13:02
I (207) cpu_start: ELF file SHA256:  b959b93cc2764d65...
I (208) cpu_start: ESP-IDF:          v4.4.5-dirty
I (208) cpu_start: Min chip rev:     v0.0
I (208) cpu_start: Max chip rev:     v0.99 
I (208) cpu_start: Chip rev:         v0.1
I (209) heap_init: Initializing. RAM available for dynamic allocation:
I (209) heap_init: At 3FC98870 len 00037790 (221 KiB): D/IRAM
I (209) heap_init: At 3FCD8000 len 00011710 (69 KiB): D/IRAM
I (209) heap_init: At 3FCE9710 len 00005724 (21 KiB): STACK/DIRAM
I (210) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (210) heap_init: At 600FE000 len 00002000 (8 KiB): RTCRAM
I (211) spi_flash: detected chip: gd
I (211) spi_flash: flash io: dio
I (212) sleep: Configure to isolate all GPIO pins in sleep state
I (213) sleep: Enable automatic switching of GPIO sleep configuration
D (213) esp_apptrace: HW interface 0x3fc958ac
I (213) esp_apptrace: Initialized TRAX on CPU0
I (213) coexist: coexist rom version e7ae62f
I (214) cpu_start: Starting scheduler on PRO CPU.
I (12) esp_apptrace: Initialized TRAX on CPU1
I (0) cpu_start: Starting scheduler on APP CPU.
I (215) RECORD_TO_SDCARD: [ 1 ] Mount sdcard
I (215) RECORD_TO_SDCARD: [ 1 ] init sdcard
I (215) AUDIO_BOARD: [ 2 ] periph_sdcard_init
I (215) AUDIO_BOARD: [ 3 ]  esp_periph_start
I (215) SDCARD: Using SPI mode, base path=/sdcard
I (215) gpio: GPIO[15]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (215) sdspi_transaction: cmd=52, R1 response: command not supported
I (225) AUDIO_THREAD: The esp_periph task allocate stack on internal memory
I (225) AUDIO_BOARD: [ 4 ] periph_sdcard_is_not mounted 0
I (225) AUDIO_BOARD: [ 5 ] periph_sdcard_is_not mounted
I (265) sdspi_transaction: cmd=5, R1 response: command not supported
E (1265) sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107
E (1265) vfs_fat_sdmmc: sdmmc_card_init failed (0x107).
I (1265) gpio: GPIO[15]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
E (1265) SDCARD: Failed to initialize the card (263). Make sure SD card lines have pull-up resistors in place.
E (1265) PERIPH_SDCARD: mount sdcard error!
I (2265) SDCARD: Using SPI mode, base path=/sdcard
E (2265) spi: spi_bus_initialize(756): SPI bus already initialized.
I (2265) gpio: GPIO[16]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (2265) gpio: GPIO[17]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (2265) gpio: GPIO[12]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (2265) gpio: GPIO[15]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (2265) sdspi_transaction: cmd=52, R1 response: command not supported
I (2305) sdspi_transaction: cmd=5, R1 response: command not supported
E (3305) sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107
E (3305) vfs_fat_sdmmc: sdmmc_card_init failed (0x107).
I (3305) gpio: GPIO[15]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
E (3305) SDCARD: Failed to initialize the card (263). Make sure SD card lines have pull-up resistors in place.
E (3305) PERIPH_SDCARD: mount sdcard error!
I (3305) SDCARD: Using SPI mode, base path=/sdcard
E (3305) spi: spi_bus_initialize(756): SPI bus already initialized.
I (3305) gpio: GPIO[16]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (3305) gpio: GPIO[17]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (3305) gpio: GPIO[12]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (3305) gpio: GPIO[15]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (3305) sdspi_transaction: cmd=52, R1 response: command not supported
I'm using IO 12 16 17 15 . i plugged a logic analyzer on SD card pins, and things seem to be correctly
configured (See screenshot), also I observe some clock signal when CS is off.

What can it be?

Thanks
Julien
Attachments
spi.jpg
spi.jpg (169.18 KiB) Viewed 6541 times

julienD
Posts: 32
Joined: Fri Sep 13, 2019 12:38 pm

Re: SD card doesn't work while porting example to custom board

Postby julienD » Thu Jul 27, 2023 4:59 pm

I also tried with the /esp-idf/examples/storage/sd_card/sdspi/ example and I get the same result.

Who is online

Users browsing this forum: No registered users and 12 guests