@@ -41,27 +41,36 @@ socket, which SPI it is driven by, and how it is wired.
4141static spi_t spis [] = {
4242 // One for each SPI.
4343};
44+ /* SDIO Interface */
45+ static sd_sdio_if_t sdio_if = {
46+ .CMD_gpio = SDCARD_CMD_GPIO ,
47+ .D0_gpio = SDCARD_D0_GPIO ,
48+ .set_drive_strength = true,
49+ .CLK_gpio_drive_strength = GPIO_DRIVE_STRENGTH_12MA ,
50+ .CMD_gpio_drive_strength = GPIO_DRIVE_STRENGTH_4MA ,
51+ .D0_gpio_drive_strength = GPIO_DRIVE_STRENGTH_4MA ,
52+ .D1_gpio_drive_strength = GPIO_DRIVE_STRENGTH_4MA ,
53+ .D2_gpio_drive_strength = GPIO_DRIVE_STRENGTH_4MA ,
54+ .D3_gpio_drive_strength = GPIO_DRIVE_STRENGTH_4MA ,
55+ .SDIO_PIO = pio1 ,
56+ .DMA_IRQ_num = DMA_IRQ_0 ,
57+ #if PICO_RP2040
58+ // The default system clock frequency for SDK is 125MHz.
59+ .baud_rate = 125 * 1000 * 1000 / 4 // 31250000 Hz
60+ #endif
61+ #if PICO_RP2350
62+ //◦The default system clock on RP2350 is 150Mhz.
63+ .baud_rate = 150 * 1000 * 1000 / 6 // 25000000 Hz, clk_div = 1.5
64+ #endif
65+ };
4466
4567// Hardware Configuration of the SD Card "objects"
4668static sd_card_t sd_cards [] = { // One for each SD card
4769 {
4870 .pcName = "0:" , // Name used to mount device
4971 .type = SD_IF_SDIO ,
50- /*
51- Pins CLK_gpio, D1_gpio, D2_gpio, and D3_gpio are at offsets from pin
52- D0_gpio. The offsets are determined by sd_driver\SDIO\rp2040_sdio.pio.
53- CLK_gpio = (D0_gpio + SDIO_CLK_PIN_D0_OFFSET) % 32;
54- As of this writing, SDIO_CLK_PIN_D0_OFFSET is 30,
55- which is -2 in mod32 arithmetic, so:
56- CLK_gpio = D0_gpio -2.
57- D1_gpio = D0_gpio + 1;
58- D2_gpio = D0_gpio + 2;
59- D3_gpio = D0_gpio + 3;
60- */
61- .sdio_if = {.CMD_gpio = SDCARD_CMD_GPIO ,
62- .D0_gpio = SDCARD_D0_GPIO ,
63- .SDIO_PIO = pio1 ,
64- .DMA_IRQ_num = DMA_IRQ_0 },
72+ .sdio_if_p = & sdio_if ,
73+ // SD Card detect:
6574 .use_card_detect = SDCARD_USE_CD ,
6675 .card_detect_gpio = SDCARD_CD_GPIO , // Card detect
6776 .card_detected_true = 1 // What the GPIO read returns when a card is
0 commit comments