A newbie looking for help on SDCard on Arduino Duemilanove 2009

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?

Hardware: Arduino Duemilanove 2009 w/ ATMEGA168 A popular SD-Card module, as described in attached PDF, alternatively, the module can be described as:

Connector: 1) GND 2) 3V3 3) +5V 4) CS 5) MOSI 6) SCK 7) MISO 8) GND

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 PIN_WP: NC

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

@allankliu Have you got your problem solved? I am also having similar problem of reading a file from SD card. I am trying to directly read the SD card using the readWrite function given in the SD Library of arduino-0022.