PDA

View Full Version : sd using SDFS.bas FAt16 ON 18F67K22



longpole001
- 11th February 2014, 14:42
Hi guys ,

i am trying out the SD card using software spi on a 18f67k22 - 64 osc , the pic is at 5v
I am using the SDFS,bas and example from here

I have 2 devices on the spi bus with a level converter interfacing to the 2 devices from the Pic .

I have tested the other device which is also at 3.3v on the spi and it works well.

The sd card is formatted with fat16 prior on win7 64 and tested ok , 2gb MIcro Sd with SD adaptor , being tested on a SD card adaptor module

http://www.ebay.com.au/itm/NEW-Perfect-SD-Card-Module-Slot-Socket-Reader-For-Arduino-ARM-MCU-Read-And-Write-/360521495474?pt=AU_Digital_Memory_Card_Readers_Ada ptors&hash=item53f0c173b2&_uhb=1

I get a init 6 1 255 error and the test stops.


I need some pointers on what i need to test check to get the sd to work ,
i can see the card is getting the spi bus clk , MOSI, MISO , and checked the routines are using the correct pins for each direction in the Sd routines

i am guessing at this point its the speed of spi bus at 64Mhz for initialization on the SD , tried adding " DEFINE SHIFT_PAUSEUS 5" for the shitin/ shift out timing , but it did nothing to change the result


any help on this one please

Cheers

Sheldon

Darrel Taylor
- 11th February 2014, 20:44
The 6 and the 1 both indicate an Init error.
And the 255 is an SDC_FLOATING_BUS.

Make sure your level translator is working in both directions. especially MISO.

longpole001
- 21st February 2014, 02:18
problem turned out to be that the SD card mounting socket

A Micro sd card adaptor , is used for this SD module but the SD card socket did not connect to the SD card well

I have found this problem on several sd modules from ebay that i had on hand , with 4 failing out of 10 in the end
pushing the adaptor card in and holding it in place solved the init problem , for a test , but clearly a better socket is need when using a sd card it seems than the cheep ebay ones

regards

sheldon