SD file system: hardware vs software SPI problem
Posted: Wed Apr 08, 2015 5:12 pm
Hi,
the following example code works well with the SW version but not with the MSSP. I am using microSD card, 3.3V for the all circuit and 10k pull-up resistors on DO, DI, SCLK.
could you please suggest any reason?
many thanks
Luciano
----------
Device = 18F4525
Clock = 20
#option SD_SPI_SPEED = spiOscDiv64
#option SD_SPI = MSSP 'uncomment for hardware SPI/MSSP version
' #option SD_SPI = SW 'uncomment for software SPI/SW version
Include "SDFileSystem.bas"
Include "Convert.bas"
// variables...
Dim Index As Byte
Dim testbolean As Boolean
'----------------------------
DelayMS (500)
// init SD card...
testbolean = SD.Init (spiOscDiv64) 'uncomment for MSSP version
'testbolean = SD.Init 'uncomment for SW version
// format SD card...
testbolean = SD.QuickFormat()
// write data to SD card...
If SD.NewFile("test3.txt") = errOK Then
For Index = 0 To 255
SD.Write("Line ",DecToStr(Index,3), 13, 10)
Next
SD.CloseFile
EndIf
End
the following example code works well with the SW version but not with the MSSP. I am using microSD card, 3.3V for the all circuit and 10k pull-up resistors on DO, DI, SCLK.
could you please suggest any reason?
many thanks
Luciano
----------
Device = 18F4525
Clock = 20
#option SD_SPI_SPEED = spiOscDiv64
#option SD_SPI = MSSP 'uncomment for hardware SPI/MSSP version
' #option SD_SPI = SW 'uncomment for software SPI/SW version
Include "SDFileSystem.bas"
Include "Convert.bas"
// variables...
Dim Index As Byte
Dim testbolean As Boolean
'----------------------------
DelayMS (500)
// init SD card...
testbolean = SD.Init (spiOscDiv64) 'uncomment for MSSP version
'testbolean = SD.Init 'uncomment for SW version
// format SD card...
testbolean = SD.QuickFormat()
// write data to SD card...
If SD.NewFile("test3.txt") = errOK Then
For Index = 0 To 255
SD.Write("Line ",DecToStr(Index,3), 13, 10)
Next
SD.CloseFile
EndIf
End