Home

EMMA Mobile1 Application Note SD Memory Card Interface

image

Contents

1. Application Note S19895EJ1V0OANOO PREFACE Disclaimers The information contained in this document is subject to change without prior notice in the future Refer to the latest applicable data sheet s and user manual when designing a product for mass production No part of this document may be copied or reproduced in any form or by any means without the prior written consent of NEC Electronics NEC Electronics assumes no responsibility for any errors that may appear in this document NEC Electronics does not assume any liability for infringement of patents copyrights or other intellectual property rights of third parties by or arising from the use of NEC Electronics products listed in this documents or any other liability arising from the use of such products No license express implied or otherwise is granted under any patents copyrights or other intellectual property rights of NEC Electronics or others Descriptions of circuits software and other related information in this document are provided for illustrative purposes in semiconductor product operation and application examples The incorporation of these circuits software and information in the design of a customers equipment shall be done under the full responsibility of the customer NEC Electronics assume no responsibility for any losses incurred by customers or third parties arising from the use of these circuits software and information While NEC Elect
2. y Enable response end error SDIx INFO1 y Send command SDIx_CMD y Wait until command send end Yse Time out Response end SDIx_INFO1 Error occur SDIx_INFO2 Yse Read the error information register SDIx INFO2 Clear response end information SDIx INFO1 Clear all error information SDIx INFO2 Normal End I Error End Figure A 4 Send Command Send command to SD card Application Note S19895EJ1VOAN00 33 52 APPENDIX A SD Driver Function 34 52 A 4 5 Set Clock Function Name em1_sd set ck Format void em1 sd set cIkSDM NUM sd n ushort value Argument Parameter Type vo Det sd n SDM NUM l Enum to select SDIA SDIB or SDIC value ushort Clock setting value Function Return None Flow Chart None Note Set SDIx_CLK_CTRL register Application Note S19895EJ1V0OANOO APPENDIX A SD Driver Function 35 52 A 4 6 Set Block Length Function Name em1 sd set biklength Format int em1 sd set biklengih SDM NUM sd n ushort length Argument Parameter Type vo Gest sd n SDM NUM Enum to select SDIA SDIB or SDIC length ushort Block length setting value Function Return DRV_OK Others error end Flow Chart Start ee y Command parameter setting SDIx ARGO SDIx_ARG1 y S
3. 4 Compare Data Compare the read out data with the written data If same print OK otherwise print error and end the test 5 Erase first 2MB in SD Card Call em1_sd_erase function to erase the first 2MB data area in SD card If failed end the operation and print error if OK continue the test program Details about SD card erase operation please refer to figure2 3 EMMA Mobile 1 SDM Erase Operation 6 Read Data from SD Card Call em1_sd_multi_read function to read out the first 2MB data from SD card If read failed end the operation and print error if read OK continue the test program 7 Compare Data Compare the read out data If 2MB data are all zero test operation works OK otherwise error end Application Note S19895EJ1V0OANOO APPENDIX A SD Driver Function 26 52 APPENDIX A SD Driver Function A 1 Function List The following table shows the SD card driver interface functions Table A 1 SD Driver Function List Function Name Function Detail em sd bw init Init the SDM module setting em sd init SD card initialization em1_sd set seccnt Enable disable sector and set sector number em sd send cmd Send comand em1_sd set ck Set SDM output clock value em1 sd set biklength Set block length External em sd select card Select card function em sd set evi csd Set extend CSD register em1_sd check dev status Check SD card s
4. Yes Read operation OK No t Yes All data is zero 2 Yes Vv Figure 3 4 SD Multi block Operation Flow Application Note S19895EJ1V0OANOO Chapter 3 Example of SD Memory Card Interface Operation 24 52 More details about the functions used in this example please refer to APPENDIX A SD Driver Function Application Note S19895EJ1V0OANOO Chapter 3 Example of SD Memory Card Interface Operation 25 52 3 4 2 Operation Detail 1 Initialization Data Buffer Initialize the write data buffer set fixed value 0x5A to write data buffer which will be wrote to SD card At the same time initialize the read data buffer with 0 it will read out data from SD card 2 Write Data to SD card Setting parameters about the data transfer call the em1 sd multi write function to write data into SD card Check the write operation if failed end the operation and print error information if OK continue the test program Details about multiple blocks write operation please refer to figure2 2 EMMA Mobile 1 SDM Data Transfer in DMA Mode 3 Read Data from SD Card Call em1_sd_multi_read function to read out the written data by step 2 from SD card Check the read operation if read failed end the operation and print error if read OK continue the test program Details about multiple blocks read operation please refer to figure2 2 EMMA Mobile 1 SDM Data Transfer in DMA Mode
5. cmd Send command OK Read response value SDIx RSPO and SDIx RSP1 y Check whether card locked Y Check whether error occur y oe No Error End Figure A 7 Check Card Stauts Normal End Note Check card status register Application Note S19895EJ1V0OANOO APPENDIX A SD Driver Function 39 52 A 4 9 Erase Function Function Name em1_sd erase Format int em sd erase SDM NUM sd pn uint str addr uint end addr Argument Parameter Detail ge SDM NUM aun to select SDIA SDIB or str_addr uint Start erase group unit address end_addr uint End of erase group unit address Function Return DRV_OK Others error end Flow Chart Please refer to figure2 3 EMMA Mobile 1 SDM Erase Operation in chapter 2 3 Erase Note None Application Note S19895EJ1V0OANOO APPENDIX A SD Driver Function 40 52 A 4 10 Single Block Read Function Name em sd single read Format Int em sd single read SDM NUM sd n uint address uchar data Argument Parameter sd n SDM NUM address uint Enum to select SDIA SDIB or SDIC block address to be read data uchar read out data buffer Function Return DRV OK Others error end Application Note S19895EJ1V0OANOO APPENDIX A SD Driver Function 41 52 Flow Chart Start Check parameter whether data putter is NULL Wait for
6. data READ SINGLE BL Reads a block of the size selected by the address OCK SET_BLOCKLEN command 31 0 data READ MULTIPLE _ SE Multipile block CMD18 EE BLOCK ultipile block read command CMD19 Reserved CMD23 31 0 data Writes a block of the size selected by the ITE_BLOCK cubes address E SET_BLOCKLEN command Continuously writes blocks of data until a e WRITE_MULTIPLE cmp25 S10 data MU STOP TRANSMISSION follows or the address BLOCK q requested number of block received CMD26 Not applicable Programming of the programmable bits of CMD27 31 0 stuff bits PROGRAM CSD the CSD h i i it of th CMD28 31 0 data SET WRITE PROT Sets the write protection bit of the addressed address group 31 0 data CLR WRITE PRO Clears the write protection bit of the CMD29 address T addressed group LOL wate SEND_WRITE_PR Asks card to send the status of the write CMD30 protect data OT protection bits address CMD31 Reserved CMD32 31 0 data ERASE_GROUP_S Sets the address of the first erase group address TART within a range to be selected for erase f the 31 0 data ERASE GROUP E Sels the address of the last erase group CMD33 within a continuous range to be selected for address ND erase CMD34 Reserved CMD37 CMD38 31 0 stuff bits ERASE Erases all previously selected write blocks CMD39 Reserved CMD41 CMD42 Reserved CMD54 31 16 RCA Indicates to the card that the next command CMD55 i i APP_CMD is an application specific comma
7. egvedidzesdeekgeeceendedegeas 15 3 2 naza EE 16 3 2 1 Operation FIOW eege aa la EA 16 3 2 2 Operation Detail agave ant 17 3 3 Example of SDM Single Block Read Write rrnannnnnnrvnnnnvrnnnnvnnrnvnnnnrrnnnnrnnnnnrennrrrrennrnnrnnenrnnn 20 Biel Ee Re EE 20 3 3 2 Oper tion Detallada apt 21 3 4 Example of SDM Multi Block Operation 23 EE BEE dene EE 23 ee NR TT 25 APPENDIX A SD Driver Function rsernnnnvrnnnvnnnnnvnnnnnnnnnnvnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnvnnnnnnnnnnnnnnnnennnnr 26 Art UNCON LIST edelt deler eat 26 A 2 Global Variable Define AA 26 A 3 Structure amp ENUM Define A 27 AA MMC EE 27 AA Function Detalls OOO 28 A 4 1 Hardware Initialization Funchon nao nnnc nano nn nc nnnnn nc cnn anni 28 A42 Card INIPOpPOratlOn cipreses 29 PLAS Seco Setting ona eee 31 AAA Send Command cir tt a a iia aida citada bi 32 Le 34 A 4 6 Set Block Length ansees ola anbe E enn 35 AAT Select Ca e eege annual ee Eege tain gege 36 A 4 8 Check Device Status pirre aria eiii 37 AA I Ease FUNCION sua eege ainia 39 A O 40 A 4 11 Single Block Write vaksinene adekvat 42 A 4 12 Multiple Block Read mois a eege 44 A 4 13 Multiple Block Write vennen rca 45 A 4 14 Transfer Proa iuris dada 46 Ax4 15 Decode SD aida 47 Application Note S19895EJ1V0OANOO INDEX 5 52 A 4 16 Check Response Status cccccncocinnccconoccconccconnnnnnnnnnn nono rnn cnn nora rra APPENDIX B COMMANDS i nnaneranvrnnvvnnnvnnnvnnnvnnnvennvennvnnnvnnnnvennvnnnvnnnvennn
8. occur SDIA_INFO1 SDIA_INFO2 Step8 Send CMD13 SEND_STATUS with argument RCA to check device status Detail Application Note 19895EJ1VOANO00 Chapter 3 Example of SD Memory Card Interface Operation 22 52 steps about check SD card status please refer to 3 Check Card Status in Chapter 3 2 2 Operation Details More details about single block write operation please refer to chapter A 4 12 Single Block Write 3 Read Data Call emt sd single read function to read out the written data by step 2 from SD card If read failed end the operation and print error if read OK continue the test program Following steps shows the read operation progress and registers configurations Step1 Ensure SDM interface is not busy check bit 14 of SDIA INFO register Step2 Enable sector setting and set sector number SDIA STOP SDIA_SECCNT Step3 Prepare for data transfer including following steps Clear interrupt information in SDIA INFO1 register Clear all error information in SDIA INFO2 register Set transfer none stop SDIA STOP 0 0 Enable all error interrupt in SDIA INFO2 MASK register Enable read write access interrupt occur in SDIA INFO1 MASK register Step4 Send CMD17 READ SINGLE BLOCK with argument read address Detail steps about send command please refer to step 6 of 2 Init SD Card in Chapter 3 2 2 Operation Details Step5 Wait for write enable SDIA INFO2 and check whether error occur SDI
9. sector enable and sector SDIx_STOP number to be 1 SDIx_SECCNT y Transfer prepare _em1_sd transfer prepare Send single block write command em1_sd_send_cmd No Send command Ok Yes Vv Wait for write enable SDIx_INFO2 heck response OK mi_sd_check_rsp_sta Yes Write data Note1 SDIx_BUFO No R W transfer end Yes Clear response and r w end info Error occur SDIx INFO1 SDIx INFO2 y Yes Check device status Clear all error info em1_sd_check_dev_status SDIx INFO2 es lt Error occur No wi Figure A 9 Single Block Write in CPU mode Note 1 During write operation check SDIx INFO2 if buffer write access error occur end the write operation and return with error information Application Note S19895EJ1V0OANOO APPENDIX A SD Driver Function 44 52 A 4 12 Multiple Block Read Function Name em sd multi read Format int em sd multi read SDM NUM sd n uint address uchar read but uint blk num Argument Parameter sd n SDM NUM Enum to select SDIA SDIB or SDIC address uint block address to be read read buf uchar read out data buffer blk_num uint block number to be read Function Return DRV_OK Others error end Flow Chart Please refer to figure2 2 EMMA Mobile 1 SDM Data Tra
10. A_RSPO SDIA RSP1 Step6 Read data If no errors occur after send CMD 17 READ SINGLE BLOCK read data from SD card data SDIA BUFO Step7 Wait for data transfer end or error occur SDIA INFO1 SDIA_INFO2 Step8 Send CMD13 SEND STATUS with argument RCA to check device status Detail steps about check card status please refer to 3 Check Card Status in Chapter 3 2 2 Operation Details 4 Compare Data Compare the read out data with the written data If same print OK otherwise print error end Application Note S19895EJ1V0OANOO Chapter 3 Example of SD Memory Card Interface Operation 23 52 3 4 Example of SDM Multi Block Operation In this example we will write fixed data 0x5A to SD card first 16MB data area then read out and compare whether the data is right When read write works OK erase the first 2MB data area in SD card then read out and check whether data in first 2MB is zero or not Both read and write operation will use multi block DMA operation mode 3 4 1 Operation Flow Initialization data buffer y Write data to SD card first 16MB em1_sd_multi_write Write operation OK No vYes Read data from chip first 16MB em1 sd multi read Yes Read operation OK No Yes Ck data data right No strncmp y Yes Erase first 2MB in SD card em1 sd erase Erase operation OK No Yes Read data from chip first 2MB em1 sd multi read
11. ENA 5 0 disable setting 1 enable setting Step3 Switch pins to SD function CHG_PINSEL_G80 0x00550000 GIO_P88 P91 gt SDO_DAT1 3 SDO_CKI CHG_PINSEL_SDO 0x00000001 Switch the SDO_DATA1 to DATA3 and SDO_CKI pins by using GIO P88 to GIO P91 Step4 Pull up down setting CHG PULL G88 0x00006666 DATA1 3 Pull down mask release CHG PULL2 0x00004663 CKO Pull release CMD DATAO Pull up mask release Step5 Drive capability setting CHG DRIVE1 0x00050000 SDO CK and SDO pins 4mA default value Setp6 Read and wait control register setting ASMU AB1 SDIAWAITCTRL 0x00000300 ASMU_AB1_SDIAREADCTRL 0x00000000 default value Setp7 Auto frequency control setting ASMU AUTO FRQ MASK3 0x07 default value 2 Init SD Card SD card initialization em1 sd _init including following steps Step1 Power on SD card Step2 Soft reset SD SDIA SOFT RST 0x0000 module reset SDIA SOFT RST 0x0007 release reset Application Note S19895EJ1V0OANOO Chapter 3 Example of SD Memory Card Interface Operation 18 52 Step3 Set bus width and time out value for response card detect stable time SDIA OPTION 0x80EE bus width 1bit biggest time value for response time out and card detection stable time Step4 Clear and mask all information and interrupt SDIA INFO1 0x0000 SDIA INFO2 0x0000 SDIA INFO1 MASK OxFFFF SDIA INFO2 MASK OxFFFF Step5 Set clock SDIA CLK CTRL 0x0140 divide factor 256 abo
12. SDM not busy SDIx as Set sector enable and sector SDIx STOP number to be 1 SDIx_SECCNT y Transfer prepare em1 sd transfer prepare Send single block read command em1 sd send cmd No Send command Ok ges Wait for read enable SDIx INFO2 heck response OK ml sd check rsp sta Yes Read data SDIx BUFO R W transfer end No i Yes Clear response and r w end info rror occur No SDIx INFO1 SDIx INFO2 y d Yes Check device status Clear all error info em1 sd check deu status SDIx INFO2 Error occur ka No y Normal End Error End Figure A 8 Single Block Read in CPU mode Note None Application Note S19895EJ1V0OANOO APPENDIX A SD Driver Function 42 52 A 4 11 Single Block Write Function Name em sd single write Format int em sd single write SDM NUM sd n uint address uchar data Argument Parameter Detail sd n SDM NUM Enum to select SDIA SDIB or SDIC address uint block address to be write data uchar I O Write source data buffer Function Return DRV OK Others error end Application Note S19895EJ1V0OANOO APPENDIX A SD Driver Function 43 52 Flow Chart a Start D Check parameter whether data puter is NULL Wait for SDM not busy SDIx_INFO2 14 Set
13. To our customers Old Company Name in Catalogs and Other Documents On April 1 2010 NEC Electronics Corporation merged with Renesas Technology Corporation and Renesas Electronics Corporation took over all the business of both companies Therefore although the old company name remains in this document it is a valid Renesas Electronics document We appreciate your understanding Renesas Electronics website http www renesas com April 1 2010 Renesas Electronics Corporation Issued by Renesas Electronics Corporation http www renesas com Send any inquiries to http www renesas com inquiry ENESAS 10 11 12 Notice All information included in this document is current as of the date this document is issued Such information however is subject to change without any prior notice Before purchasing or using any Renesas Electronics products listed herein please confirm the latest product information with a Renesas Electronics sales office Also please pay regular and careful attention to additional and different information to be disclosed by Renesas Electronics such as that disclosed through our website Renesas Electronics does not assume any liability for infringement of patents copyrights or other intellectual property rights of third parties by or arising from the use of Renesas Electronics products or technical information described in this document No license express implied or otherwise is granted
14. V0OANOO APPENDIX A SD Driver Function 30 52 Flow Chart Software reset SD St SOFT RST Setting bus width and response SDIx OPTION Noted time out value z SDIx_INFO1 SDIx_INFO2 Clear and mask all info SDIx INFO1 MASK Yy SDIx INFO2 MASK Enable and setting clock in low SDIx_CLK CTRL Note2 frequency Send CMD E setting SD card into SDIx CMD Note3 idle state SDIx_ARGO Send CMD55 and ACMD41 SDIx ARG1 setting SD card ready state SDIx_CMD Get CID info CMD 2 and setting relative address CMD 3 for card in bus Get CSD info from card CMD 9 y Select device CMD 7 y Setting clock to higher frequency Note4 Y Setting transfer bus width and speed CMD 6 y Set block size CMD 16 y End Figure A 2 SD card Initialization Flow Note 1 Before the initialization of SD card set the bus width to be 1bit and the response time out value to be maximum reason is in card identification progress bus width will use 1bit and the clock frequency should in 10 400 KHz 2 After setting the clock for SDM transfer please wait 1ms for stability 3 After send command user should check the command response if error occurred except when response time out for CMD 2 the initialization will be ended abnormally 4 After initialization users can configure the bus width and clock frequency for transfer speed according the CSD parameter o
15. a buffer which will be wrote to SD card At the same time initialize the read data buffer with 0 it will read out data from SD card for i 0 isSDM BLOCKLEN VAL i g write buff i i amp 0xFF 2 Write Data to SD card Call the emt sd single write function to write data into SD card If write operation failed error occur during data transfer end the operation and print error information if write operation works OK continue the test program Following steps shows the write operation progress Step1 Ensure SDM interface is not busy check bit 14 of SDIA INFO register Step2 Enable sector setting and set sector number SDIA STOP SDIA SECCNT Step3 Prepare for data transfer including following steps Clear interrupt information in SDIA INFO1 register Clear all error information in SDIA INFO2 register Set transfer none stop SDIA STOP 0 0 Enable all error interrupt in SDIA INFO2 MASK register Enable read write access interrupt occur in SDIA INFO1 MASK register Step4 Send CMD24 WRITE SINGLE BLOCK with argument write address Detail steps about send command please refer to step 6 of 2 Init SD Card in Chapter 3 2 2 Operation Details Step5 Wait for write enable SDIA_INFO2 and check whether error occur SDIA_RSPO SDIA RSP1 Step6 Write data If no errors occur after send CMD24 WRITE SINGLE BLOCK write data to SD card SDIA_BUFO data Step7 Wait for data transfer end or error
16. and please refer to step 6 of 2 Init SD card in Chapter 3 2 2 Operation Details Step2 Read response value SDIA_RSPO SDIA RSP1 Step3 Check whether SD card locked and error occurred according the card status structure More details about the card status structure please refer to SD card product user s manual I Note The EMMA Mobile 1 SDM interface can support 512 byte as the maximum block size Application Note S19895EJ1V0OANOO Chapter 3 Example of SD Memory Card Interface Operation 20 52 3 3 Example of SDM Single Block Read Write In this example we will write fixed data to SD card then read out and compare whether the data is right both read and write operation will use single CPU operation mode 3 3 1 Operation Flow Initialization data buffer y Write data to SD card em1 sd single write Write operation OK No yYes Read data from SD card em1_sd_single_read Yes Read operation OK No Yes Check data data right No gt Yes Figure 3 3 SDM Single Read Write Operation Flow More details about the functions used in this example please refer to APPENDIX A SD Driver Function Application Note S19895EJ1V0OANOO Chapter 3 Example of SD Memory Card Interface Operation 21 52 3 3 2 Operation Detail 1 Initialization Data Buffer Initialize the write data buffer set fixed value as the following code segment shows to write dat
17. decode csd Format void emt sd decode csd uint raw csd Argument Parameter Type vo Detail en ai uint JL Raw CSD value buffer Function Return None Flow Chart None Note This function will decode the response of SEND CSD command get CSD members that useful for data transfer Application Note S19895EJ1V0OANOO APPENDIX A SD Driver Function 48 52 A 4 16 Check Response Status Function Name em1 sd check rsp status Format int em1 sd check rsp status SDM NUM sd ni Argument SDM NUM 1 Enum to select SDIA SDIB or SDIC Function Return DRV OK DRV ERR STATE Flow Chart Start Read response value SDIx_RSPO and SDIx_RSP1 Y Check whether error occur Y Ys Error occured No Figure A 11 Check Response Status Application Note S19895EJ1V0OANOO APPENDIX B COMMANDS 49 52 APPENDIX B COMMANDS Following table shows the simple function of the SD card command which used in this document More details about the commands format and function please refer to SD card user s manual Table B 1 Command Description List e Argument Abbreviation Command Description CMDO 31 0 stuff bits GO IDLE STATE Resets the card to idle state CMD1 Reserved Ask heir CID b th cuba pros I ASEND E EP Ae Pre eine CMD line 1 16 RCA ET_RELATIVE_A CMD3 GE ee SET DDR i Assigns relative add
18. elated interrupt Related register SDIx INFO1 SDIx_INFO2 SDIx_INFO1_MASK SDIx_INFO2_MASK SDIx_STOP 4 Check whether DMA transfer has ended P2M transfer related register DMA_P2M_CONTSTATUS M2P transfer related register DMA_M2P_CONTSTATUS 5 After data transfer send CMD 13 SEND_STATUS to read SD card status register info check whether error occurred Related register SDIx_ARGO SDIx_ARG1 SDIx_CMD SDIx_RSPO SDIx_RSP1 SDIx_INFO1 SDIx_INFO2 SDIx_INFO1_MASK SDIx_INFO2_MASK More details about SD card status register information please refer to SD card product user s manual Application Note S19895EJ1V0OANOO Chapter 2 Usage of SD Memory Card Interface 14 52 2 3 Erase Following figure shows EMMA Mobile 1 SD memory card erase progress Start Send CMD 32 for erase group Note 1 start setting Send command OK gt Yes Send CMD 33 for erase group end setting Send command OK X Yes Send CMD 38 to execute erase operation Send command OK N Yes y Figure 2 3 EMMA Mobile 1 SDM Erase Operation Note 1 Parameter about CMD 32 CMD33 will be the address to start and end the address will be in Group erase unit more details about erase operation and meaning of erase group unit please refer to SD card product user s manual Application Note S19895EJ1V0OANOO Chapter 3 Example of SD Memory Card Interface Operation 15 52 Chapter 3 Example of SD M
19. emory Card Interface Operation 3 1 Outline of SDM Operation This chapter will show users how to operate SD card using SDO interface Figure 3 1 shows the connection of EMMA Mobile 1 SDM interface and SD card EMMA Mobile1 SD Card DAT4 7 SDO_DATA3 a DAT3 SDO_DATA2 La DAT2 SDO_DATA1 La DAT SDO_DATAO lt DATO SD0_CMD gt CMD SDO CKO CLK Figure 3 1 Connection between EMMA Mobile 1 and SD card Application Note S19895EJ1V0OANOO Chapter 3 Example of SD Memory Card Interface Operation 16 52 3 2 Initialization Before SD card operation initialization should be executed at first 3 2 1 Operation Flow Init hardware interface em1 sd hw init y Init SD card em1 sd init ur Yes End Error End Figure 3 2 Initialization before Test More details about the functions used in initialization please refer to APPENDIX A SD Driver Function Application Note S19895EJ1V0OANOO Chapter 3 Example of SD Memory Card Interface Operation 17 52 3 2 2 Operation Detail 1 Init SDM module hardware Init SDM module function em1 sd bw init Following steps shows the hardware initialization em1 sd hw init progress Step1 Reset setting ASMU RESETREG3 2 0 reset 1 cancel reset ASMU RESETREGSENA 2 0 disable setting 1 enable setting Step2 Clock setting ASMU_GCLKCTRL4 5 0 close clock 1 open clock ASMU_GCLKCTRL4
20. end CMD16 to set block length em1 sd send cmd Send command OK Yse Set block size SDIx_SIZE Normal End Error End Figure A 5 Set Block Length Note Data transfer block length setting Application Note S19895EJ1VOANO00 APPENDIX A SD Driver Function 36 52 A 4 7 Select Card Function Name em sd select card Format int em sd select card SDM NUM sd mn uint RCA Argument Parameter Type vo Det sd n SDM NUM Enum to select SDIA SDIB or SDIC RCA uint l Relative card address that need to be select Function Return DRV_OK Others error end Flow Chart C Start D v Setting RCA for command parameters SDIx ARGO SDIx_ARG1 y Send CMD7 to select card em1 sd send cmd Send command OK No Yse Nora end S Error End Figure A 6 Select Card Note None Application Note S19895EJ1VOANO00 APPENDIX A SD Driver Function 37 52 A 4 8 Check Device Status Function Name em sd check dev status Format intem1_sd_check_dev_status SDM NUM sd ni Argument vo Det SDM NUM 1 Enum to select SDIA SDIB or SDIC Function Return DRV_DEV_LOCKED DRV_DEV_UNLOCKED DRV_ERR_STATE Flow Chart Application Note S19895EJ1V0OANOO APPENDIX A SD Driver Function 38 52 Set command parameters RCA SDIx ARGO SDIx ARG1 y Send CMD13 to get card RE em1 sd send
21. ennnennnennnennnnnnnnennnevnnnvunnvnnner ANNEX Modification HiStOry rrnnnnvvnnnnnnvnnnnnnnvnnnnnnnvnnnnnnnvnnnnnnnnvennnnnnvennnnnnvennnnnneennnnnneennnnnneennennnn Application Note S19895EJ1V0OANOO INDEX LIST OF TABLES Table 1 1 Hardware Environment A Table 1 2 Software Environment Table A 1 SD Driver Function Uet arrancar rra Table A 2 Global Variable Deime Table A 3 Structure Deine usada dto id Table A 4 Structure of mmc Ce Table B 1 Command Description List ooonnnicidnndininnnnnncnnnccnnnncnnnccnnnnrc cnn rana LIST OF FIGURES Figure 2 1 EMMA Mobile 1 SDM Initialization srrannrenonrrnrorrrnnnrrnnnnnrnnnrrrnnnrrnnnnrnnrnnnernnn Figure 2 2 EMMA Mobile 1 SDM Data Transfer in DMA Mode n se Figure 2 3 EMMA Mobile 1 SDM Erase Operation Figure 3 1 Connection between EMMA Mobile 1 and SD card eeen Figure 3 2 Initialization before Test Figure 3 3 SDM Single Read Write Operation Flow ooooocncicinccconnccnnccccconcccnonnnnancccnnncnnn Figure 3 4 SD Multi block Operation Flow rarrrrnnvrnannnvnnonrnnnnrrvnnnrnnnnnnnnnrrenrnnrnnnnnnnnennenenn Figure A 1 SDM Hardware Initialization Flow serannronnonrrnrnrrnnnnrnnnnnrnnnrrvrnnrrnnnnrnnrnnnnrenn Figure A 2 SD card Initialization Flow ssrrernnrrnnnnrnnnnnvnnonrnnnnrrnnnnrnnnnnnnrenrrennnrnnsnnnnnennenenn Figure A 3 Sector Setting Flow rrrrannrnnannvnnnnvrrnnnrnnnnnvnnenvvnnnrnnennrnnnennenenrrennnrnssnnnenennenenn Figure A 4 Send Command mu aan
22. esas Electronics does not warrant that such information is error free Renesas Electronics assumes no liability whatsoever for any damages incurred by you resulting from errors in or omissions from the information included herein Renesas Electronics products are classified according to the following three quality grades Standard High Quality and Specific The recommended applications for each Renesas Electronics product depends on the product s quality grade as indicated below You must check the quality grade of each Renesas Electronics product before using it in a particular application You may not use any Renesas Electronics product for any application categorized as Specific without the prior written consent of Renesas Electronics Further you may not use any Renesas Electronics product for any application for which it is not intended without the prior written consent of Renesas Electronics Renesas Electronics shall not be in any way liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for an application categorized as Specific or for which the product is not intended where you have failed to obtain the prior written consent of Renesas Electronics The quality grade of each Renesas Electronics product is Standard unless otherwise expressly specified in a Renesas Electronics data sheets or data books etc Standard Computers office equ
23. f SD card the transfer speed defines in CSD register just clock frequency not in high speed mode so the actual transfer speed is related to card specification version Application Note S19895EJ1V0OANOO APPENDIX A SD Driver Function A 4 3 Sector Setting Function Name em sd set seccnt Format void em1 sd set seccnt SDM NUM sd n BOOL bEnable uint sec num Argument Parameter sd n SDM NUM Detail Enum to select SDIA SDIB or SDIC 31 52 bEnable BOOL Enable disable sector sec num uint Function Return None Flow Chart Enable the Sector Yes No Sector number Enable and Configure Sector SDIx_STOP SDIx SECCNT v Ensure R W Operation is Over SDIx_INFO1 y Disable Sector SDIx STOP Figure A 3 Sector Setting Flow Note None Application Note S19895EJ1VOANO00 APPENDIX A SD Driver Function 32 52 A 4 4 Send Command Function Name em sd send cmd Format int em sd send cmd SDM NUM sd n int cmd Argument Parameter Type vo Detail sd n SDM NUM l Enum to select SDIA SDIB or SDIC int l Command index that need to be send Function Return DRV_OK Others error end Application Note S19895EJ1VOAN00 Note APPENDIX A SD Driver Function Flow Chart Y Clear all information registers SDIx_INFO1 SDIx_INFO2 y Enable all errors SDIx INFO2 MASK
24. hereby under any patents copyrights or other intellectual property rights of Renesas Electronics or others You should not alter modify copy or otherwise misappropriate any Renesas Electronics product whether in whole or in part Descriptions of circuits software and other related information in this document are provided only to illustrate the operation of semiconductor products and application examples You are fully responsible for the incorporation of these circuits software and information in the design of your equipment Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from the use of these circuits software or information When exporting the products or technology described in this document you should comply with the applicable export control laws and regulations and follow the procedures required by such laws and regulations You should not use Renesas Electronics products or the technology described in this document for any purpose relating to military applications or use by the military including but not limited to the development of weapons of mass destruction Renesas Electronics products and technology may not be used for or incorporated into any products or systems whose manufacture use or sale is prohibited under any applicable domestic or foreign laws or regulations Renesas Electronics has used reasonable care in preparing the information included in this document but Ren
25. ipment communications equipment test and measurement equipment audio and visual equipment home electronic appliances machine tools personal electronic equipment and industrial robots High Quality Transportation equipment automobiles trains ships etc traffic control systems anti disaster systems anti crime systems safety equipment and medical equipment not specifically designed for life support Specific Aircraft aerospace equipment submersible repeaters nuclear reactor control systems medical equipment or systems for life support e g artificial life support devices or systems surgical implantations or healthcare intervention e g excision etc and any other applications or purposes that pose a direct threat to human life You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics especially with respect to the maximum rating operating supply voltage range movement power voltage range heat radiation Characteristics installation and other product characteristics Renesas Electronics shall have no liability for malfunctions or damages arising out of the use of Renesas Electronics products beyond such specified ranges Although Renesas Electronics endeavors to improve the quality and reliability of its products semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certai
26. n History ANNEX Modification History 52 52 Number Modification Contents Author Date Ver 1 00 New version Aug 4 2009 Application Note S19895EJ1VOANO0
27. n use conditions Further Renesas Electronics products are not subject to radiation resistance design Please be sure to implement safety measures to guard them against the possibility of physical injury and injury or damage caused by fire in the event of the failure of a Renesas Electronics product such as safety design for hardware and software including but not limited to redundancy fire control and malfunction prevention appropriate treatment for aging degradation or any other appropriate measures Because the evaluation of microcomputer software alone is very difficult please evaluate the safety of the final products or system manufactured by you Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product Please use Renesas Electronics products in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances including without limitation the EU RoHS Directive Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations This document may not be reproduced or duplicated in any form in whole or in part without prior written consent of Renesas Electronics Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas Electronics
28. nd rather 15 0 stuff bits than a standard command CMD56 31 1 stuff bits GEN CMD Used either to transfer a data block to the Application Note S19895EJ1V0OANOO 51 52 APPENDIX B COMMANDS 0 RD WR1 card or to get a data block from the card for general purpose application specific commands CMD57 iy Reserved CMD63 Defines the data bus width 00 1bit ACMD 81 2 stuff bits S l 2 SET BUS WIDTH or 10 4 bits bus to be used for data 6 1 0 bus width transfer ACMD De 31 0 stuff bits SD STATUS Send the SD Card status ACMD 47 24 Reserved 31 0 stuff bits SEND_NUM_WR_B LOCKS Send the number of the written without errors write blocks Responds with 32bit CRC data block 31 23 stuff bits 22 0 Number of blocks SET_WR_BLK_ER ASE_COUNT Set the number of write blocks to be pre erased before writing to be used for faster Multiple Block WR command 1 default one wr block 2 Reserved 31 0JOCR without busy 31 1 stuff bits O set cd SD APP OP CON D SET CLR CARD DETECT Asks the accessed card to send its operating condition register OCR con tent in the response on the CMD line Connect 1 Disconnect 0 the 50KOhm pull up resistor on CD DAT3 pin 1 of the card Reserved 31 0 stuff bits SEND_SCR Reads the SD Configuration Register SCR Application Note S19895EJ1V0OANOO ANNEX Modificatio
29. nsfer in DMA Mode in chapter 2 2 Data Transfer Note None Application Note S19895EJ1V0OANOO APPENDIX A SD Driver Function 45 52 A 4 13 Multiple Block Write Function Name em sd multi write Format int em sd multi write SDM NUM sd n uint address uchar write_buf uint Dk num Argument Parameter sd n SDM NUM Enum to select SDIA SDIB or SDIC address uint block address to be write write buf uchar write source data buffer blk_num uint block number to be write Function Return DRV_OK Others error end Flow Chart Please refer to figure2 2 EMMA Mobile 1 SDM Data Transfer in DMA Mode in chapter 2 2 Data Transfer Note None Application Note S19895EJ1V0OANOO APPENDIX A SD Driver Function 46 52 A 4 14 Transfer Prepare Function Name em1 sd transfer prepare Format int em1 sd transfer prepare SDM NUM sd ni Argument vo Geen SDM NUM 1 Enum to select SDIA SDIB or SDIC Function Return None Flow Chart CD All information clear SDIX INFO1 SDIx_INFO2 y Clear stop setting bit SDIx_STOP v Enable all error occur SDIx INFO2 MASK y Enable R W access end SDIx INFO MASK End Figure A 10 Register Prepare before Data transfer Note None Application Note S19895EJ1VOANO00 APPENDIX A SD Driver Function 47 52 A 4 15 Decode CSD Function Name em sd
30. of SD Memory Card Interface 11 52 2 2 Data Transfer SD memory card interface has two kinds of data transfer mode DMA mode and CPU mode In realize operation mainly use DMA mode to transfer data so in this chapter introduce the DMA mode operation about SD single block read write in CPU mode please refer to APPENDIX A SD Driver Function Following figure shows EMMA Mobile 1 SD DMA read write progress Start y Wait for SD card interface not SDIx_INFO2 14 busy z y Ke Enable SDM DMA mode SDIx OG EXT MODE y DMA init and transfer setting Note1 M Note2 Start DMA E y Set sector enable and sector SDIx_STOP number to be transfered SDIx_SECCNT y Transfer prepare Note y Send read write command gt Y No DMA transfer end Note4 SDIx_INFO1 2 R W transfer end Yes Y No Check whether error occuer SDIx INFO2 ere is still data 8 to be transfer j i SDIx_INFO1 Clear transfer info and disable SDIx INFO2 Yes DMA mode SDIx CC EXT MODE Disable sector SDIx STOP Resetting DMA transfer parameter R y l Check SD card status Note5 Restart DMA for the left data v End Figure 2 2 EMMA Mobile 1 SDM Data Transfer in DMA Mode Note 1 In DMA init and transfer setting step user should reset DMA channel open DMA clock clear Application Note S19895EJ1V0OANOO DMA interr
31. p according the actual hardware Application Note S19895EJ1VOANOQ0 Chapter 2 Usage of SD Memory Card Interface 10 52 connection for example if users connect the SD card with SD1 interface please switch the related GPIO to SD1 function 2 Before the initialization of SD card set the bus width to be 1bit and the response time out value to be maximum reason is in SD card identification progress bus width will use 1bit and the clock frequency should in 10 400 KHz range 3 After setting the clock for SDM transfer please wait 1ms for stability 4 After send command user should check the command response if error occurred except when response time out for CMD 2 the initialization will be ended abnormally Commands simple description please refers to the APPENDIX B COMMANDS 5 CID Card Identification CSD Card Specific Data 6 After initialization users can configure the bus width and clock frequency for transfer speed according the CSD parameter of SD card the transfer speed defines in CSD register just clock frequency not in high speed mode so the actual transfer speed is related to SD card specification version 7 The register name SDIx described in this document means the SDIA SDIB or SDIC which can be changed according the hardware connection more details about SDM registers and related bits please refer to SDM interface user s manual of EMMA Mobile 1 Application Note S19895EJ1V0OANOO Chapter 2 Usage
32. products or if you have any other inquiries Note 1 Renesas Electronics as used in this document means Renesas Electronics Corporation and also includes its majority owned subsidiaries Note 2 Renesas Electronics product s means any product developed or manufactured by or for Renesas Electronics ENESAS Application Note Multimedia Processor for Mobile Applications SD Memory Card Interface EMMA Mobile1 Document No 19895EJ1VOANO0 Date Published Aug 2009 NEC Electronics Corporation 2009 Printed in Japan PREFACE Purpose Organization Notation Related document PREFACE The purpose of this document is to specify the usage of EMMA Mobile1 SD Memory Card SDM interface This document includes the following e Introduction e Usage of SDM Interface e Example of SDM Operation e SD Driver Function Here explains the meaning of following words in text Note Explanation of item indicated in the text Caution Information to which user should afford special attention Remark Supplementary information The following tables list related documents Reference Document Document Name Version date Author Description 19265EJ1 VOUM00_ASMUGIO pdf 1st Edition NECEL SMU amp GPIO user s manual 19268EJ1VOUMO00_1chip pdf 1st Edition NECEL 1 chip user s manual NZ SDM interface user s 19361JJ2VOUMO00_SDI pdf 2 Edition NECEL manual 19907EJ1 VOANOO_GD pdf 1stEdition NECEL GD spec
33. ress to the card CMD4 Not Supported CMD5 Reserved 31 Mode 0 Check 1 Switch 30 24 all 0 23 20 group 6 19 16 group 5 Checks switchable function mode 0 and WITCH ONDE 15 12 group 4 S S switch card function mode 1 11 8 group 3 7 4 group 2 for command 3 0 group 1for access mode lati 31 16 RCA SELECT DESELEC Select device by its own relative address CMD7 15 0 stuff bits T CARD and gets deselected by any other address address 0 deselects the card CMD8 Reserved 31 16 RCA Addressed card sends its Card Specific END D SMD 15 0 stuff bits gt CS Data CSD on the CMD line 31 16 RCA Addressed card sends its Card Identification END_CID SE 15 0 stuff bits S C CID on CMD the line h 31 0 data READ DAT UNTIL Reads E stream from the card staring at CMD11 draget STOP the given address until a PE STOP_TRANSMISSION follows STOP_TRANSMIS CMD12 31 0 stuff bits SION Forces the card to stop transmission CMD13 31 1 ae SEND_STATUS Addressed card sends its status register 15 0 stuff bits Application Note S19895EJ1V0OANOO APPENDIX B COMMANDS 50 52 CMD14 Reserved 31 16 RCA GO INAGCTIVE ST CMD15 15 0 stuff bits ATE Sets card to inactive state h lock h i f II CMD16 31 0 block SET BLOCKLEN Sets i e block length in bytes OG a length following block commands read and write CMD17 31 0
34. ronics endeavors to enhance the quality reliability and safety of NEC Electronics products customers agree and acknowledge that possibility of defects thereof cannot be eliminated entirely To minimize risks of damage to property or injury including death to persons arising from defects in NEC Electronics products customers must incorporate sufficient safety measures in their design such as redundancy fire containment and anti failure features Note 1 NEC Electronics as used in this document means NEC Electronics Corporation and also includes its majority owned subsidiaries NEC Electronics products means any product developed or manufactured by or for NEC Electronics as defined above All trademarks or registered trademarks are the property of their respective owners Registered trademarks and trademarks are not noted in this document Application Note S19895EJ1V0OANOO INDEX 4 52 CONTENTS Chapter 1 Introduction ee EENS EEN 7 TT ell 7 1 2 Development Environment ernnnnavnnnnnnnvnnnnnnnvnnnnnnnvnnnnnnnvnnnnnnnnnnnnnnvnnnnnnnennnnnnnnnnnennnneneennnnene 7 Chapter 2 Usage of SD Memory Card InterfaCe rmssrrnsvnnnnnvnnnnnvnnnnvnnnnvnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn 8 E WI te EE 9 2 2 Dala RENE E 11 2 3 EE 14 Chapter 3 Example of SD Memory Card Interface Operation rrs rnnavnnnnvnnnnvnnnnnvnnnnnnnnnnvnnnnnr 15 3 1 Outline of SDM Operation eeraa aam a a ra arm aa ara aaa a aa a SAren
35. sfer 3 Erase Application Note S19895EJ1V0OANOO Chapter 2 Usage of SD Memory Card Interface 2 1 Initialization 9 52 Following figure shows EMMA Mobile 1 SD initialize progress y Power on Clock and Reset setting about SDM module Switch GPIO to SD function and Setting pull up pull down for SD Wait Read Driver ability and Auto frequency configuration ASMU_GCLKCTRL4ENA ASMU_GCLKCTRL4 ASMU_RESETREQ3 ASMU RESETREQ3ENA Note1 ASMU Ap SDIXWAITCTRL ASMU_AB1_SDIxREADCTRL y Software reset SD CHG_DRIVE1 ASMU_AUTO_FRQ_MASK3 Setting bus width and response time out value SDIx SOFT RST SDIx OPTION Note SDIx INFO Clear and mask all info SDIx_INFO2 Enable and setting clock in low frequency SDIx_INFO1_MASK SDIx_INFO2_MASK Send CMD 0 setting EMMC device into idle state ISDIx CLK CTRL Note Send CMD 55 and CMD41 setting device into ready state SDIx CMD Note4 SDIx ARGO Get CID info CMD 2 and setting relative address CMD 3 for all devices in bus y Get CSD info from device CMD 9 y Select device CMD 7 y Set block size CMD 16 Setting transfer bus width and speed emm and CMD 6 End SDIx ARG1 SDIx CMD Note5 Figure 2 1 EMMA Mobile 1 SDM Initialization Note 1 Switch pins to SD function users should operate this ste
36. tatus em1_sd erase Erase function em1_sd_single_read Single block read operation in CPU mode em sd signle write Single block write operation in CPU mode em sd multi read Multi block read operation in DMA mode em sd multi write Multi block write operation in DMA mode em1 sd tranf prepare Prepare before data transfer Int MENE em sd decode csd Decode CSD structure function em1_sd_check_rsp_status A 2 Global Variable Define Check response status Table A 2 Global Variable Define Name type Gest g_RCA_VAL ushort Globle flag for relative address Application Note S19895EJ1VOANO00 APPENDIX A SD Driver Function A 3 Structure amp Enum Define 27 52 Table A 3 Structure Define Structure Name etal SDM_NUM Enum for SDIA SDIB and SDIC CSD register sturcture A 3 1 mmc_csd Table A 4 Structure of mmc_csd uchar mmca_vsn MMC structure version ushort cmdclass Command classes ushort tacc_clks Read access time in clocks uint tacc_ns Read access time in ns uint max dir Maximum data transfer speed uint read bikbits Read block bits uint read bikbits Write block bits uint capacity Device capacity uint erase grp size Erase group base size uint erase grp mult Erase group size multipile factor uint wp grp size Write protect froup size uint read par
37. tial Whether enable read in partial block uint read misalign Whether enable read block cross physical block boundaries uint write partial Whether enable write in partial block uint write misalign Whether enable write block cross physical block boundaries Application Note S19895EJ1V0OANOO APPENDIX A SD Driver Function 28 52 A 4 Function Details A 4 1 Hardware Initialization Function Function Name em sd bw init Format int em sd bw init SDM NUM sd ni Argument vo Det SDM NUM 1 Enum to select SDIA SDIB or SDIC Function Return None Flow Chart y Power on ASMU_GCLKCTRL4ENA Clock and Reset setting about ASMU_GCLKCTRL4 SDM module ASMU RESETREQ3 ASMU RESETREQ3ENA Switch GPIO to SD function and Note1 Setting pull up pull down for SD ASMU_AB1_SDIxWAITCTRL Wait Read Driver ability and Auto ASMU_AB1_SDIxREADCTRL frequency configuration CHG_DRIVE1 ASMU_AUTO_FRQ_MASK3 End Figure A 1 SDM Hardware Initialization Flow Note 1 Switch GPIO to SD function users should operate this step according the actual hardware connection Application Note S19895EJ1VOANO00 APPENDIX A SD Driver Function 29 52 A 4 2 Card Init Operation Function Name em sd init Format int em sd int SDM NUM sd ni Argument vo Det SDM NUM 1 Enum to select SDIA SDIB or SDIC Function Return DRV OK Others error end Application Note S19895EJ1
38. tion Note S19895EJ1V0OANOO Chapter 3 Example of SD Memory Card Interface Operation 19 52 Step10 Select card Send CMD7 SELECT with argument RCA which selected to communicate Details about send command please refer to step6 Step11 Re setting clock SDIA_CLK_CTRL 0x0301 divide factor 4 about 20 8MHz Use higher frequency after init SD card Delay 1ms after setting the clock frequency Step12 Set block length including following steps Send CMD16 SET_BLOCKLEN with argument block length Details about send command please refer to step6 Changing block size values in SDIA_SIZE register Step13 Set bus width including following steps Send CMD55 with argument RCA Send ACMD6 SWITCH with argument bus width to set the bus width if no error Change bus width which set in SDIA_OPTION register Details about send command please refer to step6 Note The argument of ACMD6 defines the bus with when use 1 bit as bus width the argument is 0x00000000 when use 4 bit as bus width the argument is 0x00000002 More details about the initialization progress please refer to APPENDIX A SD Driver Function 3 Check Card Status Check the card status function em1_sd_check_dev_status after data transfer to make sure read and write operation followed can works normally Check card status em1_sd_check_dev_status including following steps Step1 Send CMD13 SEND_STATUS with argument RCA Details about send comm
39. upt source set transfer parameter for DMA DMA reset setting related register ASMU RESETREQOENA ASMU RESETREQO DMA clock setting related register ASMU_GCLKCTRLO ASMU_GCLKCTRLOENA P2M Clear DMA interrupt source related register For SDO DMA P2M PEO LCHOLCH3 INT REQ CL DMA P2M DSP LCHOLCH3 INT REQ CL For SD1 and SD2 DMA P2M PEO LCH4LCH7 INT REQ CL DMA P2M DSP LCH4LCH7 INT REQ CL M2P Clear DMA interrupt source related register For SDO DMA M2P PEO LCHOLCH3 INT REQ CL DMA M2P DSP LCHOLCH3 INT REQ CL For SD1 and SD2 DMA M2P PEO LCH4LCH7 INT REQ CL DMA M2P DSP LCH4LCH7 INT REQ CL P2M DMA transfer setting related register DMA P2M LCHx AADD DMA P2M LCHx BADD DMA P2M LCHx BOFF DMA P2M LCHx BSIZE DMA P2M LCHx BSIZE COUNT DMA P2M LCHx LENG DMA P2M LCHx MODE Here x 3 when use SDO x 4 when use SD1 x 5 when use SD2 M2P DMA transfer setting related register DMA M2P LCHx BADD DMA M2P LCHx AADD DMA M2P LCHx AOFF DMA M2P LCHx ASIZE DMA M2P LCHx ASIZE COUNT DMA M2P LCHx LENG Application Note S19895EJ1V0OANOO 12 52 Chapter 2 Usage of SD Memory Card Interface Chapter 2 Usage of SD Memory Card Interface 13 52 DMA M2P LCHx MODE Here x 3 when use SDO x 4 when use SD1 x 5 when use SD2 2 Start DMA transfer P2M start register DMA P2M CONT M2P start register DMA M2P CONT 3 Before data transfer clear all information register make sure data transfer end enable the r
40. ut 325KHz Use the lower frequency when init SD card Delay 1ms after setting the clock frequency Step6 Send CMDO make SD card to idle state including following steps Clear all error and information SDIA_INFO1 SDIA INFO2 Enable response end interrupt occur SDIA INFO MASK Enable all error occur SDIA INFO2 MASK Send command SDIA CMD Wait for command send end or error occur SDIA INFO1 SDIA INFO2 Check whether error occur SDIA INFO2 SDIA RSPO SDIA RSP1 Note If command has argument setting the argument at first SDIA ARGO SDIA_ARG1 Step7 Send CMD55 with argument 0x00000000 after CMD55 send ACMD41 with argument 0x00100000 make SD card to ready state SDIA ARGO SDIA ARG1 Check whether power up is ready SDIA RSP1 15 If not ready circle this step if in ready state run to next step Details about send command please refer to step6 Step8 SD card send CID to host and get RCA relative card address information from host including following steps Send CMD2 ALL SEND CID with argument 0x00000000 Send CMD3 SNED RELATIVE ADDR with argument RCA RCA init value is 0 Wait until RCA value is not 0 Details about send command please refer to step6 Step9 Get CSD information including following steps Send CMD9 SNED CSD with argument RCA the one that need to send CSD information to host Details about send command please refer to step6 Get CSD information from the command response SDIA RSPO SDIA RSP7 Applica
41. wlan tah ania utdannede Figure A 5 Set Block Length Figure A 6 Select ees ia Figure A 7 Check Card Stauts ocooocconoccconoccconcccconncnnnrnnnano cnn rca nan nn nano rn nr nr r arrancan Figure A 8 Single Block Read in CPU mode cccococccicccccoccccconccononanononcnancccnnn cana no na nnnnccnn nc Figure A 9 Single Block Write in CPU mode Figure A 10 Register Prepare before Data transfer rannrnrnnrvnnnnvnnnnnvnnnrrrnnnrrnnnnnnnnrnrenenn Figure A 11 Check Response Gtaius nn nn nano cnn cnn arrancan Application Note S19895EJ1V0OANOO 6 52 Chapter 1 Introduction 7 52 Chapter 1 Introduction 1 1 Outline This document will show users how to operate SD memory card interface on EMMA Mobile evaluation board 1 2 Development Environment e Hardware environment of this project is listed as below Table 1 1 Hardware Environment EMMA Mobile 1 evaluation board PSKCH2Y NEC Electronics S 0016 01 PARTNER Jet ICE ARM M20 Kyoto Microcomputer Co Ltd e Software used in this project is listed as below Table 1 2 Software Environment GNUARM Toolchain V4 3 2 GNU WJETSET ARM V5 10a Kyoto Microcomputer Co Ltd Application Note S19895EJ1V0OANOO Chapter 2 Usage of SD Memory Card Interface 8 52 Chapter 2 Usage of SD Memory Card Interface According to the hardware feature the EMMA Mobile 1 SD memory card SDM interface has the following main function 1 Initialization 2 Data Tran

Download Pdf Manuals

image

Related Search

Related Contents

Ideal Pet 96PATCFEW Instructions / Assembly  chargement du fichier PDF  Hiver 2010 - "À deux, c`est mieux"  お米じまん  D-Link DCS-6513 User's Manual  POE+ DESKTOP SWITCH USER MANUAL    

Copyright © All rights reserved.
Failed to retrieve file