60 likes | 302 Views
INTERFACING SD CARD WITH MSP430F5435. FEW COMMANDS IN SPI MODE. CMD0 :- Resets the sd card & used in initialization process. CMD17 :- used to read a specified block length of sd card. CMD24 :- used to write a specified block length in sd card .(generally kept 512 bytes).
E N D
FEW COMMANDS IN SPI MODE • CMD0 :- Resets the sd card & used in initialization process. • CMD17 :- used to read a specified block length of sd card. • CMD24 :- used to write a specified block length in sd card .(generally kept 512 bytes). • CMD9:- asks the card to send card specific data register.The card specific data register has all the information about the access for sd card like write protect,max current in read /write,blockmis-management,erase options etc. • CMD58:- reads the ocr register of card .the register gives operating voltage conditions for sandisksd card.
READING & WRITING IN TO SD CARD • READING: • ---------------[COMMAND ]----------------------------------------------------- • ----------------------------------------[Command RESPONSE]----[DATA BLOCK][CRC]----- • *Command use d for reading CMD17 • *Command Response obtained is R1=0x00(obtained) defined as follows:- R1=0x0()()()()()()() If ()=1 in any case there is error somewhere may be parameter,or address or idle state etc If ()=0 then read is perfectly good. The data block is itself has data token received ,the start byte is FD,then the data depending on what is to be read ,the last 2 bytes are crc bytes. Note :-all the Data transmission is MSB first
READING & WRITING IN TO SD CARD • Writing:- • -----[command]---[start token]-[data block] • ----------[Command Response]----------------------------[Data response] • *Command used for reading CMD17 • *Command Response obtained is R1=0x00(obtained) defined as follows:- R1=0x0()()()()()()() If ()=1 in any case there is error somewhere may be parameter,or address or idle state etc. The start token is same as the token given in read. The data response signifies whether card accepted data or not.it is given as shown:- [x][x][x][o][status][1] 010-data accepted. 101-data rejected due to a crc error. 110-data rejected due to a write error.