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 thisCode:SD_WE_TRIS = 1
The PIC® pin assignments will look something like thisCode:If (SD_WE) Then FAT_error = CE_WRITE_PROTECTED Return ' Return Byte FAT_error. Endif
If you are not using the hardware SPI from the PIC® and need to use other pins put this in your codeCode: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 run into problems let us know.Code:SDC_UseHardSPI = FALSE
Bookmarks