Home
EEPROM Emulation Library 32-/16-bit Single
Contents
1. 48 5 2 Service Functions cler e er Rx MR ER ee ace arii RR a 49 5 2 1 Check free section 5 49 5 22 Getthe erase 49 5 2 8 Getthe EEELib version 49 Users Manual U18398EE1VOUMOO 7 Figure 2 1 Figure 2 2 Figure 2 3 Figure 2 4 Figure 2 5 Figure 2 6 Figure 2 7 Figure 2 8 Figure 2 9 Figure 2 10 Figure 2 11 Figure 2 12 Figure 2 13 Figure 2 14 Figure 2 15 Figure 2 16 Figure 2 17 Figure 3 1 List of Figures Data Set Representation O 11 Invalidation Data Set mmm nana nana aa 12 Encapsulated Data o ironie e a E a AA RA nea n nnne rennen 12 EEPROM Emulation Sections in the Flash cena nenea nana 13 EEPROM Emulation Section Overview nene nenea neam aaa 14 Section Header se zarea eee aaa a a ideni pa ta i at 15 Prepare Operation Flow eee 17 Write Data Set Operation 1 aaa 18 Read Operation Flow nana nana nana aaa 19 Refresh Operation Flow na 20 Refresh Section Sub Flow cn nano cn nonn coran nana na 21 Format Operation Flow nenea nn ana ana na 22 Ensure Consistency Step 1 FloW
2. 32 Chapter 3 Emulation Library Structure 33 3 1 Layer Model noi AANA ONA EAA ENAA AAA ERA ad ss w ae Eine e 33 3 1 1 Flashcontrolhardware cn tenes 33 3 1 2 Data Flash layer orroa teeren ENA E E EEEE DEN 34 3 1 3 EEPROM emulation 34 Chapter 4 Emulation Library 35 4 1 User Function Execution During EEPROM Emulation 35 4 1 1 EEELib handler function execution options 35 41 2 A NN 36 4 2 Library Software tt 4 E EE mai aaa E e 36 4 2 1 Supported compilers cae 36 4 2 2 Library delivery 37 4 2 3 Configuration ira Sap air 39 4 3 Section Handling 0 0 eee eee eee eee hh nnn 41 4 4 MISRA 42 Chapter 5 Emulation Library 43 5 1 Operational lt 5 43 5 1 1 Command structure aa 44 5 1 2 State machine 45 5 1 3 Operation initiation cias u rn 45 5 1 4 State machine 48 5 1 5
3. request error EEE_DRIVER_BUSY 1 EEE_ERR_FLOW 1 EEE_ERR_OPERATION_REJECTED 1 EEE_OK 2 ERR_USERABORT 2 EEE_ERR_FLASH_ERROR 2 e Refresh required parameters request command EEE_CMD_REFRESH return See 5 1 Used Types on page 29 request error EEE_DRIVER_BUSY 1 EEE_ERR_FLOW 1 EEE_ERR_OPERATION_REJECTED 1 EEE_OK 2 EEE_ERR_USERABORT 2 EEE_ERR_POOL_FULL 2 EEE_ERR_FLASH_ERROR 2 Write required parameters request command EEE_CMD_WRITE request address Source address of the Write operation request identifier Identifier of the data set to be written in bytes request length Length of the data set to be written The write granularity is 4 Bytes for Data Flash Length 0 defines an invalidation data set See 3 3 7 Invalidation of data sets on page 18 return See 5 1 Used Types on page 29 request error EEE_DRIVER_BUSY 1 EEE_ERR_PARAMETER The write granularity of 4 Bytes on Data Flash responsible 8 Bytes for Code Flash is not met or the ID is 0x0000 or gt OxFFFE 1 EEE_ERR_FLOW 1 EEE_ERR_OPERATION_REJECTED 1 EEE_OK 2 EEE_ERR_USERABORT 2 EEE_ERR_SECTION_FULL 2 EEE_ERR_FLASH_ERROR 2 32 User s Manual U18398EE1VOUMOO Chapter 5 Emulation Library API Read required parameters request command EEE CMD READ request address Destination address of the Read operation The data set part is copied here request identifier Identifier of the data set to be read
4. NEC User s Manual EEPROM Emulation Library 32 16 bit Single Chip Microcontroller Document No U18398EE1VOUMO0 Date Published September 2006 NEC Electronics Corporation 2006 Printed in Germany NOTES FOR CMOS DEVICES VOLTAGE APPLICATION WAVEFORM AT INPUT PIN Waveform distortion due to input noise or a reflected wave may cause malfunction If the input of the CMOS device stays in the area between Vu MAX and Vin MIN due to noise etc the device may malfunction Take care to prevent chattering noise from entering the device when the input level is fixed and also in the transition period when the input level passes through the area between ViL MAX and Vin MIN HANDLING OF UNUSED INPUT PINS Unconnected CMOS device inputs can be cause of malfunction If an input pin is unconnected it is possible that an internal input level may be generated due to noise etc causing malfunction CMOS devices behave differently than Bipolar or NMOS devices Input levels of CMOS devices must be fixed high or low by using pull up or pull down circuitry Each unused pin should be connected to Voo or GND via a resistor if there is a possibility that it will be an output pin All handling related to unused pins must be judged separately for each device and according to related specifications governing the device PRECAUTION AGAINST ESD A strong electric field when exposed to a MOS device can cause destruction of the gate oxide and ultimate
5. Start up2 Note All measurements are done with 16 kBytes section size User s Manual U18398EE1VOUMOO MEMO 38 User s Manual U18398EE1VOUMOO
6. When set the active marker or the consumed marker have the value 0x55555555 The value of a marker which is cleared is OXFFFFFFFF Blank Word The meaning of the section header information is described below Please referto 3 5 Basic Flow on page 19 2 Data zone The data zone contains the data sets New data sets are simply appended by the EEELib after the last written data set So the data zone grows down in the address space The section is full and a Refresh is required as soon as there is not enough erased space between ID zone and Data Zone last written address for the data set to be written That Hefresh can be performed at any time when the free Data Zone space is under a certain user defined limit That limit can be inspected by a service function of the EEELib that allows to check the remaining space in the data zone 3 ID zone The ID zone is a list of IDs of the data sets written to the section so far The ID list is dynamically gener ated during writing new data sets into the section An ID List is required in order to simplify and to speed up the processing The solution to keep the ID list dynamically in the EEPROM Emulation Flash space instead of keeping it statically in code the Flash area has been chosen in order to allow new added applications to store data sets with new IDs The ID zone grows in case of writing new data sets with new IDs User s Manual U18398EE1VOUMOO 15 Chapter 3 Emulation Strategy 3
7. nana nana 24 Ensure Consistency Step 2 Flow mmm nana aaa 26 Ensure Section Consistency Sub Flow a 27 Ensure ID Consistency Sub Flow nana amana ana aa 28 Options for Data Flash Initialisation mn eee nn 29 EEPROM Emulation Layer Model nenea nana nana 33 User s Manual U18398EE1VOUMOO Chapter 1 Overview This User s Manual describes the usage of NEC s EEPROM emulation library EEELib featuring EEPROM emulation on NEC s microcontroller with embedded single voltage data flash The present document describes the higher layer structure of the NEC s EEPROM emulation approach whereas the lower layer DFALib is described in a separate document The EEELib realises the emulation related features such as data set handling fail safe functionality start up handling and call of the DFALib 1 1 Naming Conventions Certain terms required for the description of the Flash and EEPROM emulation are long and too com plicated for good readability of the document Therefore special names and abbreviations will be used in the course of this document to improve the readability Background Section Section of the EEPROM emulation that is currently not holding valid data and is not used for any operation Data Flash Data flash is a separate flash macro on the device Due to its implementation the dual operation is supported That means code operation in the code flash while the
8. 7F No 363 Fu Shing North Road Taipei Taiwan R O C Tel 02 8175 9600 http www tw necel com NEC Electronics Singapore Pte Ltd 238A Thomson Road 12 08 Novena Square Singapore 307684 Tel 6253 8311 http www sg necel com G06 8A All other product brand or trade names used in this pamphlet are the trademarks or registered trademarks of their respective owners Product specifications are subject to change without notice To ensure that you have the latest product data please contact your local NEC Electronics sales office User s Manual U18398EE1VOUMOO The information in this document is current as of September 2006 The information is subject to change without notice For actual design in refer to the latest publications of NEC Electronics data sheets or data books etc for the most up to date specifications of NEC Electronics products Not all products and or types are available in every country Please check with an NEC Electronics sales representative for availability and additional information 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 p
9. data flash is being operated e g write or erase Additionally the ID Tag is supported that allows a hardware supported search DFALib DFALib is the short form for Data Flash access library EEELib EEELib is the short form of EEPROM emulation library Flash Environment This is device internal hardware charge pumps sequencer required to do any Flash program ming It is not continuously activated only during Flash modification operations Activation and deactivation is done implicitly by the DFALib Foreground Section The active section of the EEPROM emulation that is currently holding valid data and is not used for any operation such as read or write 1 2 Limitations e During data flash operation no power safe mode should be applied as it will leave the flash in an undefined state when the clock is stopped For details on the power safe modes please refer to the appropriate chapter of the device UM e The EEELib in combination with the DFALib is only to be used on the device series this UM appen dix is related to For other usage NEC Electronics can not take any reliability Caution Please read all chapters of the users manual carefully and follow exactly the given sequences and recommendations This is required in order to make full use of the high level of security and safety provided by the devices User s Manual U18398EE1VOUMOO 9 MEMO 10 User s Manual U18398EE1VOUMOO Chapter 2 Emulation Library S
10. normal operation on data Flash a background hardware does the search operation here the CPU jumps from data set to data set to find the latest data So the timing is different and the CPU is loaded to 100 during the Read operation In case of a preceding interrupted Refresh for writing emergency data followed by a RESET and Start up1 the written emergency data cannot be read as the Read operates on the elder section in case of detection of the interrupted Refresh So it cannot be assured that emergency data can be read in this phase Possibility to read these is given after Start up2 phase User s Manual U18398EE1VOUMOO lt 4 gt lt 5 gt Chapter 3 Emulation Strategy Early required data sets are read This phase should be handled during the device initialisation phase and or the device operational phase See below Status as lt 3 gt User application actions The Start up2 operation is executed Conditions The Start up2 operation requires a long execution time As the long lasting operations are exe cuted by the Flash hardware in background the CPU load is low Up to the given user application conditions this phase may be started and handled Call the Han dler function see during the device initialisation phase if enough time is given Another option is to start the Start up2 operation in the device initialisation phase one long last ing operation is executed in background and to call the handler in the device ope
11. request length Number of bytes to read request offset Offset within the data set to read Together with length information this is used to read data set fragments return See 5 1 Used Types on page 29 request error EEE DRIVER BUSY 1 EEE ERR PARAMETER data set length request length request offset 1 EEE ERR FLOW 1 EEE ERR OPERATION REJECTED 1 EEE OK 2 EEE ERR READ UNKNOWNID 2 EEE ERR READ OBSOLETE 2 EEE ERR USERABORT 2 Format required parameters request command EEE CMD FORMAT return See 5 1 Used Types on page 29 request error EEE DRIVER BUSY 1 EEE ERR OPERATION REJECTED 1 EEE EEE OK 2 EEE ERR USERABORT 2 EEE ERR FLASH ERROR 2 Other commands Other commands are not available an error is returned request command Any other unknown command number return See 5 1 Used Types on page 29 request error ERR COMMAND UNKNOWN 1 User s Manual U18398EE1VOUMOO 33 Chapter 5 Emulation Library API 5 2 3 State machine handler Function prototype void EEELib_Handler void Required parameters The request structure previous passed to the function EEELib_Execute is used Return value The request structure previous passed to the function EEELib_Execute is modified request error Values as described in 5 1 Used Types on page 29 Function Description Handles the EEELib state machine and forwards the states Notes 1 Depending on the definition for the handl
12. write ID search In case of an emergency the time for finishing the operation is not given but some emergency data must be written So the operation are aborted at appropriate state ID search is just stopped Flash erase during a prepare operation is stopped resulting in an invalid background section A later prepare fixes this A special case is the Write operation This operation can not be directly interrupted as it would lead the active section in an undefined state The data set Write operation can be aborted until writing the Top ID L has started After that point of time the operation is finished as this is faster than the abort procedure Abort is done by finishing writing the current data word then writing an invalid top ID and an invalid bottom ID This data set is then invalid but the overall data set structure is still consistent This kind of abort is called data encapsulation as invalid data is encapsulated by ID L s indicating invalid data Figure 3 6 Encapsulated still erased Data Erased Flash Data Bottom ID L ID Tag 18 User s Manual U18398EE1VOUMOO Chapter 3 Emulation Strategy 3 4 Data Flash Interrupt In polling mode the EEELIb_Handler is frequently called by the application With support of the device specific interrupt upon data flash operation completion that frequent call to the EEELib_Handler is not necessary as the EEELib_Handler has to be called in the interrupt c
13. 2 Data Set Representation in the Flash A data set is always embraced by a word containing ID and length information on the top and on the bottom This word is called ID L words furtheron Figure 3 4 Data Set Representation Top ID L Data Bottom ID L ID Tag The implemented NEC Data Flash is 33 bit wide The 33 rd bit is called the ID Tag indicating that the word contains internal information and is not part of the data set itself The current implementation in the EEPROM emulation layer sets this on the bottom ID L while keeping it un set on the data bits and on the top ID L Dedicated hardware on the data Flash macro can search for a certain ID in the ID L words by using this ID Tag in background while code execution from code flash continues Note Usage of the IDs OxFFFF and 0x0000 for normal data sets is not allowed as these IDs are used for special emulation strategy internal purposes 3 3 Basic Operation 3 3 1 Startup1 2 operation For details on the Startup and Startup2 phase please refer to 3 6 Init Phase on page 21 3 3 2 Refresh operation The Refresh operation is used to copy the latest data sets of all valid IDs from a full Flash section to a prepared Flash section and to activate this section for subsequent Read and Write operations Once the refresh operation is called the previously prepared section becomes active and the previ ously active section becomes inactive All following read write o
14. R_SECTION_FULL A Refresh operation is required EEE_ERR_POOL_FULL A Refresh operation failed as the background section is not prepared EEE ERR COMMAND UNKNOWN unknown command has been passed to the EEELib A Flash operation of the DFALib called by EEELib failed due to a Flash problem EEE_ERR_FLASH_ERROR The last operation has been aborted Only applicable in case of user status check EEE_ERR_USERABORT EEE_ERR_READ_UNKNOWNID A Read operation did not find a data set with the requested ID The data set with the ID is marked invalid The data is not read instead the error is returned EEE_ERR_NOACTIVESECTION This error is returned in case of unformatted Flash During startup an operation that is not allowed according to the EEELib initialisation status was called EEE_ERR_READ_OBSOLETE EEE_ERR_FLOW A new operation is tried to be initiated although the state machine is still EEE ERR_OPERATION_REJECTED busy Only applicable in case of user status check address identifier length offset These parameters are individually used by the different operations See operations description 5 2 Operational Functions EEPROM operation is controlled by an EEELib internal state machine The operations are initiated by the function EEELib_Execute The function EEELib_Handler controls the state machine after operation initiation and forwards the states The handler function is called by the user applic
15. This is the space between the end of the data zone and the end of the ID zone 5 3 2 Get the erase counter Function prototype tEEE ERROR EEELib GetEraseCounter u32 eraseCnt Required parameters eraseCnt pointer to the variable that shall receive the erase counter information Return value EEE OK The operation finished successfully EEE DRIVER BUSY The EEELib state machine is busy the size information could not be calculated Function Description This function reads the erase counter of the EEPROM emulation sections 5 3 3 Get the EEELib version Function prototype u32 EEELib LibVersion void Required parameters Return value EEELib version as decimal number Function Description This function returns the EEELib version as decimal number User s Manual U18398EE1VOUMOO 35 MEMO 36 User s Manual U18398EE1VOUMOO Chapter 6 Electrical Specification Timing Characteristics Ta 40 to 125 C Vpp EVpp BVpp 4 0 AVpero lt 5 5 V Ves EVss BVss AVss 0 V C 50 pF fxx 48 MHz Parameter Conditions 4 Bytes 8 Bytes 12 Bytes 16 Bytes 24 Bytes 28 Bytes 32 Bytes 64 Bytes 128 Bytes Last 64 First 64 Last 4 Read Read by SW Prepare 11D 10 IDs 20 IDs 40 IDs Number of IDs 0 Fill ratio O Number of IDs 10 Fill ratio 0 6 Number of IDs 0 Fill ratio O Number of IDs 10 Fill ratio 0 6 Refresh Start up1
16. WRITE my EEE Command identifier 10 my EEE Command length 8 Set up Calling Structure my EEE Command address pData E g EEELib Execute amp my EEE Command Call EEELib Execute Calling End structure error return error EEELIB_OK Place user code execution here E g EEELib Handler Call EEELib Handler Calling structure error EEELIB_BUSY Calling structure error EEELIB_OK End return error End return OK User s Manual U18398EE1VOUMOO 25 Chapter 4 Emulation Library Usage 4 1 2 User Interrupts Any interrupt function can be executed at any time even when operation on the data flash is active As the code Flash is accessible during data flash operation e g erase or write also the interrupt vector table is available 4 2 Library Software The EEELib is delivered as a pre compiled version Due to that some compile time configurations in the source code are fixed Parameter Description The Flash background operations e g Flash erase need some time Before continuing with any Flash related operation like stepping forward the EEELib DFALib Status check internal state machine the SW need to check the end of the Flash operation EEELib state machine handler The EEELib handler responsible for these checks can either be called by the user application until the EEPROM emulation operation is finished or it can be called inside the EEEL
17. ation 30 User s Manual U18398EE1VOUMOO Chapter 5 Emulation Library API 5 2 1 State machine initialization Function prototype void EEELib Init void Required parameters Return value Function Description This function initializes the EEELib state machine The function must be called once before the 1st EEPROM emulation operation 5 2 2 Operation initiation Function prototype void EEELib Execute tEEE REQUEST request Required parameters request Command structure as described below Return value request error Values as described in 5 1 Used Types on page 29 Function Description Initiates a EEPROM emulation operation The return value request error generated by the EEELib Execute are marked with 1 whereas the One s generated by the EEELib Handler are marked with 2 e Start upl required parameters request command STARTUP 1 return See 5 1 Used Types page 29 request error EEE_DRIVER_BUSY 1 EEE_ERR_OPERATION_REJECTED 1 EEE_OK 2 EEE_ERR_NOACTIVESECTION 2 e Start up2 required parameters request command EEE_CMD_STARTUP2 return See 5 1 Used Types on page 29 request error EEE DRIVER BUSY 1 EEE ERR OPERATION REJECTED 1 EEE ERR FLOW 1 EEE OK 2 ERR FLASH ERROR 2 User s Manual U18398EE1VOUMOO 31 Chapter 5 Emulation Library API e Prepare required parameters request command EEE_CMD_PREPARE return See 5 1 Used Types on page 29
18. conditions and possible operations In the explanation below two different device operational phases are distinguished This is application dependent However most applications can be separated into these phases Device initialisation phase The device hardware and application software is initialized An operating system is not yet started so the code is executed sequential No restrictions regarding the EEELib handler See 5 2 3 State machine handler on page 34 run time just the EEELib operation overall run time is important Device operational phase An operating system is started If the EEELib is executed in a task e g timed or interrupt driven beside the overall EEELib operation run time also the function run time E g EEELib handler must be limited User s Manual U18398EE1VOUMOO 21 Chapter 3 Emulation Strategy The following phases have to be passed sequentially 1 gt 2 gt 3 gt 4 gt 5 lt 1 gt lt 2 gt lt 3 gt 22 Library is not initialized This phase should be handled during the device initialisation phase Status EEELib status is undefined No EEPROM Emulation operation is allowed User application actions Call the function EEELib_Init Library is initialized Section status is undefined This phase should be handled during the device initialisation phase Status EEELib is initialised but the section status is undefined All EEPROM Emulation operations excep
19. e The Format operation is not needed in the normal application operation therefore it is not men tioned in above flow The Format operation prepares both Flash sections and activates one of them for data set Read and Write operations This operation has to be used for completely erased Data Flash After the Format operation all data sets are deleted This operation has to be used if the application itself prepares an erased Data Flash for usage Alternatives to using the Format operation in the application are using a Debugger e g GHS or a Flash programmer e g the NEC PG FP4 to format the data Flash and to copy initial data sets into the sections Tools to support that are available User s Manual U18398EE1VOUMOO 17 Chapter 3 Emulation Strategy 3 3 7 Invalidation of data sets Data sets can be invalidated before writing a data set new A Read operation on an invalidated data set does not return the latest values but returns with an error indicating that the data is obsolete The user application can e g react on this by taking default values for this data set Invalidating a data set is done by writing this data set with the length information O Please refer to 5 2 2 Operation initia tion on page 31 for further explanation The data set is then represented in Flash as the following Figure 3 5 Invalidated Data Set 3 3 8 Operation abort Some emulation operation require quite some time to finish like flash erase
20. e switch off the external power supply and then the internal power supply Use of the reverse power on off sequences may result in the application of an overvoltage to the internal elements of the device causing malfunction and degradation of internal elements due to the passage of an abnormal current The correct power on off sequence must be judged separately for each device and according to related specifications governing the device INPUT OF SIGNAL DURING POWER OFF STATE Do not input signals or an I O pull up power supply while the device is not powered The current injection that results from input of such a signal or I O pull up power supply may cause malfunction and the abnormal current that passes in the device at this time may cause degradation of internal elements Input of signals during the power off state must be judged separately for each device and according to related specifications governing the device User s Manual U18398EE1VOUMOO For further information please contact NEC Electronics Corporation 1753 Shimonumabe Nakahara ku Kawasaki Kanagawa 211 8668 Japan Tel 044 435 5111 http www necel com America NEC Electronics America Inc 2880 Scott Blvd Santa Clara CA 95050 2554 U S A Tel 408 588 6000 800 366 9782 http www am necel com Europe NEC Electronics Europe GmbH Arcadiastrasse 10 40472 Dusseldorf Germany Tel 0211 65030 http www eu necel com Hanover Office Podbie
21. ection Handling The following sections are EEPROM emulation library related e DFALib_ Text DFALib_TextRAM This is DFALib code This section is executed from code flash EEELib Text This is EEELib code This section is executed from code flash EEELib Data This is the section containing EEELib internal data It must be located to internal RAM Note The above named section have to be added to the projects linker file 4 4 MISRA Compliance The EEELib and DFALib have been tested regarding MISRA compliance The used tool is the GHS V4 0 7 MULTI development environment which tests on the predecessor of the MISRA 2004 standard The following rules had to be disabled as enabling would result in significant disadvantages in terms of code size performance or code readability Rule 23 Rule 45 Rule 90 Rule 96 Module local functions shall be defined as static The checker did not recognize static functions as local Casting from and to pointers not allowed This is intensively used for all sfr accesses due to performance and code size reasons c macros shall be used for constants function like or specifier Qualifier only This rule prohibits defines assigning former defines This is used in the libraries for better code readability and reduction of possible user mis configuration Use of parenthesis in function like macros This rule prohibits macros with parameters defined as empty macros This is us
22. ed in the libraries for all debug outputs definitions User s Manual U18398EE1VOUMOO 27 MEMO 28 User s Manual U18398EE1VOUMOO Chapter 5 Emulation Library API The EEPROM Emulation library provides two types of user functions Operational functions Operational functions control the standard EEPROM emulation operations like Read Write Prepare etc Service functions Providing service information to the user 5 1 Used Types The structure is passed to the function EEELib_Execute to control the state machine and to read the status and operation results typedef struct u32 address u16 identifier u16 length u16 offset tEEE COMMAND command tEEE ERROR error HEEE REQUEST command Distinguishes between the different operations Start up Start up2 Read Write Refresh Format and Prepare error various errors are possible depending on the operation The errors are either set by the initial function EEELib Execute or by the handler User s Manual U18398EE1VOUMOO 29 Chapter 5 Emulation Library API EEELib_Handler Table 5 1 Error States Error Name Description The operation finished successfully The state machine is busy EEE_DRIVER_BUSY This value is set when a new operation has been successfully started by EEELib_Execute Wrong parameters have been passed to the EEELib See the different commands EEE_ERR_PARAMETER A data set Write attempt failed as the section is full EEE_ER
23. emana 10 Chapter 2 Emulation 11 2 1 Data Set Representation the 11 2 1 1 Invalidation of datasets u srest tee uso eee 12 2 1 2 Dataset Write operation abort na 12 2 2 EEROM Emulation 1 13 2 21 OV6IV IOW De eee ek ews RE A eMac 14 22 2 Section headers inisa morna yeaa eae Ew ores wade P ER RR 15 2 2 3 IDIZONG RA 16 2 24 Data ZONE s rk es bled MER a EX ERE d us k PA 16 2 3 Emulation Flows Normal Operation 17 2 31 Prepare ne agreate A AR A ee as 17 2 3 2 Wirite data set ss ae ee were rd RR dae bends wak a 18 2 9 9 eae A do EN ER oa da 19 2 3 4 u s eec AO LA vay eas Pee a anaes 20 2 9 5 A A AED ieee ee ta 22 2 4 Emulation Flows Initialization Phase 23 24 Start p tf ai a A nen AREE P EL RUE 23 2 42 St rbup2 eis Geek ON 25 2 5 EEPROM Emulation Library 29 2 5 1 Data Flash initialisation 0 0 tee 29 2 5 2 EEPROM emulation in the 30 2 5 3 Aborting library lt 5
24. er execution this handler function is either called EEELib library internally or by the user application In case of library internal call this func tion is not required and may not be used in the user application 2 Do not change the command structure information until the EEELib operation is finished requestStructure error EEE_DRIVER_BUSY 5 2 4 State machine abort Function prototype void EEELib_Abort void Required parameters Return value Function Description This function indicates the user abort request to the state machine The state machine aborts an EEP ROM emulation operation as soon as possible Notes 1 After the abort instruction call the handler function must still be called until the state machine has completed the abort procedure This is indicated by the request error accord ingly 2 Aborts before finish of the Start up2 operation are not possible so ignored 34 User s Manual U18398EE1VOUMOO Chapter 5 Emulation Library API 5 3 Service Functions 5 3 1 Check free section space Function prototype tEEE_ERROR EEELib_GetSpace u32 space Required parameters space pointer to the variable that shall receive the section space information Return value EEE OK The operation finished successfully EEE DRIVER BUSY The EEELib state machine is busy the size information could not be calculated Function Description This function calculates the free space inside the active section for new data sets
25. es with data flash is based on two sections The part of the data flash that should be used for the EEPROM emulation is divided in two equal sections that are used in alternating manner With the chosen concept and the given specification of the Data Flash a high number of write cycles can be achieved Figure 3 1 EEPROM Emulation Sections in the Data Flash Data Flash Notes 1 A Flash section must always consist of a number of Flash blocks following the rule NoBlocks 2 with n 0 1 2 3 gt NoBlocks 1 2 4 8 2 Furthermore the section must start on a block number following the rule StartBlock NoBlocks n with n 0 1 2 3 User s Manual U18398EE1VOUMOO 13 Chapter 3 Emulation Strategy 3 1 3 Section overview Each Flash section consists of 3 parts Section Header Data Zone ID Zone Figure 3 2 EEPROM Emulation Section Overview Top address Data Zone ID Zone Bottom address 14 User s Manual U18398EE1VOUMOO Chapter 3 Emulation Strategy 1 Section header Section header size is 16 Bytes 4 words where currently 3 words are used to define the current sec tion status Figure 3 3 Section Header ENS counter Top address Active marker Consumed marker Reserved Bottom address The erase counter word consists of the 16 bit counter and a 16 bit inverse value for protection It describes the number of erase cycles on the data section
26. ib The Flash block size of the used device is set with this parameter Current a implementations is 2 kBytes 0x800 In case of library internal status check the library does a status check loop to User call back functions wait for the end of a Flash operation In that loop a user function can be called The Flash base address depends on the used Flash type Data Flash start address depends on the device Please refer to the device documentation Flash related information for the EEPROM emulation Please check the delivery package regarding the setting of these configurations Please also refer to the application note of the EEELib 4 2 1 Supported compilers General code from the application note supports compilers from GHS IAR and NEC Pre compiled libraries according to this document are compiled and tested with one dedicated compiler version and dedicated compiler switches that are explicitly listed up in the release package The user application must be compiled according not to interfere with these settings 4 2 2 Library delivery packages The DFALib and EEELib are strictly separated so that the DFAlib can be used without the EEELib However using EEELib without DFALib is not possible EEELib delivery package root nec_types h NEC types convention compile time EEELib EEELib a Pre compiled EEELib and DFALib library code 26 User s Manual U18398EE1VOUMOO Chapter 4 Emulation Library Usage 4 3 S
27. lskistrasse 166 B 30177 Hannover Tel 0 511 33 40 2 0 Munich Office Werner Eckert Strasse 9 81829 M nchen Tel 0 89 92 10 03 0 Stuttgart Office Industriestrasse 3 70565 Stuttgart Tel 0711 99 01 0 0 United Kingdom Branch Cygnus House Sunrise Parkway Linford Wood Milton Keynes MK14 6NP U K Tel 01908 691 133 Succursale Francaise 9 rue Paul Dautier B P 52180 78142 Velizy Villacoublay C dex France Tel 01 3067 5800 Sucursal en Espa a Juan Esplandiu 15 28007 Madrid Spain Tel 091 504 2787 Tyskland Filial Taby Centrum Entrance S 7th floor 18322 T by Sweden Tel 08 638 72 00 Filiale Italiana Via Fabio Filzi 25 A 20124 Milano Italy Tel 02 667541 Branch The Netherlands Steijgerweg 6 5616 HS Eindhoven The Netherlands Tel 040 265 40 10 Asia amp Oceania NEC Electronics China Co Ltd 7th Floor Quantum Plaza No 27 ZhiChunLu Haidian District Beijing 100083 P R China Tel 010 8235 1155 http www cn necel com NEC Electronics Shanghai Ltd Room 2509 2510 Bank of China Tower 200 Yincheng Road Central Pudong New Area Shanghai P R China P C 200120 Tel 021 5888 5400 http www cn necel com NEC Electronics Hong Kong Ltd 12 F Cityplaza 4 12 Taikoo Wan Road Hong Kong Tel 2886 9318 http www hk necel com Seoul Branch 11F Samik Lavied or Bldg 720 2 Yeoksam Dong Kangnam Ku Seoul 135 080 Korea Tel 02 558 3737 NEC Electronics Taiwan Ltd
28. ly degrade the device operation Steps must be taken to stop generation of static electricity as much as possible and quickly dissipate it when it has occurred Environmental control must be adequate When it is dry a humidifier should be used It is recommended to avoid using insulators that easily build up static electricity Semiconductor devices must be stored and transported in an anti static container static shielding bag or conductive material All test and measurement tools including work benches and floors should be grounded The operator should be grounded using a wrist strap Semiconductor devices must not be touched with bare hands Similar precautions need to be taken for PW boards with mounted semiconductor devices STATUS BEFORE INITIALIZATION Power on does not necessarily define the initial status of a MOS device Immediately after the power source is turned ON devices with reset functions have not yet been initialized Hence power on does not guarantee output pin levels I O settings or contents of registers A device is not initialized until the reset signal is received A reset operation must be executed immediately after power on for devices with reset functions POWER ON OFF SEQUENCE In the case of a device that uses different power supplies for the internal operation and external interface as a rule switch on the external power supply after switching on the internal power supply When switching the power supply off as a rul
29. manufactured by or for NEC Electronics as defined above M8E 02 11 1 User s Manual U18398EE1VOUMOO Introduction Readers This User s Manual is intended for users who want to understand the func tionality of the EEPROM emulation for devices of the V850 core family Purpose This User s Manual explains the background and handling of the EEPROM emulation on data and on code Flash Organization This application note contains the major sections Emulation strategy e Emulation library structure Emulation library usage Emulation library APIs Legend Symbols and notation are used as follows Weight in data notation Left is high order column right is low order column Active low notation pin or signal name is over scored or xxx slash before signal name Memory map address High order at high stage and low order at low stage Note Explanation of Note in the text Caution Information requiring particular attention Remark Supplementary explanation to the text Numeric notation Binary XXXX or XXXB Decimal XXXX Hexadecimal XXXXH or Ox XXxx Prefixes representing powers of 2 address space memory capacity K kilo 210 1024 M mega 220 10242 1 048 576 G giga 2 1024 1 073 741 824 User s Manual U18398EE1VOUMOO 5 User s Manual U18398EE1VOUMOO Table of Contents Chapter 1 Overview clie p tes aa a i ae a RT ERE ES 9 1 1 Naming Conventions oocoococccccn eee eee eee
30. ontext Note For details on the interrupt please refer to the appropriate chapter of the device The availability of the interrupt depends on the delivery package s compile options 3 5 Basic Flow Figure 3 7 Section State Transition During Normal Operation EEELib Section Operations State Undefined FORMAT 1 Prepared REFRESH u Consumed PREPARE gt Prepared REFRESH Consumed PREPARE Sections can also be formatted and filled with initial data by other tools like PG FP4 debugger User s Manual U18398EE1VOUMOO 19 Chapter 3 Emulation Strategy The following section states are possible 20 Prepared This section is ready for activation by a Refresh operation The section has been erased and in the section header the erase counter is written Active marker and consumed marker are cleared Active The section contains the latest data sets The EEPROM emulation can read and write data to this section In the section header additionally to the erase counter also the active marker is set Consumed marker is cleared Consumed After activating the next section and copying the latest data sets there the Refresh operation marked the old active section as consumed In the section header additionally to the erase counter and active marker also the consumed marker is set Next step is to Prepare the section Invalid This is no valid state During o
31. peration it can only occur in case of interruption of a Flash operation like erase to this section The section header may contain any other data except as described in the three states before Also a completely erased Flash default factory delivery state is invalid from EEPROM emulation point of view User s Manual U18398EE1VOUMOO Chapter 3 Emulation Strategy 3 6 Init Phase The start up procedure is split up into different parts This splitting is chosen because of the require ment to perform any read operation on EEPROM data after a very short time after reset release The principle flow is described in below figure Figure 3 8 Startup Procedure r 3 The library is initialized but the Calli EEEL imi section ie is undefined Performed during initialisation phase lt of the device The active section is detected Call EEELib Execute and library internal pointers are EEE CMD STARTUP1 calculated but inconsistencies are not fixed From now on data can be read For time critical applications f Y performed during Bee Inconsistencies are detected normal operation of EEE CMD STARTUP2 and fixed the micro otherwise Z Execution may take a longer time during init phase Y EEPROM emulation ready for operation Data can be stored Before being in normal operation the EEELib has to sequentially pass dedicated initialisation phases with different
32. perations will be done in the newly active section 16 User s Manual U18398EE1VOUMOO Chapter 3 Emulation Strategy 3 3 3 Prepare operation The Prepare operation checks whether the non active section is already prepared If the section is already prepared it returns immediately if not it does a blank check followed by erase and write the erase counter as indication that the section is now prepared Prepared in this term means e The Flash section is erased e The section header contains the necessary information Note As the Prepare operation returns immediately without Flash operation when the section is already prepared the Prepare operation can be called frequently e g time driven 3 3 4 Write operation The data set Write operation writes a complete data set to the active section The data is written first followed by the top ID L and the bottom ID L Last the ID zone is checked whether the ID L is already contained If not the ID L is added to the ID zone 3 3 5 Read operation The Read operation searches the current valid data set according to the ID in the function call parame ter and copies the data set to the destination location In some cases it may make sense to read only parts of bigger data sets in order to save read buffer space Therefore the Read operation has a parameter to define an offset within the data set and a length parameter to define the number of bytes to be read 3 3 6 Format operation Not
33. program for a specific application The recommended applications of an NEC Electronics product depend on its quality grade as indicated below Customers must check the quality grade of each NEC Electronics product before using it in a particular application Standard Computers office equipment communications equipment test and measurement equipment audio and visual equipment home electronic appliances machine tools personal electronic equipment and industrial robots Special 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 life support systems and medical equipment for life support etc The quality grade of NEC Electronics products is Standard unless otherwise expressly specified in NEC Electronics data sheets or data books etc If customers wish to use NEC Electronics products in applications not intended by NEC Electronics they must contact an NEC Electronics sales representative in advance to determine NEC Electronics willingness to support a given application Note 1 NEC Electronics as used in this statement means NEC Electronics Corporation and also includes its majority owned subsidiaries 2 NEC Electronics products means any product developed or
34. rational phase So the EEELib is operational relatively early and the device start up time is not extended more than necessary Start of normal operation This phase is handled during the device operational phase regarding operation refer to Figure 3 7 Section State Transition During Normal Operation on page 19 Status The EEELib is up and running all operations are possible However due to eventually necessary operations during Start up2 the active section might be full and or the background section might be not prepared In order to avoid Write operation errors it should be considered to execute a Prepare and a Refresh operation first Conditions Normal operation After starting a EEELib operation the EEELib Handler must be called fre quently in order to finish the operation timely User s Manual U18398EE1VOUMOO 23 MEMO 24 User s Manual U18398EE1VOUMOO Chapter 4 Emulation Library Usage 4 1 Application Execution During EEPROM Emulation 4 1 1 Principle Flow of the EEPROM emulation function call The EEELib Handler function is called frequently by the user application The EEELib operation initiali zation call EEELib Execute as well as the EEELib Handler calls require only short time The user function can execute any code in between the EEELib Handler function calls Figure 4 1 Principle Flow of an EEPROM Emulation Function Call E g Write Operation my Command command CMD
35. roducts listed in this document 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 customer s equipment shall be done under the full responsibility of the customer NEC Electronics assumes no responsibility for any losses incurred by customers or third parties arising from the use of these circuits software and information While NEC Electronics endeavors to enhance the quality reliability and safety of NEC Electronics products customers agree and acknowledge that the 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 NEC Electronics products are classified into the following three quality grades Standard Special and Specific The Specific quality grade applies only to NEC Electronics products developed based on a customer designated quality assurance
36. t Start up1 or Format are locked and result in a Flow error if trying to execute them User application actions In the standard case of sections contain valid data sets even in that case that previous program execution was interrupted by a power fail In this case execute the Start up1 operation In case of blank EEELib sections execute Format operation first and after operation end execute Start up1 Conditions The Start up1 operation parses all data sets in the active section and if required also in the con sumed section in order to calculate library internal pointers Depending on how many data sets have to be parsed the execution time of Start up1 is in the range of several hundred us During that time the CPU is loaded to 100 Library passed the Start Up Phase 1 This phase should be handled during the device initialisation phase Status The data section status is defined but inconsistencies not completed former operations due to e g power fail are not fixed All EEPROM Emulation operations except Start up2 Read or For mat are locked and result in a Flow error if trying to execute them User application actions In case of early required EEPROM data sets these data sets can be read using the Read opera tion If no EEPROM Emulation data is required in this phase it can be skipped Conditions In this phase the Read operation differs from the normal operation The data set search uses a different mechanism While in
37. tions The library contains a software state machine controlling all EEPROM emulation related operations State machine operations are initiated by a central function An input structure defines the kind of oper ation and the parameters that are required Depending on the library configuration the function returns after operation completion or after operation initiation In the later case the user program need to frequently call a handler routine which then han dles the state machine 12 User s Manual U18398EE1VOUMOO Chapter 3 Emulation Strategy 3 1 Basic strategy 3 1 1 Difference between real EEPROM and emulated EEPROM In opposite to classical EEPROM s where the data is stored on a fixed address and so can always be found on the same location EEPROM emulation need to store data on changing locations Indeed the physical behaviour of a flash cell does not allow to program different values to the same cell without erasing before re writing a value Furthermore write and erase granularity differs While write opera tions are done on word base 32 bit the erase operations are done on block base 2 kBytes NEC s EEPROM Emulation does not support the random byte access but allows to store sets of data with a unique ID Writing new data sets is easily done by appending the data to the Data Zone Please see below for details on the content and the structure 3 1 2 Emulation Concept The NEC EEPROM emulation concept on the V850 seri
38. tructure 2 1 Layer Model Figure 2 1 EEPROM Emulation Layer Model Data Flash access layer The EEPROM emulation is implemented in a strictly layered manner So that it is in principle possible to set up a user dedicated EEPROM emulation strategy differing from the NEC EEPROM emulation layer but based on the Data Flash access layer 2 1 1 Flash control hardware The Flash hardware can do simple Flash operations like Flash block erase word write data search Data Flash only etc in background after initial configuration The upper layers and the user program can then continue operation while the Flash hardware works Operation end can either be polled or signalled by an interrupt The operation and the configuration of the hardware is not open to the user so the usage of the data Flash access layer is mandatory Note Please refer to the Devicelnfo to check whether the operation end interrupt is also available on the used device User s Manual U18398EE1VOUMOO 11 Chapter 2 Emulation Library Structure 2 1 2 Data Flash access layer The data Flash access layer DFALib configures the Flash hardware to do the basic Flash operations This layer is transparent for the user if the NEC EEPROM emulation layer is used The DFALib is explained in a separate document 2 1 3 EEPROM emulation layer The EEPROM emulation layer is represented by the EEELib This library calls the DFALib for all Flash related opera
Download Pdf Manuals
Related Search
Related Contents
Garmin 1490TV GPS Receiver User Manual Ardour3 - Video Integration - Linux Audio Conference User`s Manual Samsung HT-C5550W/XAX home cinema system Samsung Stereo MM-E460D Sony VGN-SZ645P4 Marketing Specifications Eicon Networks D/480JCT-2T1-EW Network Card User Manual G-SS Gimbal User Manual \“wo'kem Descripción del servicio Garmin Dakota 10 with TOPO Germany Light Important Safety and Product Information Copyright © All rights reserved.
Failed to retrieve file