Pages: [1]   Go Down
Author Topic: [SOLVED] Can't get any SD card to work properly  (Read 876 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm trying to get SD card operation up and running, but can't.

I'm currently trying to troubleshoot with the SdInfo sketch from the latest SDFat library, the only change being that I used pin 4 (IC pin 6) instead of pin 10 for CS

I'm using an Atmega168 with Optiboot @ 3.3v and a 12Mhz crystal clock
The SD card is driven from the same 3.3v supply so there is no level shifter circuitry.
The SD card slot has an 0.1uF ceramic capacitor right next to the supply pins on the breakout board, which goes into a breadboard.
I have 10k pullups on CS and DO, as I read elsewhere it was correct to do.
The breadboard wiring from uC to SD card is no more than about 8cm.

The results with three different SD cards I have tried are as follows:
Quote
Brand New 8GB Card:
SdFat version: 20130629

type any character to start

init time: 22 ms

Card type: SD2

Manufacturer ID: 0X3
OEM ID: SD
Product: SD032
Version: 8.0
Serial number: 4294967295
Manufacturing date: 2/2006

cardSize: 32.10 MB (MB = 1,000,000 bytes)
flashEraseSize: 32 blocks
eraseSingleBlock: true

SD Partition Table
part,boot,type,start,length
1,0X0,0X0,0,0
2,0X0,0X0,0,0
3,0X0,0X0,0,0
4,0X0,0X0,0,0

vol.init failed


Old 512MB Card:
SdFat version: 20130629

type any character to start

init time: 3 ms

Card type: SD1

Manufacturer ID: 0X1D
OEM ID: AD
Product: SD  
Version: 0.0
Serial number: 1728249905
Manufacturing date: 10/2004

cardSize: 513.28 MB (MB = 1,000,000 bytes)
flashEraseSize: 128 blocks
eraseSingleBlock: false
read MBR failed
SD errorCode: 0X11
SD errorData: 0XFF


Really old 16MB Card:
SdFat version: 20130629

type any character to start

card.init failed
SD errorCode: 0XA
SD errorData: 0X1

All three cards work in the computer, of course.
Does anyone have any ideas?
« Last Edit: September 14, 2013, 01:59:52 am by Agent24 » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hooked it up to my 5v 16MHz Severino through a 74HC4050 level shifter and it works now.
So, perhaps it's a problem with Optiboot, the different clock speed, or the 4050 is also cleaning up noise. Hard to check though without a DSO.

Quote
SdFat version: 20130629

type any character to start

init time: 16 ms

Card type: SDHC

Manufacturer ID: 0X3
OEM ID: SD
Product: SU08G
Version: 8.0
Serial number: 3188779524
Manufacturing date: 6/2013

cardSize: 7948.21 MB (MB = 1,000,000 bytes)
flashEraseSize: 128 blocks
eraseSingleBlock: true

SD Partition Table
part,boot,type,start,length
1,0X0,0XB,8192,15515648
2,0X0,0X0,0,0
3,0X0,0X0,0,0
4,0X0,0X0,0,0

Volume is FAT32
blocksPerCluster: 64
clusterCount: 242304
freeClusters: 242060
freeSpace: 7931.82 MB (MB = 1,000,000 bytes)
fatStartBlock: 12596
fatCount: 2
blocksPerFat: 1894
rootDirStart: 2
dataStartBlock: 16384
Logged

Rapa Nui
Offline Offline
Edison Member
*
Karma: 60
Posts: 2086
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think pin 10 (SS) shall be configured as output, even when not used as the SS..
Logged

0
Offline Offline
Edison Member
*
Karma: 67
Posts: 1656
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote

I think pin 10 (SS) shall be configured as output, even when not used as the SS..

SdFat and SD.h always make SS an output and set it high in begin so this is not required.

If you have a device other than the SD on the SPI bus and this device does not use SS as chip select, you must make chip select for this device an output and set it high.  This insures SPI devices will not interfere with each other by having two or more selected.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Looks like the problem is solved: The decoupling capacitor was insufficient.
Logged

Pages: [1]   Go Up
Jump to: