Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RP2040 SDCard 4bit SDIO? #2

Open
TobiasVanDyk opened this issue Aug 17, 2022 · 0 comments
Open

RP2040 SDCard 4bit SDIO? #2

TobiasVanDyk opened this issue Aug 17, 2022 · 0 comments
Labels
Ok Ok

Comments

@TobiasVanDyk
Copy link
Owner

TobiasVanDyk commented Aug 17, 2022

Oct 2024: Test SDIO for RP2040/RP2350 by Bill Greimann

July 2024: The Pico Evaluation Board was was modified by adding 3 connecting wires to convert the SDCard SDIO interface to a standard 1-bit SD interface. Remove pins GP5 GP18 GP19 from the Pico MCU male header. Then use the female Pico SMD header connections on the display board to connect the three wires as indicated below:

D3 CS GP22 stay as is
CLK GP5 disconnect from Pico and connect to GP10 SPI-1 CLK
CMD GP18 disconnect from Pico and connect to GP11 SPI-1 MOSI
D0 GP19 disconnect from Pico and connect to GP12 SPI-1 MISO

SDIO-SD

As an alternative implement SPI using PIO is also a solution - three sources that I know of:
(1) PioSpiTest.zip available here

(2) PIO-SPI the code is in the drivers/sdcard subdirectory - based on the comments here

(3) PIOSpi - Arduino spi driver over PIO to enable SPI over any GPIO

June 2024: From the description here, which
is also applicable to the Waveshare Eval Board, this can be made to have a functional SDCard using PIO SDIO:

You'll have to modify the PIO code:
You need SDIO_CLK offset from D0 by -14, which is 18 in mod32 arithmetic.
(19 + 18) % 32 = 5

In rp2040_sdio.pio you'll need to change this line:
.define PUBLIC SDIO_CLK_PIN_D0_OFFSET 30 ; (-2 in mod32 arithmetic) 
to 
.define PUBLIC SDIO_CLK_PIN_D0_OFFSET 18    ; (-14 in mod32 arithmetic)

Store a collection of PC editable macro definitions or music files or picture files on the SDCard and then have the Pico read it on power-up. This Waveshare IPS ST7789 LCD Pico Board 320x240 2.8 inch hardwired the LCD, Touch controller and SDCard to SPI-1 which makes the SDCard usable. But this Waveshare IPS ILI9488 Pico Evaluation Board Touch LCD 480x320 3.5 inch has the SDCard hardwired to SDIO pins which are not in the correct sequence for the current PIO drivers. The RPi SDK example is a wip (https://github.com/raspberrypi/pico-extras/tree/master/src/rp2_common/pico_sd_card)

Sep 2022: There is an implementation for the RP2040 here:
https://github.com/ZuluSCSI/ZuluSCSI-firmware/tree/main/lib/ZuluSCSI_platform_RP2040
Also see here:
https://forums.raspberrypi.com/viewtopic.php?t=337143
https://forums.raspberrypi.com/viewtopic.php?t=356274
https://forums.raspberrypi.com/viewtopic.php?t=361335&start=50

And this could be a solution: https://github.com/carlk3/no-OS-FatFS-SD-SDIO-SPI-RPi-Pico or https://github.com/carlk3/no-OS-FatFS-SD-SPI-RPi-Pico/tree/sdio - D0 to D3 are offset correctly (each D0 + 1) but SDIO-CLK is not at the required D0 - 2 offset.

There is a note that "For SDIO, data lines D0 - D3 must be on consecutive GPIOs, with D0 being the lowest numbered GPIO. Furthermore, the CMD signal must be on GPIO D0 GPIO number - 2, modulo 32. (This can be changed in the PIO code.)"

Similarly at Visrealm it notes: Six GPIOs for signal pins, and, optionally, another for CD (Card Detect). Four pins must be at fixed offsets from D0 (which itself can be anywhere):
CLK_gpio = D0_gpio - 2.
D1_gpio = D0_gpio + 1;
D2_gpio = D0_gpio + 2;
D3_gpio = D0_gpio + 3;

@TobiasVanDyk TobiasVanDyk added the question Further information is requested label Aug 17, 2022
@TobiasVanDyk TobiasVanDyk changed the title SDCard 4bit SDIO? RP2040 SDCard 4bit SDIO? Aug 18, 2022
@TobiasVanDyk TobiasVanDyk added wip igu I give up and removed question Further information is requested wip igu I give up labels Apr 26, 2024
@TobiasVanDyk TobiasVanDyk added Ok Ok and removed igu I give up labels Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ok Ok
Projects
None yet
Development

No branches or pull requests

1 participant