Home

EMMA Mobile1 Application Note EMMC Interface

image

Contents

1. Note Change bus width and other operation mode Application Note S19904EJ1VOANO00 46 65 APPENDIX A EMMC Driver Function 47 65 1 Details about extend CSD information please refer to Chapter 5 5 Extended CSD Register of EMMC chip user s manual Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function 48 65 A 4 9 Check Device Status Function Name Gm emmc check dev status Format int em1 emmc check dev status void Argument None Function Return DRV EMMC LOCKED DRV EMMC UNLOCKED DRV ERR STATE Flow Chart Start gt Y Set command parameters RCA SDIC ARGO SDIC ARG1 Send CMD13 to get device status emi emmc send cma Send command OK N Yse Head response value SDIC_RSPO and SDIC RSP1 Y Check whether card locked Y Check whether error occur Ems 2 No Y Norma 2 q Error End E Figure A 8 Check EMMC Chip Stauts Note Check EMMC chip status register Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function 49 65 A 4 10 Erase Function Function Name Gm emmc erase Format int em1 emmc erase uint str addr uint end adr Argument Parameter Type VO Detail str dd uint Start erase group unit address pend addr uint End of erase group unit address Function Return DRV OK Others error end Flow Chart
2. Note Data transfer block length setting Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function 45 65 A 4 7 Select Card Function Name emi emmc select card Format int em1 emmc select card uint RCA Argument Parameter Type VO Detail RCA un Helative card address that need to be select Function Return DRV OK Others error end Flow Chart 4 otart 5 Setting RCA for command parameters SDIC ARGO SDIC ARG1 y Send CMD7 to select EMMC chip emi emmc send cmdad Send command OK No Yse Norma 2 Error End Figure A 6 Select Card Note None Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function A 4 8 Configuration Extend CSD Function Name em emmc set ext csd Format int em1 emmc set ext csd void Argument None Function Return DRV OK Others error end Flow Chart 1 Start D Set command parameters bus width as 4bit SDIC ARGO SDIC_ARG1 Send CMD6 to switch bus width emi emmc send cmdad Send command OK N Yse Set SDM as 4 bit bus width SDIC OPTION Set command parameters set HS TIMING on Note1 SDIC ARGO SDIC ARG1 Send CMD6 to switch bus width emt emmc send cmdad Send command OK No Yse y Norma End Error End gt Figure A 7 Configure Extend CSD
3. eck data data rights strncmp Yes Erase first 2MB in EMMC emi emmc erase Erase operation OK No Yes Head data from chip first 2MB emi emmc multi read Yes Read operation OK Me t Yes All data is zero S Yes Y Normal End S Error End gt Figure 3 4 EMMC Multi block Operation Flow More details about the functions used in this example please refer to APPENDIX A EMMC Driver Function Application Note S19904EJ1VOANO00 Chapter 3 Example of EMMC Operation 28 65 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 EMMC chip At the same time initialize the read data buffer with O it will read out data from EMNC chip 2 Write Data to EMMC Setting parameters about the data transfer call the emt emmc multi write function to write data into EMMC chip 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 EMMC Data Transfer in DMA Mode 3 Read Data from EMMC Call em emmc multi read function to read out the written data by step 2 from EMMC Check the read operation if read failed end the operation and print error if read OK continue the test program Details about multiple
4. Please refer to figure2 3 EMMA Mobile 1 Erase Operation in chapter 2 3 Erase Note None Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function 50 65 A 4 11 Single Block Read Function Name emi emmc single read Format int em1 emmc single read uint address uchar data Argument Parameter Type vo Detail address uit 1 1 block address to be read read out data buffer Function Return DRV_OK Others error end Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function Flow Chart Start E Check parameter whether is NULL Wait for EMMC not busy Set sector enable and sector SDIC STOP number to be 1 Y SDIC SECONT Transfer prepare em1 emmoc transfer prepare Send single block read command emi emmc send cmdad No Send command Ok Yes Wait for read enable SDIC_INFO2 heck response OK emi emmc check rsp statu Yes Head data SDIC_BUFO R W transfer end Do i Yes Clear response and r w end info SDIC INFO1 Y Check device status emi emmc check dev status Error occur NO SDIC INFO2 Yes Clear all error info SDIC INFO2 Normal End D gt lt v a Error End gt Figure A 9 Single
5. GNUARM Toolchain V4 3 2 GNU WJETSET ARM V5 10a Kyoto Microcomputer Co Ltd Application Note S19904EJ1VOANO00 Chapter 2 Usage of EMMC Interface 8 65 Chapter 2 Usage of EMMC SDM Interface According to the hardware feature the EMMA Mobile 1 EMMC SDM interface has the following main function 1 Initialization 2 Data Transfer 3 Erase 4 Write Protect Management 5 Lock Unlock Operation Application Note S19904EJ1VOANO00 Chapter 2 Usage of EMMC Interface 9 65 2 1 Initialization Following figure shows EMMA Mobile 1 EMMC initialize progress Start Y Power on Clock and Reset setting about SDM module ASMU_GCLKCTRL4ENA ASMU_GCLKCTRL4 Switch GPIO to SD function and Setting pull up pull down for SD ASMU_RESETREQ3 ASMU_RESETREQ3ENA CHG PINSEL G80 Note Wait Read Driver ability and Auto frequency configuration CHG PINSEL G112 CHG PULL G112 ASMU AB1 SDICWAITCTRL ASMU AB1 SDICREADCTRL Software reset SD CHG DRIVE1 ASMU AUTO FRQ MASK3 Setting bus width and response time out value SDIx SOFT RST Note2 Clear and mask all info SDIC OPTION SDIC INFO SDIC INFO2 Enable and setting clock in low frequency SDIC INFO1 MASK SDIC INFO2 MASK Send CMD 0 setting EMMC device into idle state SDIC CLK CTRL Note3 Send command 1 setting device SDIC CMD Note4
6. 2 2 Operation Detail 1 Init SDM module hardware Init SDM module function em1 emmc hw init Following steps shows the hardware initialization em1 emmc hw init progress Step1 Reset setting ASMU RESETREQJ9 4 0 reset 1 cancel reset ASMU RESETREQSENA 4 0 disable setting 1 enable setting Step2 Clock setting ASMU GCLKCTRLA 7 0 close clock 1 open clock ASMU GCLKCTRLAENA 7 0 disable setting 1 enable setting Step3 Switch pins to SD function CHG PINSEL G80 0x04000000 GIO P93 gt SD2 CKI CHG PINSEL G112 0x00000555 GIO P112 117 gt SD2 CKO CMD DATAO 3 Step4 Pull up down setting CHG PULL G112 20x00666661 SD2 CKO Pull up down Disable SD2 CMD and DATAO 3 Input Enable Pull up enable Step5 Drive capability setting CHG DRIVE1 0x05000000 SD2 CK and SD2 pins 4mA default value Setp6 Read and wait control register setting ASMU AB1 SDICWAITCTRL 0x00000300 ASMU AB1 SDICREADCTRL 0x00000000 default value Setp7 Auto frequency control setting ASMU AUTO FRQ MASK3 0x07 default value 2 Init EMMC device EMMC device initialization em1 emmoc _init including following steps Step1 Power on EMMC device Step2 Soft reset SD SDIC_SOFT RST 0x0000 module reset SDIC SOFT RST 0x0007 release reset Step3 Set bus width and time out value for response card detect stable time SDIC OPTION 0x80EE bus width 1bit biggest time value for response time Application Note S1
7. SDIC ARGO into ready state Get CID info CMD 2 and setting relative address CMD 3 for all devices in bus Get CSD info from device CMD 9 Y Select device CMD 7 y Setting clock to higher frequency Setting transfer bus width and speed 6 Set block size CMD 16 Y CT SDIC_ARG1 SDIC_CMD Note5 Figure 2 1 EMMA Mobile 1 EMMC Initialization Application Note S19904EJ1VOANO00 Chapter 2 Usage of EMMC Interface 10 65 Note 1 Switch pins to SD function in this document use SD2 as the EMMC interface users should operate this step according the actual hardware connection for example if users connect the EMMC with SD1 interface please switch the related GPIO to SD1 function 2 Before the initialization of EMMC device set the bus width to be 1bit and the response time out value to be maximum reason is in EMMC 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 More details about the commands format and function please refer to Chapter4 6 Commands of the EMMC chip user
8. 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 434 NES AS Application Note Multimedia Processor for Mobile Applications EMMC Interface EMMA Mobile1 Document No 19904EJ1VOANOO 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 Mobile EMMC SDM interface This document includes the following e Introduction e Usage of EMMC SDM Interface Example of EMMC Operation e EMMC 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 G Document Name Version date Author Description 19265EJ1VOUM00_ASMUGIO pdf NECEL SMU amp GPIO user s manual 19268EJ1VOUMO00_1chip pdf NECEL 1 chip user s manual SDM interface user s S19361JJ2V0UM00_SDI paf 2nd Edition NECEL manual S19907EJ1V0ANO0 GD pdf NECEC GD Spec KMCEGO0000A S9980 4GB SAMAUN moviNAND 8Gb MLC Based
9. s manual 5 CID Card Identification CSD Card Specific Data More details about CID and CSD information please refer to Chapter 5 0 REGISTERS of the EMMC chip user s manual 6 After initialization users can configure the bus width and clock frequency for transfer speed according the CSD parameter of EMMC chip the transfer speed defines in CSD register just clock frequency not in high speed mode so the actual transfer speed is related to EMMC chip specification version 7 More details about SDM registers and related bits please refer to SDM interface user s manual of EMMA Mobile 1 Application Note S19904EJ1VOANO00 Chapter 2 Usage of EMMC Interface 11 65 2 2 Data Transfer EMMC 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 EMMC single block read write in CPU mode please refer to APPENDIX A EMMC Driver Function Following figure shows EMMA Mobile 1 EMMC DMA read write progress RE y Wait for EMMC not busy SDIC INFO2 14 Y Enable SDIC DMA mode SDIG CC EXT MODE v DMA init and transfer setting Note1 Start DMA EES Set sector enable and sector SDIC STOP number to be transfered SDIC SECCNT Transfer prepare Soles Send read wr
10. 0 0 pdf V0 0 EMMC chip user s manual Application Note S19904EJ1VOANO00 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
11. 2 and check whether error occur SDIC RSPO SDIC RSP1 Step6 Write data If no errors occur after send CMD24 WRITE SINGLE BLOCK write data to EMMC chip SDIC BUFO data Step7 Wait for data transfer end or error occur SDIC_INFO1 SDIC_INFO2 Step8 Send CMD13 SEND STATUS with argument RCA to check device status Detail Application Note S19904EJ1VOANO00 Chapter 3 Example of EMMC Operation 26 65 steps about check EMMC device status please refer to 3 Check EMMC Device 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 emmc single read function to read out the written data by step 2 from EMMC 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 EMMC interface is not busy check bit 14 of SDIC INFO register Step2 Enable sector setting and set sector number SDIC STOP SDIC_SECCNT Step3 Prepare for data transfer including following steps Clear interrupt information in SDIC_INFO1 register Clear all error information in SDIC INFO2 register Set transfer none stop SDIC STOP 0 0 Enable all error interrupt in SDIC INFO2 MASK register Enable read write access interrupt occur in SDIG INFO MASK register Step4 Send CMD17 READ SINGLE BLOCK with argument read a
12. 4 2 compatible feature More details about the KMCEGOOOOA please refer to its user s manual Figure 3 1 shows the connection of EMMA Mobile 1 EMMC interface and KMCEGOO00M EMMA Mobile1 KMCMEO000M DAT4 7 DAT3 DAT2 DAT1 DATO SD2_DATA3 SD2 DATA2 SD2 DATA1 SD2 DATAO y Y vv SD2 CMD e Y CMD SD2 CKO gt CLK DAT4 7 wv DAT pn DAT gt DATI DATO gt CMD gt CLK KMCMEO000M Figure 3 1 Connection between EMMA Mobile 1 and KMCEGOOO0A Application Note S19904EJ1VOANO00 Chapter 3 Example of EMMC Operation 18 65 3 2 Initialization Before EMMC operation initialization should be executed at first 3 2 1 Operation Flow RE v Init hardware interface em1_emmc_hw_init Init EMMC device em1_emmc_init Init OK Y Yes Check EMMC chip status emi emmc check dev status Yes Force erase the EMMC Y Force erase Ok be v Yes Set block size to be512Byte emi emmoc set blklength No Set block size OK p Yes v 1 End 3 Error End Jj Figure 3 2 Initialization before Test Note More details about the functions used in initialization please refer to APPENDIX A EMMC Driver Function Application Note S19904EJ1VOANO00 Chapter 3 Example of EMMC Operation 19 65 3
13. 9904EJ1VOANO00 Chapter 3 Example of EMMC Operation 20 65 out and card detection stable time Step4 Clear and mask all information and interrupt SDIC_INFO1 0x0000 SDIC_INFO2 0x0000 SDIC INFO1 MASK OxFFFF SDIC INFO2 MASK OxFFFF Step5 Set clock SDIC CLK CTRL 0x0140 divide factor 256 about 325KHz Use the lower frequency when init EMMC Delay 1ms after setting the clock frequency Step6 Send CMDO make EMMC chip to idle state including following steps Clear all error and information SDIC_INFO1 SDIC_INFO2 Enable response end interrupt occur SDIC INFO1 MASK Enable all error occur SDIC INFO2 MASK Send command SDIC CMD Wait for command send end or error occur SDIC_INFO1 SDIC INFO Check whether error occur SDIC INFO2 SDIC_RSPO SDIC RSP1 Note If command has argument setting the argument at first SDIC ARGO SDIC ARG1 Step7 Send CMD1 with argument 0x40FF8080 make EMMC chip to ready state SDIC ARGO 0x8080 SDIC_ARG1 Ox40FF Check whether power up is ready SDIC RSP1 15 If not ready send CMD1 again If in ready state run to next step Details about send command please refer to step6 Step8 All EMMC chip 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 1 Increase RCA value and circle Step8 until all the EMMC chip on the SD bus ha
14. Block Read in CPU mode Note None Application Note 19904EJ1VOANOO 51 65 APPENDIX A EMMC Driver Function 52 65 A 4 12 Single Block Write Function Name emi emmc single write Format int em1 emmc single write uint address uchar data Argument Parameter Type vo Detail address uit 1 1 block address to be write Write source data buffer Function Return DRV OK Others error end Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function 53 65 Flow Chart RE Check parameter whether data EN is NULL Wait for EMMC not busy SDIC_INFO2 14 Set sector enable and sector SDIC STOP number to be 1 SDIG SECCNT Transfer prepare m1_eme_transler prepares Send single block write command em emmc send cmo NO Send command Ok Yes Wait for write enable SDIC INFO2 heck response OK emi emmc check rsp statu Yes Write data Note1 SDIC BUFO lt No R W transfer end l Yes Clear response and r w end info Error occur NO SDIC INFO SDIC INFO2 Y Yes Check device status Clear all error info em1 emmc check dev status SDIC_INFO2 No Y 1 Normal End 3 4 Error End gt Figure A 10 Single Block Write in CPU mode Note 1 During write operat
15. E ENE EN EE EE en eee 19 3 3 Example of EMMC Single Block Read Write eese 24 Sl Operation FION ERE ER DN UU TU 24 So 2 Operation Detalle can name renner an eer EE EE name ee ne Mer ore s ce Ed 25 3 4 Example of EMMC Multi Block Operation 27 or Reegel FI t A ea 27 TENDEN 28 3 5 Example of EMMC Write Protect Operation cccccccoccccncccnnncccnononccnnnncnnonononcnnnnnnnnnnnancnnnnnnnos 29 Sweet 29 39 2 Operation Deal PP T ET 30 3 6 Example of EMMC Lock Unlock Operaton 31 361 Operation e We c 32 02 Operation Detalla eege 33 APPENDIX A EMMC Driver Function sanss xxxnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnennnnnnnnnnnnnnnn 35 AM FUNCTION LS 35 A 2 Global VENNENE PENE mv 35 ASS MATE DENE sa 36 ATTEST 36 nw Ueber T HN 37 A 4 1 Hardware Initialization Funchon esses 37 A 4 2 EMMG Int Opera case scone le dci ane ero rata dese rad non nel Reale ete eae nta ert 38 AA See NE ED 40 AAA Send Commande 41 A A aa a a aan a G 43 As 6 Ser BIOCK E Te un DEEN 44 NET SUE SAT MD p 45 Application Note S19904EJ1VOANO00 INDEX 5 65 A 4 8 Gomigurati n Extend SD 46 ARICA DC AS A M 48 Ace WO Erase FUNCHOD ass isa ince cupro titi si 49 A 4 11 Single Block Head 50 Peale Single BOK ME ae 52 A19 MUMIDIC BIOEK REST atinada lia foa atten 54 A 4 14 Multiple Block Wie 55 ARAS LOCK UNE FUNCION Te 56 AA T6 Wile
16. Format int em1 emmc wp managef int cmd uint addr Argument vo Deal gt Write protect command Address to be set write protect Function Return DRV_OK Others error end Flow Chart d Start gt Y Check whether command supported Set WP manage address SDIC ARGO SDIC ARG1 Send WP related command emi emmc send cmda No Send command OK Yse Norma 2 lt Error End b Figure A 12 Write Protect Management Note None Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function 59 65 A 4 17 Transfer Prepare Function Name emi emmoc transfer prepare Format void emi emmoc transfer prepare void Argument None Function Return None Flow Chart D All information clear SDIC INFO1 SDIC_INFO2 Y Clear stop setting bit SDIC STOP Enable all error occur SDIC INFO2 MASK y Enable R W access end SDIC INFO1 MASK ER Figure A 13 Register Prepare before Data transfer Note None Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function 60 65 A 4 18 Decode CSD Function Name _em1_emmc_decode_csd Format void emi emmc decode csd uint raw csd Argument Parameter Type VO Geet Z rawosd juint Raw CSD value buffer Function Return None Flow Chart None Note This function will decode the respo
17. NEC Electronics 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 redundanoy 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 M are not noted in this document Application Note S19904EJ1VOANO00 INDEX 4 65 CONTENTS Chapter T INTOdU CU ae 7 USES T A NE 7 12 Development Environ MEN taria lalalala ida 7 Chapter 2 Usage of EMMC SDM Interface n nxxnnnnnnnnnnnnnnnnnnnnnnnnnnnnnennnnnnnnnnnnnnnnnnnnnnnnnnnnnnennnnnnn 8 A A A 9 A TANTE LJ 11 A ETA E n a 14 2 4 Write Protect EN Te EE 15 2 5 Lock Unlock Operation 16 Chapter 3 Example of EMMC Operation rrannnnnnnnnnnnnnnnnnnnnnnnennnnnnnnnnnnennnnnnnnnnnnnnnnnnnnnnnnnnnnennnnnnn 17 3 1 Outline of EMMG OPer lonu pr 17 J SS 18 21 Operation FM 18 22 Operation BICI EE E
18. OCK 1 Locks the EMMC 0 Unlock the EMMC note that it is valid to set this bit together with SET PWD but it is not allowed to set it together with CLR PWD CLR PWD 1 Clears password PWD SET PWD 1 Set new password to PWD PWD LEN Defines the following password length in bytes Valid password length is 1 to 16 bytes PWD The password new or currently used depending on the command Following figure shows the lock unlock operation flow Start gt Y Configure EMMC lock data structure buffer Setting block length for lock unlock operation N Setting block length OK Yes Execute lock unlock command with EMMC lock data structure Command execute OK No Yes y C Normal End RK Error End gt Figure 2 4 EMMA Mobile 1 EMMC Lock Unlock Operation More details about lock unlock operation and fixed data structure please refer to Chapter 4 2 11 moviNAND Lock Unlock Operation of EMMC chip user s manual Application Note S19904EJ1VOANO00 Chapter 3 Example of EMMC Operation 17 65 Chapter 3 Example of EMMC Operation 3 1 Outline of EMMC Operation This chapter will show users how to operate EMMC chip using SDM interface On EMMA Mobile 1 evaluation board PSKCH2Y S 0016 01 the external EMMC chip is KMCEGOO000M Manufacture Samsung lts capacity is 4GB and it has multimedia card system specification Ver
19. Protect MANAGE usina di Ta Rude ocupa ak racine kne coda tst Mont oe tds 58 A 4 17 Transfer Prepare E 59 PEA AS Decode GOD as 60 AA 19 Check Response EE 61 APPENDIX B COMMANDS Sege a Fe ve ciu odo ceo ex a 62 ANNEX Modification SEENEN 65 Application Note S19904EJ1VOANO00 INDEX 6 65 LIST OF TABLES Table 1 1 Hardware Environment 7 Table 1 2 Software Environment 7 Table 2 1 Lock Unlock EMMC Data Structure An 16 Table A 1 EMMC Driver Function Uiet 35 Table A 2 Global Variable eine 35 Table A 3 Structure Den EE 36 Table A 4 Structure of Mme GN 36 Table B Command Bled BCEE 62 LIST OF FIGURES Figure 2 1 EMMA Mobile 1 EMMC Initialization ssnnrrrnrenrnnnnnnrrnvvrnrrnnnnnrrrrrnrrnnnnnerrrrennnnn 9 Figure 2 2 EMMA Mobile 1 EMMC Data Transfer in DMA Mode 11 Figure 2 3 EMMA Mobile 1 EMMC Erase Operation 14 Figure 2 4 EMMA Mobile 1 EMMC Lock Unlock Operation 16 Figure 3 1 Connection between EMMA Mobile 1 and KMCEGO0000A 17 Figure 3 2 Initialization before Test 18 Figure 3 3 EMMC Single Read Write Operation Flow ooooocccnncccncooccccnnncnnnonanccnnnnnnnnos 24 Figure 3 4 EMMC Multi block Operation Flow sese 27 Figure 3 5 EMMC Write Protect Operation low 29 Figure 3 6 EMMC Lock Unlock Operation Elow 32 Figure A 1 SDM Hardware Initialization Flow errnnnrrrrrnnnnnrorrrnnnnnrennrnnnnnrrnrnnnnnrrnnnnnnnnnen 37 Fi
20. 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 24 NE S AS 8 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 gra
21. VOANO00 Chapter 3 Example of EMMC Operation 25 65 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 data buffer which will be wrote to EMMC chip At the same time initialize the read data buffer with O it will read out data from EMMC chip for i 20 i SDM BLOCKLEN VAL i g write buff i i amp OxFF 2 Write Data to EMMC Call the emt emmc single write function to write data into EMMC chip 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 EMMC interface is not busy check bit 14 of SDIC INFO register Step2 Enable sector setting and set sector number SDIC STOP SDIC_SECCNT Step3 Prepare for data transfer including following steps Clear interrupt information in SDIC INFO1 register Clear all error information in SDIC_INFO2 register Set transfer none stop SDIC STOP 0 0 Enable all error interrupt in SDIC INFO2 MASK register Enable read write access interrupt occur in SDIG 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 EMMC device in Chapter 3 2 2 Operation Details Step5 Wait for write enable SDIC INFO
22. blocks read operation please refer to figure2 2 EMMA Mobile 1 EMMC Data Transfer in DMA Mode 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 EMMC Call em1_emmc_erase function to erase the first 2MB data area in EMMC If failed end the operation and print error if OK continue the test program Details about EMMC erase operation please refer to figure2 3 EMMA Mobile 1 EMMC Erase Operation 6 Read Data from EMMC Call em emmc multi read function to read out the first 2MB data from EMMG 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 S19904EJ1VOANO00 Chapter 3 Example of EMMC Operation 29 65 3 5 Example of EMMC Write Protect Operation In write protect operation example set write protect WP to fixed address then write data if write operation works normally it means the WP operation failed otherwise the WP operation works OK then clear the write protect for fixed address and write operation followed will works normally 3 5 1 Operation Flow S Start Y Set WP for fixed passe emi emmc wp manage Send command OK Write block E to 0x0 emi emmoc single write Write operation OK Clear WP for fixed pubem emi e
23. ddress Detail steps about send command please refer to step 6 of 2 Init EMMC device in Chapter 3 2 2 Operation Details Step5 Wait for write enable SDIC INFO2 and check whether error occur SDIC RSPO SDIC RSP1 Step6 Read data If no errors occur after send CMD17 READ SINGLE BLOCK read data from EMMC chip data SDIC BUFO Step7 Wait for data transfer end or error occur SDIC INFO1 SDIC INFO Step8 Send CMD13 SEND STATUS with argument RCA to check device status Detail steps about check EMMC device status please refer to 3 Check EMMC Device 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 S19904EJ1VOANO00 Chapter 3 Example of EMMC Operation 27 65 3 4 Example of EMMC Multi Block Operation In this example we will write fixed data 0x5A to EMMC chip 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 EMMC chip 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 lt Y Initialization data buffer Write data to EMMC first 16MB em1 emmc multi write Write operation OK ES Read data from chip first 16MB emi emmc multi read
24. difies the EXT CSD 15 8 Value r disters 7 3 Set to 0 2 0 Cmd Set Select device by its own relative address 1 16 RCA ELECT DESELE CMD7 ME iai S and gets deselected by any other address 15 0 stuff bits Tae address 0 deselects the EMMC chip The EMM hi its EXT D CMD8 31 0 stuff bits SEND EXT CSD coup canes e register as a block of data 31 16 RCA Addressed EMMC chip sends its Card END D Ge 15 0 stuff bits S Be Specific Data CSD on the CMD line 31 16 RCA Addressed EMMC chip sends its Card ID SR 15 0 stuff bits PEERS Identification CID on CMD the line CMD 1 1 Not Supported TOP TRANSMIS l oe CMD12 81 0 stuff bits SE SION Forces the EMMC chip to stop transmission CMD13 31 16 MA SEND STATUS Addressed EMMC chip sends its status 15 0 stuff bits register l A host reads the reversed bus testing data CMD14 31 0 stuff bits BUSTEST R battem from a EMMC chip 31 16 RCA GO INACTIVE ST he EMMC ch CMD15 15 0 stuff bits ATE Sets the C chip to inactive state CMD16 31 0 block SET BLOCKLEN Sets the block length in bytes for all Application Note S19904EJ1VOANO00 APPENDIX B COMMANDS 63 65 CMD17 CMD18 CMD19 CMD20 CMD21 CMD22 CMD23 CMD24 CMD25 CMD26 CMD27 CMD28 CMD29 CMD30 CMD31 CMD34 CMD35 CMD36 CMD3 CMD3 N CMD39 CMD40 CMD41 length following block commands read and write 31 0 data READ_SINGLE_BL Reads a block of t
25. eck EMMC Device Status According to the EMMC chip feature if chip has password the chip will be locked automatically after power on in order to make sure read write operation success after power on check the device status at first function em1 emmc check dev status If EMMC is locked enforce erase the whole chip by lock unlock command If enforce erase OK set block size to be 512 byte then the read and right operation followed can works normally Check device status em1 emmc check dev status including following steps Step1 Send CMD13 SEND STATUS with argument RCA Details about send command please refer to step 6 of 2 Init EMMC device in Chapter 3 2 2 Operation Details Step2 Read response value SDIC RSPO SDIC RSP1 Step3 Check whether EMMC locked and error occurred according the EMMC status structure More details about the EMMC status structure please refer to Chapter 4 9 moviNAND Status of EMMC chip user s manual 4 Enforce Erase If EMMC Device Locked If EMMC is locked enforce erase the whole chip by lock unlock command function emi emmc set blklength and em emmc lock unlock Application Note S19904EJ1VOANO00 Chapter 3 Example of EMMC Operation 22 65 a Set block length to be 1 Details about block length setting em1 emmc set blklength please refer to step13 of 2 Init EMMC device in Chapter 3 2 2 Operation Details b Set lock unlock data structure make sure the bit3 ERASE
26. er of EMMC chip the transfer speed defines in CSD register just clock frequency not in high speed mode so the actual transfer speed is related to EMMC chip specification version Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function 40 65 A 4 3 Sector Setting Function Name Gm emmc set seccnt Format void em1 emmc set seccnt BOOL bEnable uint sec num Argument Parameter Type VO Detail bEnable BOOL EE Enable disable sector Sec num uint Sector number Function Return None Flow Chart Enable the Sector SS Ensure R W Operation is Over Yes SDIC_INFO1 Enable and Configure Sector SDIC_STOP Disable Sector SDIC_SECCNT SDIC STOP Figure A 3 Sector Setting Flow Note None Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function 41 65 A 4 4 Send Command Function Name emi emmc send cmd Format int em1 emmc send cmd int cmd Argument Parameter Type UO Detail emd Im Ss Command index that need to be send Function Return DRV OK Others error end Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function Flow Chart a Start D Y Clear all information registers SDIC INFO1 SDIC INFO2 Enable all errors SDIC INFO2 MASK Enable response end error SDIC INFO1 Send command SDIC CMD v Wait until comma
27. gure A 2 EMMC Chip Initialization Elo 39 FIQUIEA 3 Sector Selina FLOW Lassa 40 Figure A 4 5end Commmand cara ii 42 Figure A 5 Set Block kenglbi uir te dedic is 44 Figure A 6 Select Card 45 Figure A 7 Gonfigure Extend COD iret E dutem dd odas deter o eee 46 Figure A 8 Check EMMC Chip Grauts 48 Figure A 9 Single Block Read in CPU mode cooccccccccocccncccccncccncccononcnnnocnnanonnnonannnnnononanennnoss 51 Figure A 10 Single Block Write in CPU mode 53 Figure A 11 Lock Unlock Progress x i oet tenet A 57 Figure A 12 Write Protect Management 58 Figure A 13 Register Prepare before Data jransler 59 Figure A 14 Check Response Gtatus 61 Application Note S19904EJ1VOANO00 Chapter 1 Introduction 7 65 Chapter 1 Introduction 1 1 Outline This document will show users how to operate EMMC chip on EMMA Mobile evaluation board The EMMC operation will use SDM interface More details about EMMC feature please refer to KMCEGO0000A S9980 4GB moviNAND 8Gb MLC Based 0 0 pdf EMMC chip user s manual please contact Samsung Electronics to get the EMMC chip user s manual 1 2 Development Environment e Hardware environment of this project is listed as below Table 1 1 Hardware Environment Name Version Meier EMMA Mobile 1 evaluation board PSKCH2Y NEC Electronics S 0016 01 PARTNER Jet ICE ARM Kyoto Microcomputer Co Ltd e Software used in this project is listed as below Table 1 2 Software Environment Version
28. he size selected by the address OCK SET_BLOCKLEN command 31 0 data READ MULTIPLE _ s BLOCK Multipile block read command A host sends the bus test data pattern to a 31 0 stuff bits BUSTEST W EMMC chip Not supported Heserved Defines the number of blocks which are SET BLOCK COU going to be transferred in the immediately succeeding multiple block read or write command 31 0 data Writes a block of the size selected by the WRITE BLOCK i i locks of il 31 0 data WRITE MULTIPLE Continuously writes blocks of data until a STOP TRANSMISSION follows or the requested number of block received 31 16 set to 0 15 0 number of blocks address BLOCK Not applicable Hu the CSD address group 31 0 data Clears the write protection bit of the address T addressed group 31 0 write SEND WRITE PR Asks the EMMC chip to send the status of rotect data l P OT the write protection bits address Heserved 31 0 data ERASE GROUP S Sets the address of the first erase group address TART within a range to be selected for erase Sets the address of the last erase group 31 0 data ERASE GROUP E within a continuous range to be selected for address ND BS g 31 0 stuff bits ERASE Erases all previously selected write blocks 31 16 RCA 15 15 register ite FI Merker TT Used to write and read 8 bit register data aliens fields 7 0 register data 31 0 stuff bits GO IRQ STATE Sets the system i
29. heck EMMC Chip Status Call emt emmc check dev status function to check EMMC status if card is not locked means lock function failed end the operation and print error otherwise continue the test program Detail steps about check EMMC device status please refer to 3 Check EMMC Device Status in Chapter 3 2 2 Operation Details 4 Unlock EMMC Call function em emmc lock unlock to unlock the EMMC chip make sure the bit2 Lock Unlock in lock unlock data structure set to O If failed end the operation and print error information if OK continue the test program 5 Check EMMC Chip Status Call em1 emmc check dev status function to check EMMC status if card is still locked means unlock function failed end the operation and print error otherwise continue the test program 6 Clear Password Call function em emmc lock unlock to clear password make sure the bit1 CLR PWD in lock unlock data structure set to 1 123 as the password contact If failed end the operation and print error information if OK continue the test program 7 Set block length to be 512 byte Before end the lock unlock test call function em emmc set blklength to set block size as 512 byte if command works OK end the test normally Application Note S19904EJ1VOANO00 Chapter 3 Example of EMMC Operation 34 65 Details about block length setting em1 emmc set blklength please refer to step13 of 2 Init EMMC dev
30. ice in Chapter 3 2 2 Operation Details Note More details about lock unlock data structure and its operation please refer to Chapter 4 2 11 moviNAND Lock Unlock Operation of EMMC chip user s manual More details about the functions used in this example please refer to APPENDIX A EMMC Driver Function Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function 35 65 APPENDIX A EMMC Driver Function A 1 Function List The following table shows the EMMC driver interface functions Table A 1 EMMC Driver Function List External function Multi block write operation in DMA mode Lock unlolck operation uw ucc A 2 Global Variable Define Table A 2 Global Variable Define Name Tyme Del g RCA VAL Globle flag for relative address g password buff Password data structure buffer g read buffl Read buffer g write buff Write buffer Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function 36 65 A 3 Structure Define Table A 3 Structure Define Structure Name 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 ciks Head access time in clocks uint tacc_ns uint max dtr uint read blkbits uint read blkbits uint capacity uint erase grp size uint erase grp mult uint wp grp size uint read partia uint read misalign Whether enable read block cross physical block boundaries u
31. ils about send command please refer to step 6 of 2 Init EMMC device in Chapter Application Note S19904EJ1VOANO00 Chapter 3 Example of EMMC Operation 23 65 3 2 2 Operation Details 5 Set Block Size after Enforce Erase After enforce erase in order to make sure the read and right operation followed can works normally set block size to be 512 byte function em1 emmc set blklength Details about block length setting em1 emmc set blklength please refer to step13 of 2 Init EMMC device in Chapter 3 2 2 Operation Details Note The EMMA Mobile 1 SDM interface can support 512 byte as the maximum block size Application Note S19904EJ1VOANO00 Chapter 3 Example of EMMC Operation 24 65 3 3 Example of EMMC Single Block Read Write In this example we will write fixed data to EMMC chip 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 NL Y Initialization data buffer Write data to EMMC emi emmoc single write y Write operation OK Read data from EMMC emi emmoc single read Yes Check data data right No gt Yes Z Normal End 6 Error End gt Figure 3 3 EMMC Single Read Write Operation Flow More details about the functions used in this example please refer to APPENDIX A EMMC Driver Function Application Note S19904EJ1
32. in 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
33. int write partial Whether enable write in partial block uint write misalign Whether enable write block cross physical block boundaries Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function A 4 Function Details A 4 1 Hardware Initialization Function Function Name em1_emmc_hw_init Format void em1_emmc_hw_init void Argument None Function Return None Flow Chart Start D Y Power on Clock and Reset setting about SDM module ASMU_GCLKCTRL4ENA ASMU_GCLKCTRL4 Switch GPIO to SD function and Setting pull up pull down for SD ASMU_RESETREQ3 ASMU_RESETREQ3ENA CHG PINSEL G80 Note Wait Read Driver ability and Auto frequency configuration CHG_PINSEL_G112 CHG_PULL_G112 ASMU AB1 SDICWAITCTRL ASMU AB1 SDICREADCTRL B C CHG DRIVE1 ASMU AUTO FRQ MASK3 Figure A 1 SDM Hardware Initialization Flow Note 1 Switch GPIO which used for EMMC to SD function users should operate this step according the actual hardware connection Application Note S19904EJ1VOANO00 37 65 APPENDIX A EMMC Driver Function A 4 2 EMMC Init Operation Function Name Gm emrmoc init Format int em1 emmec init void Argument None Function Return DRV OK Others error end Flow Chart Application Note S19904EJ1VOANO00 38 65 APPENDIX A EMMC Driver Function 39 65 Start P gt Sof
34. ion check SDIC INFO2 if buffer write access error occur end the write operation and return with error information Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function 54 65 A 4 13 Multiple Block Read Function Name emi emmc multi read Format int em1 emmc multi read uint address uchar read buf uint blk num Argument Parameter Tyme lO Detail address uint block address to be read read out data buffer bik num uin LL block number to be read Function Return DRV OK Others error end Flow Chart Please refer to figure2 2 EMMA Mobile 1 EMMC Data Transfer in DMA Mode in chapter 2 2 Data Transfer Note None Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function 55 65 A 4 14 Multiple Block Write Function Name em emmc multi write Format int em1 emmc multi write uint address uchar write buf uint Dk num Argument Parameter Type lO Detail address wint block address to be write 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 EMMC Data Transfer in DMA Mode in chapter 2 2 Data Transfer Note None Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function 56 65 A 4 15 Lock Unlock Function Function Name emi emmc lock unlock Format int em1 emmc loc
35. ion Detail 3 Clear WP for 0x0 Address Send CMD28 CLR WRITE PROT to EMMC function em1 emmc wp manage with address 0x0 if command send failed print error and end test otherwise continue the test Details about Write protect management please refer to 1 Set WP to 0x0 Address 4 Write Data to EMMC Setting parameters about the data transfer call the em emmc single write function to write block data into 0x0 in EMMC chip Check the write operation if OK means WP test operation works OK otherwise the WP test failed Application Note S19904EJ1VOANO00 Chapter 3 Example of EMMC Operation 31 65 3 6 Example of EMMC Lock Unlock Operation In lock unlock example set password for EMMC at first then lock the device check EMMC status if EMMC is not locked means lock operation failed otherwise lock works OK then unlock the device and read the EMMC status again to check the unlock operation Note In this test use 123 as the password and before end the lock unlock test in order not to affect other tests should clear the password and restore the block size 512 byte Application Note S19904EJ1VOANO00 Chapter 3 Example of EMMC Operation 3 6 1 Operation Flow RE Y Set password before lock em1 emmc set qutbus em emmc lock unlock Password set OK Lock the EMMC EN emi emmc lock unlock Lock operation OK Check mum Se status em1 em
36. ite command NO DMA transfer end Note4 Yes SDIC INFO1 2 R W transfer end Yes No Check whether error occuer SDIC INFO here is still data y SIC NES to be transfer i DIC INFO Clear transfer info and disable SDIC INFO2 Yes e em SDIC CC EXT MODE Disable sector SDIC STOP Resetting DMA transfer parameter i p i Check EMMC chip status Note5 Restart DMA for the left data Y End D Figure 2 2 EMMA Mobile 1 EMMC Data Transfer in DMA Mode Note 1 In DMA init and transfer setting step user should reset DMA channel open DMA clock clear DMA interrupt source set transfer parameter for DMA Application Note S19904EJ1VOANO00 Chapter 2 Usage of EMMC Interface 12 65 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 DMA P2M PEO LCH4LCH7 INT REQ CL DMA P2M DSP LCH4LCH7 INT REQ CL M2P Clear DMA interrupt source related register DMA M2P PEO LCH4LCH7 INT REQ CL DMA M2P DSP LCHALCH7 INT REQ CL P2M DMA transfer setting related register DMA P2M LCH5 AADD DMA P2M LCH5 BADD DMA P2M LCH5 BOFF DMA P2M LCH5 BSIZE DMA P2M LCH5 BSIZE COUNT DMA P2M LCH5 LENG DMA P2M LCH5 MODE M2P DMA transfer setting related register DMA M2P LCH5 BADD DMA M2P LCH5 AADD DMA M2P LCH5 AOFF DMA M2P LCH5 ASIZE DMA M2P LCH5 ASIZE COUNT DMA M2P LCH5 LENG DMA M2P LCH5 MODE 2 Start DMA transfer P2M
37. k unlock uchar data Argument Parameter Type VO Detail data juchat 1 Lock data structure buffer Function Return DRV_OK Others error end Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function 57 65 Flow Chart RE Check parameter Whether buffer is null Wait for EMMC not busy SDIC INFO2 14 Set sector enable and sector SDIC STOP number to be 1 SDIG SECCNT Y Transfer prepare Send lock unlock command emi emmc send cmd No Send command Ok Yes Wait for write enable SDIC_INFO2 heck response OK em1_emmc_check_rsp_statu Yes Get the data transfer length SDIC_Size Write data SDIC_BUFO O R W transfer end B Yes Clear response and r w end info rror occur SDIC INFO1 SDIC INFO2 Y Yes Check device status Clear all error info em emmc check dev status SDIC INFO2 romer 20 e No Vv C Normal End gt C Error End P Figure A 11 Lock Unlock Progress Note 1 During write operation check SDIC INFO2 if buffer write access error occur end the write operation and return with error information Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function 58 65 A 4 16 Write Protect Manage Function Name emi emmc wp manage
38. mc check dev status EMMC chip is Locked Unlock the EOS chip emt emmc lock unlock Unlock operation OK Yes Check EMMC chip status em1 emmc check dev status MMC chip is unlocked Clear password eem quit test emt emmc lock unlock No Password clear OK Yes Restore block size 51 pal emi emmoc single read Command send OK v Norma ED C Error End P Figure 3 6 EMMC Lock Unlock Operation Flow Application Note S19904EJ1VOANO00 32 65 Chapter 3 Example of EMMC Operation 33 65 3 6 2 Operation Detail 1 Set Password before Lock Call function em emmc set biklength and emi emmc lock unlock to set password before lock the chip before send command to EMMC setting the lock unlock data structure and make sure the bit0 SET PWD in lock unlock data structure set to 1 If failed end the operation and print error information if OK continue the test program In this test use 123 as the password contact Note Details about execution of lock unlock function please refer to 4 Enforce Erase If EMMC Device Locked of Chapter 3 2 2 Operation Details 2 Lock EMMC Call function em emmc lock unlock to lock the EMMC chip make sure the bit2 Lock Unlock in lock unlock data structure set to 1 If failed end the operation and print error information if OK continue the test program 3 C
39. mmc wp manage Send command OK Write block data to OxO ee emi emmoc single write Write operation OK y C Normal End ey d Error End D Figure 3 5 EMMC Write Protect Operation Flow More details about the functions used in this example please refer to APPENDIX A EMMC Driver Function Application Note S19904EJ1VOANO00 Chapter 3 Example of EMMC Operation 30 65 3 5 2 Operation Detail 1 Set WP to 0x0 Address Send CMD28 SET WHITE PROT to EMMC function em1 emmc wp manage with address 0x0 if command send failed print error and end test otherwise continue the test Write protect management m1 emmc wp manage including following steps Step1 Check whether the command is supported Step2 Send command CMD28 CMD29 SET WRITE PROT CLR WRITE PROT with the argument write protect unit based on unit of WP GRP SIZE Detail steps about send command please refer to step 6 of 2 Init EMMC device in Chapter 3 2 2 Operation Details 2 Write Data to EMMC Setting parameters about the data transfer call the em emmc single write function to write block data into 0x0 in EMMC chip Check the write operation if OK means WP operation failed end the operation and print error information if OK continue the test program Details about EMMC single write operation please refer to 2 Write Data to EMMC of Chapter 3 3 2 Operat
40. nd send end Yse No Response end Yse SDIC INFO NO No Error occur SDIC INFO2 Yse d Read the error information register SDIC INFO2 eet Clear response end information SDIC INFO1 Clear all error information SDIC INFO2 Norma 2 kb C Error End gt Figure A 4 Send Command Note Send command to EMMC chip Application Note S19904EJ1VOANO00 42 65 APPENDIX A EMMC Driver Function 43 65 A 4 5 Set Clock Function Name em1_emmc_set_clk Format void em1_emmc_set_clk ushort value Argument Parameter Type UO Detail value ushort _ Clock setting value Function Return None Flow Chart None Note Set SDIx_CLK_CTRL register Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function 44 65 A 4 6 Set Block Length Function Name emi emmc set blklength Format int em emmc set blklength ushort length Argument Parameter Type VO Detail length lushot gt Block length setting value Function Return DRV OK Others error end Flow Chart C Start P Y Command parameter setting SDIC ARGO SDIC ARG1 Send CMD16 to set block length em emmc send cmdad Send command OK N Yse Set block size SDIC SIZE y Y Norma 2 1 Error End E Figure A 5 Set Block Length
41. nse of SEND CSD command get CSD members that useful for data transfer Application Note S19904EJ1VOANO00 APPENDIX A EMMC Driver Function A 4 19 Check Response Status Function Name emi emmc check rsp status Format int em1 emmc check rsp status void Argument None Function Return DRV OK DRV ERR STATE Flow Chart R gt Read response value SDIC_RSPO and SDIC_RSP1 Y Check whether error occur E NO Norma 2 4 Error End gt Figure A 14 Check Response Status Note None Application Note S19904EJ1VOANO00 61 65 APPENDIX B COMMANDS 62 65 APPENDIX B COMMANDS Following table shows the simple function of the EMMC chip command which used in this document More details about the commands format and function please refer to Chapter4 6 Commands of the EMMC chip user s manual Table B 1 Command Description List CMD l e INDEX Argument Abbreviation Command Description CMDO 81 0 stuff bits GO IDLE STATE Resets the EMMC chip to idle state 1 H Ask chi i i iti CMD1 S 0 OC SEND OP COND S ip send its Operating Conditions without busy Register contents Asks the EMMC chi its CID STEEN EE EE PP OS CIP number on the CMD line 31 16 RCA SET RELATIVE A CMD3 Lie e bits Assigns relative address to the EMMC chip CMD4 Not Supported CMD5 31 26 Set to 0 E Switches operation mode of the selected CMD6 SWITCH EMMC chip or mo
42. nted 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 bu
43. nto interrupt mode Application Note S19904EJ1VOANO00 APPENDIX B COMMANDS 64 65 Used to set reset the password or lock unlock the EMMC chip The size of the MD42 1 ff bits LOCK UNLOCK Eer FORENE a baek isee rie ET BLOCK TEN command sa Reserved CMD54 CMD56 CMD59 Application Note S19904EJ1VOANO00 ANNEX Modification History 65 65 ANNEX Modification History Application Note S19904EJ1VOANO00
44. of the lock unlock data structure to be 1 and execute lock unlock function More details about lock unlock operation and fixed data structure please refer to Chapter 4 2 11 moviNAND Lock Unlock Operation of EMMC chip user s manual Lock unlock function em1 emmc lock unlock including following steps Step1 Ensure EMMC interface is not busy check bit 14 of SDIC INFO register Step2 Enable sector setting and set sector number to 1 SDIC STOP SDIC_SECCNT Step3 Prepare for data transfer including following steps Clear interrupt information in SDIC INFO1 register Clear all error information in SDIC INFO2 register Set transfer none stop SDIC STOP 0 0 Enable all error interrupt in SDIC INFO2 MASK register Enable read write access interrupt occur in SDIC INFO1 MASK register Step4 Send CMD42 LOCK UNLOCK without argument Details about send command please refer to step 6 of 2 Init EMMC device in Chapter 3 2 2 Operation Details otep5 Wait for write enable SDIC INFO2 and check whether error occur SDIC RSPO SDIC RSP1 Step6 Write data If no errors occur write data lock unlock data structure to EMMC chip SDIC BUFO data Step7 Wait for data transfer end or error occur SDIC_INFO1 SDIC INFO Step8 Send CMD13 SEND STATUS with argument RCA to check device status Detail steps about check EMMC device status please refer to 3 Check EMMC Device Status in Chapter 3 2 2 Operation Details Note Deta
45. s get a RCA from host at this time response time out error will occur run to next step 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 SDIC RSPO SDIC RSP7 Step10 Select EMMC chip Application Note S19904EJ1VOANO00 Chapter 3 Example of EMMC Operation 21 65 Send CMD7 SELECT with argument RCA which selected to communicate Details about send command please refer to step6 Step11 Re setting clock SDIC CLK CTRL 0x0301 divide factor 4 about 20 8MHz Use higher frequency after init EMMC Delay 1ms after setting the clock frequency Step12 Setting extends CSD register including following steps Send CMD6 SWITCH with argument 0x03B70100 bus width 4 bits to configure extends CSD register Change bus width in SDIC OPTION register Send CMD6 SWITCH with argument 0x03B90100 high speed to configure extends CSD register Details about send command please refer to step6 Step13 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 SDIC_SIZE register More details about the initialization progress please refer to APPENDIX A EMMC Driver Function 3 Ch
46. start register DMA P2M CONT M2P start register DMA M2P CONT Application Note S19904EJ1VOANO00 Chapter 2 Usage of EMMC Interface 13 65 3 Before data transfer clear all information register make sure data transfer end enable the related interrupt Related register SDIC_INFO1 SDIC_INFO2 SDIC_INFO1_MASK SDIC_INFO2_MASK SDIC_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 EMMC status register info check whether error occurred Related register SDIC_ARGO SDIC_ARG1 SDIC_CMD SDIC_RSPO SDIC_RSP1 SDIC INFO SDIC INFO2 SDIC INFO1 MASK SDIC INFO2 MASK More details about EMMC status register information please refer to Chapter 4 9 moviNAND Status of the EMMC chip user s manual Application Note S19904EJ1VOANO00 Chapter 2 Usage of EMMC Interface 14 65 2 3 Erase Following figure shows EMMA Mobile 1 EMMC erase progress 1 otart D Y Send CMD 35 for erase group Note 1 start setting Send command OK Yes Send CMD 36 for erase group end setting N Send command OK Yes Send CMD 38 to execute erase operation Send command OK No Yes Y Normal End D Error End gt Figure 2 3 EMMA Mobile 1 EMMC Erase Operation Note 1 Parameter about CMD 35 CMD36 will be the address
47. t Renesas 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 eq
48. to start and end and the address will be in Group erase unit more details about erase operation and meaning of erase group unit please refer to Chapter 4 2 9 Erase and Chapter 4 10 Memory Array Partitioning of EMMC chip user s manual Application Note S19904EJ1VOANO00 Chapter 2 Usage of EMMC Interface 15 65 2 4 Write Protect Management Write protect WP management including there command set write protect CMD 28 clear write protect CMD 29 and send write protect info CMD30 To realize these functions users just need to send command to EMMC device The write protect argument is WP address it based on unit of WP GRP SIZE which is defined in CSD register More details about write protect function and meaning of WP GRP SIZE please refer to Chapter 4 2 10 Write Protect Management and Chapter 4 10 Memory Array Partitioning of EMMC chip user s manual Application Note S19904EJ1VOANO00 Chapter 2 Usage of EMMC Interface 16 65 2 5 Lock Unlock Operation Lock Unlock operation including password setting and cancel lock unlock EMMC device and enforce erase To complete these function please follow the fixed data structure format as followed Table 2 1 Lock Unlock EMMC Data Structure Byte Bit7 Bit6 Bits Bit4 Bits mm Biti Bito Reserved PWD LEN CA MNENE NEN Password data PWD LE N 1 ERASE 1 Forced Erase Operation all other bits shall be 0 and only command byte is sent LOCK UNL
49. tware reset SD SDIx SOFT RST Setting bus width and response time out value SDIC OPTION Note SDIC INFO SDIC INFO Clear and mask all info SDIC INFO1 MASK SDIC INFO2 MASK Y Enable and setting clock in low frequency Send CMD 0 setting EMMC device into idle state SDIC CLK CTRL Note2 SDIC CMD Note3 SDIC ARGO Send commana 1 setting device SDIC ARG into state SDIC_CMD Get CID info CMD 2 and setting relative address CMD 3 for all devices in bus Get CSD info from device CMD 9 y Select device CMD 7 y Setting clock to higher frequency Note4 Setting transfer bus width and speed n 6 Set block size CMD 16 Y CTO Figure A 2 EMMC Chip Initialization Flow Note 1 Before the initialization of EMMC device set the bus width to be 1bit and the response time out value to be maximum reason is in EMMC 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 paramet
50. uipment 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 certa

Download Pdf Manuals

image

Related Search

Related Contents

TELEVISOR LCD ESTIMADO CLIENTE ÍNDICE  カタログ(CNO:339f)  Mode d`emploi pour remplir le fichier Excel relatif  Digitus CAT 7 S-FTP 100m  ADL110 User Manual  ITALIANO  Previous VxWorks Report  soft start dc ac power inverters libretto dell`utilizzatore  

Copyright © All rights reserved.
Failed to retrieve file