Prop C3 & SD
Wael_ElEgyptian
Posts: 3
Hi Folks,
My question is very simple: what are the pin assignments for the SD on the C3 platform?
I have tried the C3_SD_Demo_010.spin and it works fine. However, I wanted to write to files on the SD so I tried the fsrw.spin , but I am having troubles , the propeller does not see the SD and the card does not get mounted. I have used the following code from a tutorial on the "Gadget Gangster" ,
Here is my code:
===========================================================
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
DO = 0
CLK = 1
DI = 2
CS = 3
OBJ
sdfat : "fsrw"
pst : "Parallax Serial Terminal"
PUB demo | mount
pst.Start(115_200)
waitcnt(clkfreq*4 +cnt)
mount := \sdfat.mount_explicit(Do,CLK,DI,CS)
if mount < 0
pst.str(string(13,"Failed to mount",13))
abort
pst.str(string(13," SD Card was found and mounted fine",13))
sdfat.popen(string("Text.txt"),"w")
sdfat.pputs(string(" Hello World!!!!!!!!", 13, 10))
sdfat.pclose
sdfat.unmount
================================================
My question is very simple: what are the pin assignments for the SD on the C3 platform?
I have tried the C3_SD_Demo_010.spin and it works fine. However, I wanted to write to files on the SD so I tried the fsrw.spin , but I am having troubles , the propeller does not see the SD and the card does not get mounted. I have used the following code from a tutorial on the "Gadget Gangster" ,
Here is my code:
===========================================================
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
DO = 0
CLK = 1
DI = 2
CS = 3
OBJ
sdfat : "fsrw"
pst : "Parallax Serial Terminal"
PUB demo | mount
pst.Start(115_200)
waitcnt(clkfreq*4 +cnt)
mount := \sdfat.mount_explicit(Do,CLK,DI,CS)
if mount < 0
pst.str(string(13,"Failed to mount",13))
abort
pst.str(string(13," SD Card was found and mounted fine",13))
sdfat.popen(string("Text.txt"),"w")
sdfat.pputs(string(" Hello World!!!!!!!!", 13, 10))
sdfat.pclose
sdfat.unmount
================================================
Comments
Could you edit you post and put the "code" tags around your code? "/code"
It makes it easier to read the spin.
If you replace the double quotes " " in the example line with square brackets [ ] it comes out like:
Could you edit you post and put the
On the C3 the SD pins are not directly connected to the prop, you have to initialize the hardware SPI interface I/O pins from propeller to card.
Look here: C3_SD_DRV_010.SPIN, PUB SPI_Init(mode)
Ray
Ray
ftp://ftp.propeller-chip.com/PropC3/Games/Jay_T_Cook/jtc_c3_bootloader_v002/jtc_c3_bootloader_v002/