Open carlk3 opened 1 year ago
Hey, i got it working myself with slightly different pins although i think this is not the issue. Have you tried with a different SD card and with reformatting the SD card? i had succes with some sandisk ultra cards(32gb and 64gb) and samsung evo 128gb. Some other cards did not work for me but it was mostly CRC errors.
Perhaps you could try enabling debugging on SDFat in DebugMacros.h but as it relies on the arduino framework you might need to rewrite some things so it outputs to the UART or something. This might give you some insight on where it struggles in SDFat.
I never could figure out why it wouldn't run. It always triggers an error here:
if (!file.open("bench.dat", O_RDWR | O_CREAT | O_TRUNC)) {
error("open failed");
}
I also downloaded your SDIO.zip and took a look at it. I haven't yet delved into PlatformIO (it's on my to do list), so I haven't been able to get it running.
I eventually gave up and went back to my own project, and I finally succeeded along that path. Here is what I came up with: https://github.com/carlk3/no-OS-FatFS-SD-SPI-RPi-Pico/tree/sdio I used the same general idea of using the ZuluSCSI SDIO driver, but I integrated it with FatFs instead of SdFat.
Thanks for your ideas and help!
Other than the obvious like trying another SD card and such, have you tried lowering the clock speed?
Other than the obvious like trying another SD card and such, have you tried lowering the clock speed?
I just tried it. I changed the second rp2040_sdio_init
from rp2040_sdio_init(1)
to rp2040_sdio_init(25)
. No difference.
It seems to be an issue with the program. FsVolume::m_cwv
is NULL at the point where file.open("bench.dat"...)
is called from main
.
Hi, I'm trying to get this running. I cloned it and made a few changes, primarily to accommodate my hardware's pin assignments:
The only main() I found was in bench.cpp. Trying to run that, it looks like the
SD card (SD mode): Fields -- Start bit Transmission: host Command: GO_IDLE_STATE (0) Argument: 0x00000000 CRC: 0x4a End bit Start bit Transmission: host Command: SEND_IF_COND (8) Argument: 0x000001aa CRC: 0x43 End bit Start bit Transmission: card Command: SEND_IF_COND (8) Argument: 0x000001aa CRC: 0x9 End bit Start bit Transmission: host Command: APP_CMD (55) Argument: 0x00000000 CRC: 0x32 End bit Start bit Transmission: card Command: Non-existant (55) Argument: 0x00000120 CRC: 0x41 End bit Start bit Transmission: host Command: SD_SEND_OP_COND (41) Argument: 0xd0040000 CRC: 0x25 End bit Start bit Transmission: card Reserved Argument Reserved End bit Start bit Transmission: host Command: APP_CMD (55) Argument: 0x00000000 CRC: 0x32 End bit Start bit Transmission: card Command: Non-existant (55) Argument: 0x00000120 CRC: 0x41 End bit Start bit Transmission: host Command: SD_SEND_OP_COND (41) Argument: 0xd0040000 CRC: 0x25 End bit Start bit Transmission: card Reserved Argument Reserved End bit Start bit Transmission: host Command: APP_CMD (55) Argument: 0x00000000 CRC: 0x32 End bit Start bit Transmission: card Command: Non-existant (55) Argument: 0x00000120 CRC: 0x41 End bit Start bit Transmission: host Command: SD_SEND_OP_COND (41) Argument: 0xd0040000 CRC: 0x25 End bit Start bit Transmission: card Reserved Argument Reserved End bit Start bit Transmission: host Command: APP_CMD (55) Argument: 0x00000000 CRC: 0x32 End bit Start bit Transmission: card Command: Non-existant (55) Argument: 0x00000120 CRC: 0x41 End bit Start bit Transmission: host Command: SD_SEND_OP_COND (41) Argument: 0xd0040000 CRC: 0x25 End bit Start bit Transmission: card Reserved Argument Reserved End bit Start bit Transmission: host Command: APP_CMD (55) Argument: 0x00000000 CRC: 0x32 End bit Start bit Transmission: card Command: Non-existant (55) Argument: 0x00000120 CRC: 0x41 End bit Start bit Transmission: host Command: SD_SEND_OP_COND (41) Argument: 0xd0040000 CRC: 0x25 End bit Start bit Transmission: card Reserved Argument Reserved End bit Start bit Transmission: host Command: APP_CMD (55) Argument: 0x00000000 CRC: 0x32 End bit Start bit Transmission: card Command: Non-existant (55) Argument: 0x00000120 CRC: 0x41 End bit Start bit Transmission: host Command: SD_SEND_OP_COND (41) Argument: 0xd0040000 CRC: 0x25 End bit Start bit Transmission: card Reserved Argument Reserved End bit Start bit Transmission: host Command: ALL_SEND_CID (2) Argument: 0x00000000 CRC: 0x26 End bit Start bit Transmission: card Reserved Argument End bit Start bit Transmission: host Command: SEND_RELATIVE_ADDR (3) Argument: 0x00000000 CRC: 0x10 End bit Start bit Transmission: card Command: SEND_RELATIVE_ADDR (3) Argument: 0x59b40520 CRC: 0x33 End bit Start bit Transmission: host Command: SEND_CSD (9) Argument: 0x59b40520 CRC: 0x3e End bit Start bit Transmission: card Reserved Argument End bit Start bit Transmission: host Command: SELECT/DESELECT_CARD (7) Argument: 0x59b40520 CRC: 0x28 End bit Start bit Transmission: card Command: SELECT/DESELECT_CARD (7) Argument: 0x00000700 CRC: 0x3a End bit Start bit Transmission: host Command: APP_CMD (55) Argument: 0x59b40520 CRC: 0x5b End bit Start bit Transmission: card Command: Non-existant (55) Argument: 0x00000920 CRC: 0x19 End bit Start bit Transmission: host Command: SET_BUS_WIDTH (6) Argument: 0x00000002 CRC: 0x65 End bit Start bit Transmission: card Command: SWITCH_FUNC (6) Argument: 0x00000920 CRC: 0x5c End bitsd.begin(SD_CONFIG)
goes OK:It prints:
However, the
file.open("bench.dat"...)
does nothing at all, maybe becauseFsVolume::m_cwv
is 0, soreturn FsVolume::m_cwv && open(FsVolume::m_cwv, path, oflag);
returnsfalse
:What am I doing wrong?