I was still working on the SD card this week. I took up from where I left off and started with setting up the SD card. I soldered the pins onto the little board for holding the card. This board has a pre-made insertion point for the card and which all the pins are soldered to the card. The soldering had to be checked for connectivity using a multimeter after ensuring that all connections are fully made and that there are no overlapping pins I then soldered the ground and live wires from the SD Card board.
For the SD Card project the software SPI is to be used and hence I was going to the port B pins for plugging in the SD Card. Port B is taken because of its advantage in being able to set as input/output digital ports and the location of it on the development board PICDEM2.NET. PORTB pins are together and with a female holder that easily accessible.
After plugging in the SD Card I made the mistake of turning on the power without checking all the connections. It nearly shorted the whole development board, but on a quick check it seemed to be performing well and the port B pins were still working. I then made the check of seeing whether there is connectivity from the SD Card Board’s pins to the pins of the PIC18F97J60. This was meticulously done using the multimeter, by identifying the connection pin for corresponding Port B pins from the Development Board schematics. The connection pins are the gold colored points/holes found on the development board around the PIC.
I then returned to writing out the program for the card. The first step was to setup the the physical layer and build it up from there. I found that SD cards initially start up in SD mode, which is the native mode for the cards and has to be pushed into the SPI mode by sending CMD0 while Chip Select (CS) is held low. This command has to be sent through the SPI therefore the card has to be synchronized first with the SPI clock pulses from the PIC.
Before starting to write the main program I checked the pins for the software SPI defined in the library function and found that they were different from what I was planning to use. Hence the file was copied into the broga directory and the pins were changed accordingly.