Hi all,
I am trying to communicate to a SD/MMC card. I have search all over the internet to find examples to get it to work, but it doesn't.
I have made my own PCB according to the schematic that micro engineering has provided. I have also already checked if the SPI is
active, and it is. But right after i call FSinit, i get an error (i read out the error according the example of micro engineering). The
output is as follows:
FAT_error = 6
SDC_status = 1
SDC_response = 255
This is de code for generating to general variables for the SD include:
Code:
SD_WE var PORTC.6 'SD card Write Protect
SD_WE_TRIS var TRISC.6 'SD card Write Protect direction
SDI var PORTC.4 'SPI data in
SDI_TRIS var TRISC.4 'SPI data in direction
SCL var PORTC.3 'SPI clock
SCL_TRIS var TRISC.3 'SPI clock direction
SD_CS var PORTA.5 'SD card Chip Select
SD_CS_TRIS var TRISA.5 'SD card chip select direction
SD_CD var PORTC.7 'SD card Detect
SD_CD_TRIS var TRISC.7 'SD card detect direction
SDO var PORTC.5 'SPI data out
SDO_TRIS Var TRISC.5 'SPI data out direction
and my own code in main:
Code:
gosub FSInit 'initialise the SD card
Serout2 PORTB.1, 84, ["Init: ", FAT_error, " ", SDC_status, " ", SDC_response, $d, $a]
gosub SD_error_check 'Check for errors on SD card
gosub FINDfirst 'Look for files on SD card
While(FAT_error = 0) 'Find next file on card
files_found = files_found + 1
Gosub FINDnext
Wend
Can someone give me a direction to search for. I have already wasted lots of time to confirm if
it is actually working (PIC) and I am know at the point of desperation (almost
).
I'm waiting for that good old little segment that you always forget somehow ;(.
kind regards,
Remco
Bookmarks