SD Card Issues
Philldapill
Posts: 1,283
I'm trying to get my SD Card to work with the Propeller, but I'm having some problems...
I've built my own SD Card PCB with Pull-Ups attached to all IO pins. I'm confident in the hardware itself, so that shouldn't be the issue here. I've downloaded the latest FemtoBasic object from the Obex, and I've made a simple program that I THOUGHT would be able to mount the SD Card, then open a file. I can't even get the card to mount. The program seems to hang at the point where the SD Card tries to mount. In fact, more precisely, it hangs internally at initSDCard inside mount(). What gives?
Here's the code:
I've built my own SD Card PCB with Pull-Ups attached to all IO pins. I'm confident in the hardware itself, so that shouldn't be the issue here. I've downloaded the latest FemtoBasic object from the Obex, and I've made a simple program that I THOUGHT would be able to mount the SD Card, then open a file. I can't even get the card to mount. The program seems to hang at the point where the SD Card tries to mount. In fact, more precisely, it hangs internally at initSDCard inside mount(). What gives?
Here's the code:
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 'NOTE SPEED SD_DO = 0 SD_CLK = 1 SD_DI = 2 SD_CS = 3 OBJ '1 Cog here uarts : "pcFullDuplexSerial4FC" '1 COG for 4 serial ports SD : "fsrwFemto" VAR Pub Start uarts.Init uarts.AddPort(0,31,30,{ } UARTS#PINNOTUSED,UARTS#PINNOTUSED,UARTS#DEFAULTTHRESHOLD, { } UARTS#NOMODE,UARTS#BAUD115200) uarts.Start waitcnt(clkfreq*2 + cnt) 'Allow some time to switch to the PST uarts.dec(0,SD.mount(SD_DO,SD_CLK,SD_DI,SD_CS)) uarts.str(0,string("It worked!!",13))
Comments
SD.start(@ioControl) ' Start I2C/SPI driver
where
VAR long ioControl[noparse][[/noparse] 2 ]