When not using Write Protect do a search through SDFS for "SD_WE" and comment out anything to do with it. It only shows up in about 6 places.
Comment this
And all occurrences of this
Code:
If (SD_WE) Then
FAT_error = CE_WRITE_PROTECTED
Return ' Return Byte FAT_error.
Endif
The PIC® pin assignments will look something like this
Code:
SDI Var PORTB.2 ' SPI data in SD #7
SDI_TRIS Var TRISB.2 ' SPI data in direction
SCL Var PORTB.1 ' SPI clock SD #5
SCL_TRIS Var TRISB.1 ' SPI clock direction
SD_CS Var PORTB.3 ' SD card chip select SD #1
SD_CS_TRIS Var TRISB.3 ' SD card chip select direction
SD_CD Var PORTB.4 ' SD card detect
SD_CD_TRIS Var TRISB.4 ' SD card detect direction
SDO Var PORTC.7 ' SPI data out SD #2
SDO_TRIS Var TRISC.7 ' SPI data out direction
If you are not using the hardware SPI from the PIC® and need to use other pins put this in your code
Code:
SDC_UseHardSPI = FALSE
If you run into problems let us know.
Bookmarks