SPI interface on Propeller ASC and Arduino Wireless SD Shield
doggiedoc
Posts: 2,248
I've been trying to get the SD card on the Arduino Wireless SD Shield to work. I'm using Kye's FATEngine object and the code works with Gadget Gangster Quickstart Module and Spinneret SD card readers. I've changed the pin to what is listed for the Shield assuming I am interpreting MOSI as DO, MISO as DI, and of course CLK and CS to Pins 11, 12, 13, and 4 respectively.
I have tried the only size micro SD cards I have 4GB SanDisk and 4GB PNY cards. I've included the code:
I've also added it as an attachment.
Anybody had success with SD Shields on the Propeller ASC? BTW I have a rev-e of the Propeller ASC board
Thanks,
Paul
I have tried the only size micro SD cards I have 4GB SanDisk and 4GB PNY cards. I've included the code:
{SD Read Test - using Kye's FATEngine
}
CON
_clkmode = xtal1 + pll16x ' The clkfreq is 80MHz.
_xinfreq = 5_000_000 ' Demo board compatible.
_dopin = 11
_clkpin = 13
_dipin = 12
_cspin = 4
_cdpin = -1 ' -1 if unused.
_wppin = -1 ' -1 if unused.
_rtcres1 = -1 ' -1 always.
_rtcres2 = -1 ' -1 always.
_rtcres3 = -1 ' -1 always.
_statuspin = 23 ' Status LED pin number.
OBJ
fate : "SD-MMC_FATEngine"
pst : "Parallax Serial Terminal"
PUB main | data, r, errorNumber, partitionName, fileName
init
pst.str(string(13, "[INITIALIZATION COMPLETE]",13))
mountCard
statusLED(-1)
partitionName := \fate.partitionVolumeLabel
pst.str(string(13, "[SD Volume Mounted Successfully]",13))
pst.str(string("Volume = "))
pst.str(partitionName)
pst.str(string(13))
ListDir
pst.str(string(13, "Enter Name of file to Open: "))
pst.strin(fileName)
\fate.openFile(fileName,"R")
errorNumber := \fate.partitionError
if (errorNumber)
handleError
pst.str(string(13, "[File Opened]", 13, 10))
repeat
r := \fate.readByte
if r < 0
pst.newline
\fate.unmountPartition
quit
if r > 10
pst.str(@r)
\fate.closeFile
pst.str(string(13, "[Closing file ....]", 13))
\fate.unmountPartition
pst.str(string(13, "[... and unmounting SD card.]", 13))
waitcnt(clkfreq * 2 + cnt)
pst.str(string(13, "[You may now safely eject SD card.]", 13))
PRI init
pst.Start(115_200)
fate.fatEngineStart( _dopin, _clkpin, _dipin, _cspin, _wppin, _cdpin, {
} _rtcres1, _rtcres2, _rtcres3)
waitcnt(clkfreq*2 + cnt)
PRI statusLED(frequency) | buffer, counter ' Configure the status LED.
' Frequency must be between 0 and (clkfreq / 2). Otherwise output is always 1.
buffer := ((0 < frequency) and (frequency =< (clkfreq >> 1)))
outa[_statuspin] := (not(buffer))
ctra := (buffer & constant((%00100 << 26) + _statuspin))
dira[_statuspin] := true
counter := 1
repeat 32 ' Preform (((frequency << 32) / clkfreq) + 1)
frequency <<= 1
counter <-= 1
if(frequency => clkfreq)
frequency -= clkfreq
counter += 1
frqa := (buffer & counter) ' Output is always 0 if frequency is 0.
PRI mountCard
\fate.mountPartition(0)
if(!fate.partitionMounted)
pst.str(string(13, "[ERROR! Failed to mount SD Card]", 13 ))
handleError
PRI handleError
statusLED(2)
waitcnt(clkfreq * 20 + cnt)
mountCard
PRI ListDir | buffer,counter,match
fate.listEntries("W")
pst.str(string("DIR listing: ",13))
repeat while(buffer := fate.listEntries("N"))
pst.str(buffer)
pst.str(string(13))
I've also added it as an attachment.
Anybody had success with SD Shields on the Propeller ASC? BTW I have a rev-e of the Propeller ASC board
Thanks,
Paul

Comments
Thanks Mike!
Ack! No jumper wires. Use the super convenient solder jumpers on the back!
Dang - I don't have an iron at work. Guess it will have to wait until I get home!
@paw
Also. Measure the voltages on those pins, with the shield connected, and make sure they're all 3.3v before bypassing the resistors.
Is this the shield you're working on? https://www.sparkfun.com/products/11287?
Not that board... this one: http://store.arduino.cc/ww/index.php?main_page=product_info&cPath=11_5&products_id=146
You dudes know your stuff man!