Hi, guys. I just start to design on Arduino since it is so fast to integrate off-the-shelf components for prototypes. I have tested many projects, until I hit SD examples.
I load the SD example of Arduino 0022, and access two cards: a) KingMax 1G miniSD with SDCard adapter, which prompts "card initialized...", b) Sandisk 128MB, prompts "card initializing....." However, neither prompts have further messages for file open actions. These demo code are written for Ethernet shield,
I used another code (http://www.arduino.cc/playground/Code/SDCARD
) which access SD card via raw read/write operation on sectors. And these demo code used native SPI port for SD card access. As a result, the Sandisk 128MB card was randomly erased and written. I have to format that card, but it demonstrates that the hardware should be all right, otherwise its sector can not be written. Am I right?I wonder is there any restriction for Arduino 0022 SD libraries? such as memory size (need 328 instead?) Additionally, how can I debug the code without a JTAG debugger used in a traditionally microcontroller firmware development?
Arduino Duemilanove 2009 w/ ATMEGA168
A popular SD-Card module, as described in attached PDF, alternatively, the module can be described as:
SD Card socket:
PIN9 (DAT2): shortcut to PIN8
PIN1 (CD/DAT3): CS
PIN2 (CMD): 3V3 pull up by R4
PIN3 (Vss): Ground
PIN_CD: NC **** PIN_CD and PIN3 (Vss) might get swapped.
PIN4 (Vdd): 3V3
PIN5 (CLK): 3V3 pull up by R3
PIN6 (Vss): Grouding
PIN7 (DAT0): 3V3 pull up by R2
PIN8 (DAT1): 3V3 pull up by R1
I connected the module to Arduino as:
+5V to +5V of Arduino
GND to GND of Arduino
CS to PIN10, PIN8 or PIN4, depends on libraries used in project
MOSI to PIN11
SCK to PIN13
MISO to PIN12