PropC3 MicroSD card question
tim1986
Posts: 41
Hey i just got the propeller C3 board. I can't seem to access a 4GB microSD SDHC card with the "prop_c3_unit_test_010.spin" demo. I can use this exact same card on a propeller protoboard with SD card adapter and socket. I think I was using the FSRW driver.
I was reading on the forum that "the new fsrw object now supports sdhc cards(cards over 2gb are all this type) " by mctrivia http://forums.parallax.com/showthread.php?123796-micro-sd-card&highlight=c3+micro+sd+sdhc
Is there a FSRW driver for the C3??
Thanks in advance!
-Tim
I was reading on the forum that "the new fsrw object now supports sdhc cards(cards over 2gb are all this type) " by mctrivia http://forums.parallax.com/showthread.php?123796-micro-sd-card&highlight=c3+micro+sd+sdhc
Is there a FSRW driver for the C3??
Thanks in advance!
-Tim
Comments
Bill
Bill
I tried modifying FSRW by removing CS(chip select) references and adding the SPI_Select_Channel and SPI_Init. It didn't work.
I really would like SDHC support for the PropC3.
-Tim
I'm beginning to feel like the Propeller C3 is not as useful as it is intended to be.
Please help,
-Tim
I know that FSRW works with 2gig and under but I haven't tried it with HD cards yet. (BTW... I just bought a whole gaggle of 2gig MicroSD cards for $5 each off of Amazon (including shipping) so they should be real easy and inexpensive to find.)
I wish I could help you further, but I don't have a C3 yet.
Bill
David
Thanks,
-Tim
-Tim
' SPIN WAV Player Ver. 1a (Plays only mono WAV at 16ksps)
' Copyright 2007 Raymond Allen See end of file for terms of use.
' Settings for Demo Board Audio Output: Right Pin# = 10, Left Pin# = 11 , VGA base=Pin16, TV base=Pin12
CON _clkmode = xtal1 + pll16x
_xinfreq = 5_000_000 '80 MHz
buffSize = 256
VAR long parameter
long buff1[buffSize]
long buff2[buffSize]
long stack1[100]
word MonoData[buffSize]
OBJ
'text : "vga_text" 'For NTSC TV Video: Comment out this line...
'text : "tv_text" 'and un-comment this line (need to change pin parameter for text.start(pin) command below too).
'SD : "FSRW"
SD : "fsrwFemto_rr001.spin"
num : "numbers"
PUB Main|n,i,j
'Play a WAV File
dira[12] := 1
outa[12] := 0
'Start up the status display...
'text.start(16) 'Start the VGA/TV text driver (uses another cog)
'The parameter (16) is the base pin used by demo and proto boards for VGA output
'Change (16) to (12) when using "tv_text" driver with demo board as it uses pin#12 for video
'text.str(STRING("Starting Up",13))
'open the WAV file (NOTE: Only plays mono, 16000 ksps PCM WAV Files !!!!!!!!!!!!!)
'access SD card
i:=sd.mount_explicit(9, 11, 10, 0)
if (i==0)
'text.str(STRING("SD Card Mounted",13))
else
'text.str(STRING("SD Card Mount Failed",13))
repeat
'open file
i:=sd.popen(string("test1.wav"), "r") ' <
Change .wav filename here !!!!!!!!!!!!!!
'i:=sd.popen(string("test2.wav"), "r") ' <
Change .wav filename here !!!!!!!!!!!!!!
'i:=sd.popen(string("test3.wav"), "r") ' <
Change .wav filename here !!!!!!!!!!!!!!
'i:=sd.popen(string("test4.wav"), "r") ' <
Change .wav filename here !!!!!!!!!!!!!!
'i:=sd.popen(string("gauss22.wav"), "r")
'i:=sd.popen(string("gchargef.wav"), "r")
'text.str(STRING("Opening: "))
'text.str(num.toStr(i,num#dec))
'text.out(13)
'ignore the file header (so you better have the format right!)
'See here for header format: http://ccrma.stanford.edu/CCRMA/Courses/422/projects/WaveFormat/
i:=sd.pread(@MonoData, 44) 'read data words to input stereo buffer
'text.str(STRING("Header Read ",13))
'Start the player in a new cog
COGNEW(Player(24, 1),@stack1) 'Play runs in a seperate COG (because SPIN is a bit slow!!)
'text.str(STRING("Playing...",13))
'Keep filling buffers until end of file
' note: using alternating buffers to keep data always at the ready...
n:=buffSize-1
j:=buffsize*2
repeat while (j==buffsize*2) 'repeat until end of file
if (buff1[n]==0)
j:=sd.pread(@MonoData, buffSize*2) 'read data words to input stereo buffer
'fill table 1
repeat i from 0 to n
buff1:=($8000+MonoData)<<16
if (buff2[n]==0)
j:=sd.pread(@MonoData, buffSize*2) 'read data words to input stereo buffer
'fill table 1
repeat i from 0 to n
buff2:=($8000+MonoData)<<16
'must have reached the end of the file, so close it
'text.str(STRING("Closing: "))
sd.pclose
'shut down here
PUB Player(PinR, PinL)|n,i,nextCnt,rate,dcnt
'Play the wav data using counter modules
'although just mono, using both counters to play the same thing on both left and right pins
'Set pins to output mode
DIRA[PinR]~~ 'Set Right Pin to output
DIRA[PinL]~~ 'Set Left Pin to output
'Set up the counters
CTRA:= %00110 << 26 + 0<<9 + PinR 'NCO/PWM Single-Ended APIN=Pin (BPIN=0 always 0)
CTRB:= %00110 << 26 + 0<<9 + PinL 'NCO/PWM Single-Ended APIN=Pin (BPIN=0 always 0)
'get length
n:=long[MonoData+40]
'get rate
rate:=long[MonoData+24]
case rate
8000:
dcnt:=10000
16000:
dcnt:=5000
other:
return false
'jump over header
MonoData+=44 'ignore rest of header (so you better have the right file format!)
'Get ready for fast loop
n--
i:=0
NextCnt:=cnt+15000
'Play loop
repeat i from 0 to n
NextCnt+=dcnt ' need this to be 5000 for 16KSPS @ 80 MHz
waitcnt(NextCnt)
FRQA:=(byte[MonoData+i])<<24
FRQB:=FRQA
'Easy high-impedance output (e.g., to "line in" input of computer or sound system)
'
' R=100
' Prop Pin ────┳──────── Audio Out
' C=0.1uF
'
' Vss
{{
TERMS OF USE: MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
}}
I had a go at modifying Kye's SD2.0_FatEngine for C3 style SPI, but ran out of room in the cog. I'll see if I can compact things a bit tomorrow.
Andre'