Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

about sd card,help!

i have been working on this drive for days, but i still can't write any data into the card,

i make my write operation on this cmd sequence:

cmd0--cmd55--cmd41--cmd2--cmd3--cmd9--cmd7--cmd16--cmd24;

then i use IOWR(SD_DAT_BASE,0,DATA) to write in data,

and i defined the commands as

const BYTE cmd0[5] = {0x40,0x00,0x00,0x00,0x00};

const BYTE cmd55[5] = {0x77,0x00,0x00,0x00,0x00};

const BYTE cmd56[5] = {0x78,0x00,0x00,0x00,0x00};

const BYTE cmd2[5] = {0x42,0x00,0x00,0x00,0x00};

const BYTE cmd3[5] = {0x43,0x00,0x00,0x00,0x00};

const BYTE cmd7[5] = {0x47,0x00,0x00,0x00,0x00};

const BYTE cmd9[5] = {0x49,0x00,0x00,0x00,0x00};

const BYTE cmd12[5] = {0x4c,0x00,0x00,0x02,0x00};

const BYTE cmd16[5] = {0x50,0x00,0x00,0x02,0x00};

const BYTE cmd17[5] = {0x51,0x00,0x00,0x00,0x00};

const BYTE cmd24[5] = {0x58,0x00,0x00,0x00,0x00};

const BYTE acmd6[5] = {0x46,0x00,0x00,0x00,0x02};

const BYTE acmd41[5] = {0x69,0x0f,0xf0,0x00,0x00};

const BYTE acmd51[5] = {0x73,0x00,0x00,0x00,0x00};

can anyone tell me a right procedure?