Home
RL78 Data Flash Access Library Type T02 (Tiny), European Release
Contents
1. 62 5 2 1 Maximum Function Execution Times eeeeeeeeeee 62 5 2 2 Command Execution Times J 64 Chapter 6 Cautions c 65 uS RENESAS Data Flash Access Library T02 Tiny European Release Introduction Chapter 1 Introduction This user s manual describes the overall structure functionality and software interfaces API of the Data Flash Library T02 Tiny accessing the physical Data Flash separated and independent from the Code Flash This library supports dual operation mode where the content of the Data Flash is accessible read write erase during instruction code execution The flash access layer is a layer of the EEPROM emulation system and encapsulates the low level access to the physical flash a secure way In case of Data Flash this layer is using the FDL It provides a functional socket for Renesas EEPROM emulation software user application application layer EEL API EEPROM emulation library EEPROM layer EEL Data Flash library flash access layer FDL Data Flash physical flash layer lt Figure 1 Components of the EEPROM emulation system To boost the flexibility and the real time characteristics of the library it offers only fast atomic func
2. 2 6 Abortion of Commands 2 7 StandBy and WakeUp Functionality Chapter 3 User Interface API 3 1 Run time Configuration unu npo eni anu 3 2 Data TypeS u us uu uuu auqa 3 2 1 Library specific simple Type Definitions 3 2 2 Enumeration command t 3 2 3 Enumeration fdl status t 3 2 4 Structured Type 1 request t 3 2 5 Structured Type fdl descriptor t 3 3 PUBCHOIS u su eei naim Em SMS EMEN 3 3 4 PDL 3 3 2 FDL 33 9 FDL ClOS 234 FDL 3 3 5 FDL_Handler J Q 3 4 5 FDL 3 3 7 FD
3. Tool chain Destructed registers CA78KO0R None IAR None GNU None CC RL None in Manual g RENESAS 45 Data Flash Access Library Type T02 Tiny European Release User Interface API Pre conditions None Post None conditions Description Example For version control at runtime the developer can use this function to find the starting character of the library version string The version string is a zero terminated string constant that covers library specific information and is based on the following structure NAMMMTTTCCCCCXVVV V where e N library type specifier here D for FDL e MMMM series name of microcontroller here RL78 type number here T02 e CCCCC compiler information e Rxyy_ for CA78KOR compiler version x yy for IAR compiler version x yy Uxxyy for GNU compiler version xx yy Lxyyz for CC RL compiler version x yy 0z X memory register models here G for general i e all memory models e VVV V library version Examples The version string of the Tiny FDL V1 00 for the CA78K0R compiler version 1 10 is DRL78T02R110_GV100 The version string of the Tiny FDL V1 00 for the IAR compiler version 1 20 is DRL78T021120 GV100 The version string of the Tiny FDL V1 01 for the GNU compiler version 13 02 is DRL78T02U1302GV101 The version string of the Tiny FDL V1 01 for the CC RL compiler version 1 23 04 is DRL78T02
4. FDL ERR CONFIGURATION status FDL OK FDL Open Execute any FDL commands Y FDL Close Error handler Figure 13 Initialization flow R01US0061ED0120 56 User Manual 2 N S AS Data Flash Access Library Type 02 Tiny European Release FDL Usage by User Application 4 5 2 Read The following figure illustrates the read command handling fill request CMD read FDL_Execute CMD FDL Handler YES Status FDL_ERR_RE JECTED NO tatus FDL_ERR_ST THER status B Error handler Figure 14 FDL read command execution RO1US0061ED0120 User Manual RENESAS on Data Flash Access Library T02 Tiny European Release FDL Usage by User Application 4 5 3 Blankcheck Write IVerify Erase The following figure illustrates the blankcheck write internal verify erase command flow fill request CMD FDL Handler FDL Execute CMD YES FDL_ERR_RE ECTED FDL_ERR_ST ANDBY NO status FDL_BUSY FDL Handler YES status FDL BUSY YES erase command only FDL ERR AB Y status FDL OK Error handler Figure 15 Background operation Internal Verify Blankcheck R01US0
5. FDL CMD READ BYTES reads data from flash memory FDL CMD IVERIFY BYTES verifies data if flash provides full data retention FDL CMD BLANKCHECK BYTES checks if flash content is erased FDL CMD WRITE BYTES writes data into flash memory FDL CMD ERASE BLOCK erases one flash block RO1US0061ED0120 User Manual 24 N S AS 23 Data Flash Access Library T02 Tiny European Release User Interface API 3 2 3 Enumeration fdl_status_t This enumeration type defines all possible status and error codes can be generated during data flash access via the FDL The FDL_OK and FDL_BUSY status are returned to the requester during normal operation Other codes signalize problems On the one hand fdl status t is used as return type of the functions FDL_Init see Section 3 3 1 FDL Abort see Section 3 3 6 StandBy see Section 3 3 7 and FDL WakeUp see Section 3 3 8 On the other hand fdl status t is used within the structure fdl request t see Section 3 2 4 in order to capture the processing of currently running command Thereby the possible error codes are command specific and described in detail in Section 3 4 along with the commands typedef enum FDL OK 0x00 FDL BUSY OxFF FDL ERR INITIALIZATION 0x02 FDL ERR REJECTED 0x03 FDL ERR ABORTED 0x04 FDL ERR
6. RO1US0061ED0120 User Manual RENESAS i Data Flash Access Library Type T02 Tiny European Release User Interface API 3 3 2 FDL_Open Outline Activation of the data flash Interface C Interface for CA78KOR Compiler void _ far FDL Open void C Interface for Compiler __far func void FDL Open void C Interface for GNU Compiler void FDL Open void attribute section FDL CODE C Interface for CC RL Compiler void FDL Open void ASM function label FDL Open Arguments Parameters none Return value none Destructed registers Tool chain Destructed registers CA78KOR None IAR None GNU None CC RL AX Pre The initialization shall be done before However no check is performed here If the FDL is conditions not yet initialized FDL_Open has no functionality Post Data flash clock is switched on conditions Description This function must be used by the application to activate the data flash RO1US0061ED0120 User Manual RENESAS Data Flash Access Library Type T02 Tiny European Release User Interface API Example FDL Open RO1US0061ED0120 User Manual RENESAS 21 Data Flash Access Library T02 Tiny European Release User Interface API 3 3 3 FDL_Close Outline Deactivation of the data flash Interface C Interface for CA78KOR Compiler void far FOL Close void C Interface for Comp
7. 2 4 Request Response Architecture The communication between the requester user and the executor here the FDL is a structured request variable The requester can specify the request and pass it to the FDL After acceptance the progress of the execution can be checked by polling the request status From execution time point of view the commands of the FDL are divided into two groups e commands that can be aborted block oriented commands like erase taking relatively long time for its execution e commands that cannot be aborted byte oriented commands like write read taking very short time for its execution Depending on the real time requirements the user can decide if independent quasi parallel execution of block and byte commands is required or not In such a case two separate request variables have to be defined and managed by the application Please refer to chapter Basic functional Workflow for details Following figure shows the access from requester and FDL point of view Requester INDEX DATA POINTER BYTE COUNT COMMAND STATUS Figure 5 Request oriented communication between FDL and its requester R01US0061ED0120 15 User Manual NE SAS Data Flash Access Library Type T02 Tiny European Release Architecture 2 5 Background Operation The flash technology provided by Renesas enables the application to write erase the Data Flash in parallel to the CPU execution Such a f
8. case FDL ERR REJECTED try again if request not accepted FDL Execute amp my fdl request FDL Handler break default cmd finished 1 break R01US0061ED0120 39 User Manual 12 NE S AS Data Flash Access Library Type T02 Tiny European Release User Interface API DRIVER IS NO EERE EE RE EEE error handler if my fdl request status enu FDL OK TASK 2 t WILL USED FOR EMERGENCY WRITE while abort status ORE BUSY HE PERFORM EMERG abort status FDL Abort DL ENCY WRITE RO1US0061ED0120 User Manual 7CENESAS 40 Data Flash Access Library T02 Tiny European Release User Interface API 3 3 7 FDL_StandBy Outline Function to drive the library into StandBy mode Interface C Interface for CA78KOR Compiler fdl status t far FDL StandBy void C Interface for Compiler far func fdl status t FDL StandBy void C Interface for GNU Compiler fdl status t FDL StandBy void attribute section FDL CODE C Interface for CC RL Compiler fdl status t _ far FDL StandBy void ASM function label FDL StandBy Arguments Parameters none Return value Passed via
9. Type CA78KOR IAR GNU CC RL R8 A A status t C X bank 1 FDL OK when FDL entered StandBy mode FDL BUSY any command is still running Destructed registers Tool chain Destructed registers CA78KOR None IAR None GNU None CC RL C HL R01US0061ED0120 41 User Manual RENESAS Data Flash Access Library T02 Tiny European Release User Interface API Pre The library initialization and open via FDL_Init and FDL_Open shall be done before conditions calling this function Post Data flash clock is switched off and library is in StandBy mode conditions Description The main purpose of this function is to drive the library and Data Flash into the StandBy mode StandBy mode means that e the Data Flash hardware is switched off the DFLEN bit of the Data flash control register is cleared and e library does not accept any command requests Note It is not allowed to call any FDL function other than FDL_WakeUp and FDL Handler when FDL is in StandBy mode Example do while EEEH standby status FDL StandBy standby status FDL_OK FEAE AE AE AE AE EE EE EE EE EE EE EE E AE E AE FE AE BE RE BE F E G ENTER STOP HALT MODE R01US0061ED0120 User Manual H E AE AE AE AE AE AE AE AE AE AE AE FE AE E AE E AE FE AE E AE AE AE E AE FE AE FEAE FEAE F wakeup status FDL WakeUp if wakeup status FDL OK flow error
10. Type T02 Tiny European Release Architecture 2 6 Abortion of Commands Some application scenarios require an immediate abort of running data flash operations e g in cases of voltage drop or emergency data write to the data flash For that reason the FDL provides an abort mechanism where a running erase command can be aborted immediately The following figure shows such an scenario Data Flash hardware background FDL_Execute req command_enu FDL CMD ERASE BLOCK req status enu FDL BUSY Y reg status enu FDL ERR ABORTED Abort returns FDL OK Figure 9 Abort erase command As shown in the figure above the erase command will be immediately aborted in case of calling the FDL Abort function and the requester of the erase command will be informed that the requested command was aborted In such a case the command shall be re started by requester later In contrast the blankcheck write verify commands cannot be aborted immediately and therefore have to be finished by repeated calls of the FDL_Abort function The following figure shows the abort functions in case of blankcheck write verify commands R01US0061ED0120 19 User Manual 134 NE SAS Data Flash Access Library Type T02 Tiny European Release FDL_Execute req command_enu FDL_CMD_BLANKCHECK_BYTES Y Data Flash hardware background req status
11. lt Data Flash Access Library 02 Tiny European Release 16 Bit Single chip Microcontroller RL78 Family Installer RENESAS FDL_RL78 TO2bE Vx xx All information contained in these materials including products and product specifications represents information on the product at the time of publication and is subject to change by Renesas Electronics Corp without notice Please review the latest information published by Renesas Electronics Corp through various means including the Renesas Technology Corp website http www renesas com Renesas Electronics R01USO0061ED0120 WWW renesas com 15 04 2015 Data Flash Access Library Type T02 Tiny European Release Notice Notice 1 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 2 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 informatio
12. NOR 54 4 4 55 4 4 1 Linker Sections _ UU LL u 55 4 4 2 Descriptor Configuration Partitioning of the Data Flash 55 4 4 3 Prohibited RAM Are 55 4 1 4 Register Bank luu 55 4 4 5 Stack and Data Butffer J J 56 4 4 6 Request Structure u u u uu l u uuu 56 4 5 FLOW e 56 LINE sacassacessccancsacasancvecsuendsnintaasucccwensucdessncuancwendusssteadietadansucdeuenseans 56 0 2 Ee c 57 4 5 3 Blankcheck Write IVerify Erase J 58 4 6 Example of FDL used in Operating Systems 59 4 7 Example Simple application U T 61 Chapter 5 Characteristics 62 5 1 Resource Consumption ausa J 62 5 2 Library Timings
13. between different FDL pool configurations Argument Type Access descriptor_pstr fdl_descriptor_t far R RO1US0061ED0120 User Manual RENESAS en Data Flash Access Library T02 Tiny European Release User Interface API Return value Passed via Type CA78KOR IAR GNU CC RL status t C A i A iE X bank 1 FDL ERR CONFIGURATION when descriptor is not plausible FDL OK when descriptor is plausible and initialization was successful Destructed registers Tool chain Destructed registers CA78KOR HL CS ES GNU None CC RL X BC DE HL Pre Internal high speed oscillator is running conditions Post Initialization is done conditions Description Several checks are performed during the initialization plausibility check of the pool configuration e frequency parameter check against supported device specific range e initialization of all internal variables e initialization of the flash firmware e configuration of HOCO After initialization the FDL remains passive FDL Open has to be executed to open access to the FDL pool Note It is not allowed to call FDL Init in case of any running FDL command Example 161 status t my status my status FDL Init amp fdl descriptor str if my status FDL OK FDL can be used else error handler
14. check 1000 fclk 30us 5 fclk 0 26us x BYTE_COUNT 1200 fclk 36us 6 fclk 0 31us x BYTE_COUNT internal verify 715 fclk 25us 24 fclk 3 33us x BYTE COUNT 858 fclk 30us 29 fclk 4 00us x BYTE COUNT 139 fclk 167 fclk ione 14 fclk x BYTE COUNT 17 fclk x BYTE COUNT wats 580 fclk 12us 696 fclk 14us 212 fclk 39 17us x BYTE_COUNT 714 fclk 430 00us x BYTE_COUNT erase 11344 fclk 5800us 281674 fclk 264790us Table 20 Command execution times wide voltage mode Command TYP MAX blankcheck 996 fclk 63us 5 fclk 0 90us x BYTE_COUNT 1196 fclk 75us 6 fclk 1 05us x BYTE COUNT internal verify 715 fclk 49us 15 fclk 24 17us x BYTE_COUNT 858 fclk 58us 18 fclk 29 00us x BYTE_COUNT 139 fclk 167 fclk Adda 14 fclk x BYTE COUNT 17 fclk x BYTE COUNT rie 580 fclk 12us 696 fclk 14us 209 fclk 82 50us x BYTE_COUNT 670 fclk 954 00us x BYTE COUNT erase 10019 fclk 7195us 2491 13 fclk 299307us RO1US0061ED0120 User Manual 24 N S AS 64 Data Flash Access Library Type T02 Tiny European Release Cautions Chapter 6 Cautions e Library code and constants must be located completely in the same 64k flash page e For CA78KOR compiler the library takes care in the code to define these sections with UNIT64KP relocation attribute e F
15. context and execute another FDL function while the last one is not yet finished e Example for a not allowed sequence e Task 1 Start an FDL operation with Execute e Interrupt the execution and switch to task 2 executing Handler e Return to task 1 and finish the FDL Execute function e After the execution of Close all requested running commands will be aborted and cannot be resumed The designer has to take care that all running commands are finished before calling FDL Close e It is not possible to modify the Data Flash FDL in parallel to a modification of the Code Flash via FSL e An abortion of the byte commands read write verify and blankcheck is not possible e Internal high speed on chip oscillator HOCO must be started before using the FDL e 115 not allowed to locate any arguments and stack memory to address of OXFFE20 and above e Incase the application requires a frequency of less than 4MHz the following frequencies are allowed 1MHz 2MHz 3MHz It is not allowed to use the frequency of e g 1 5MHz The library configuration parameter FDL SYSTEM FREQUENCY in FDL descriptor h shall be adapted according to the above definition e g 1000000 2000000 3000000 e Incase the Data Transfer Controller DTC is used in parallel to the FDL do not locate RAM area for DTC to address OxFFE20 and above e Please check the device restrictions described in the device user s manual in case of accessing the data fla
16. means the FDL_Handler must be called inside of such a task Emergency task The difference between this task type and the requesting type Task 1 and Task 2 is that this task performs any FDL commands completely without waiting in the background Such task can be used in R01US0061ED0120 59 User Manual 124 N S AS Data Flash Access Library Type T02 Tiny European Release FDL Usage by User Application case of voltage drop where important data must be saved before the device is off Please note that designer could use the abort feature here for details see Chapter 2 6 RO1US0061ED0120 User Manual RENESAS d Data Flash Access Library T02 Tiny European Release FDL Usage by User Application 4 7 Example Simple application The following sample shows how to use each command in a simple way extern far const fdl descriptor t fdl descriptor str fdl status t my fdl status enu fear fdl request t request fdl u08 bu ffer 5 initialization my fdl status enu FdL Init tar 101 descriptor eral descriptor str yi if my fdl status enu FDL OK ErrorHandler FDL Open request structure initialization request index ul6 0x0000 request data pu08 near fdl u08 0x0000 request bytecount 116 0x0000 request command enu fdl command t OxFF request status enu FDL ERR PARAMETER erase block Q request index ul6 0x000
17. nothing call FDL_Handler until status changes meaning request was finished regularly FDL_OK normal reason no problems during execution remedy nothing RO1US0061ED0120 User Manual RENESAS User Interface API 48 Data Flash Access Library Type T02 Tiny European Release User Interface API 3 4 3 Read The READ command can be used to read a number of bytes from a specific address range It is initiated and finished directly by FDL_Execute FDL Handler is not needed in that case unless the FDL is busy with another command Note An execution of read commands across block boundaries is not allowed As a result the byte count can range from 1 byte up to 1024 byte Table 9 Request variable usage for read command index_u16 data_pu08 bytecount_u16 command_enu byte index byte count inside the FDL pool pointer to the read buffer 1 byte to 1024 bytes FDL_CMD_READ_BYTES Table 10 Status of FDL_CMD_READ_BYTES Status Class Status meaning and handling meaning FDL not initialized or not opened FDL ERR INITIALIZATION heavy reason wrong handling on user side remedy initialize and open FDL before using it meaning FDL is in standby and cannot accept new commands FDL ERR STANDBY heavy reason wrong handling on user side remedy call FDL_WakeUp before initiating new commands meaning request cannot be accepted FDL ERR PARAMETER r
18. reset could occur and the data flash content could be damaged It is designers duty to take care of reset and failure scenarios e g by a proper failure mode and effect analysis The EEL provided by Renesas Electronics is designed to avoid read of invalid data caused by such reset scenarios The following chapter describes the applications where the FDL and EEL should be used 4 2 2 EEL FDL or FDL only Depending on the security level of the application the write frequency of variables and the variable count it should be considered whether to use the EEL FDL or the FDL only 4 2 2 1 FDL only By using the FDL only the application has to take care about all reset scenarios and writing flow of different variables with different sizes Application scenarios programming of initial or calibration data e user specific EEPROM emulation 4 2 2 2 EEL FDL The duo of EEL and FDL allows the user to uses the EEL for high write frequency of different variables with different sizes in a secure way and additionally the FDL pool for e g application data or application specific EEPROM emulation Application scenarios e programming of initial or calibration data FDL should be preferred e large count of variables with high write frequency EEL should be preferred e reset safe data handling EEL should be preferred Please refer to the RO1AN1416EDxxxx manual for detailed EEL description RO1US0061ED0120 User Manual RENESAS i Data Flash Ac
19. wake up the library and Data Flash hardware from the StandBy mode After successful execution of this function e Data Flash hardware is switched on the DFLEN bit of the Data flash control register is set and e the FDL accepts new command requests Example wakeup status FDL WakeUp if wakeup status FDL OK Flow error handier E G CONTINUE WITH LIBRARY EXECUTION HERE sie ata acto a wos x rene RO1US0061ED0120 User Manual 44 7CENESAS Data Flash Access Library Type T02 Tiny European Release User Interface API 3 3 9 FDL_GetVersionString Outline Function for reading library version information Interface C Interface for CA78KOR Compiler _ far fdl u08 _ far FDL GetVersionString void C Interface for Compiler _ tune fdl u08 FDL GetVersionst tring void C Interface for GNU Compiler fdl 108 far FDL GetVersionString void Attribute _ section EDL CODE C Interface for CC RL Compiler _ far fdl u08 gt far FDL GetVersionString void ASM function label FDL GetVersionString Arguments Parameters none Return value Passed via Type CA78KOR IAR GNU CC RL R8 R1 1 DE highw A high fdl_u08 far BC loww BC bank 1 Pointer to the first character of a zero terminated version string Destructed registers
20. 0 request command enu FDL CMD ERASE BLOCK FDL Execute amp request while request status enu FDL BUSY FDL Handler if request status enu t FDL OK ErrorHandler write pattern 0x123456789A to idx 0 buffer 0 0x12 buffer 1 0x34 buffer 2 0x56 buffer 3 0x78 buffer 4 9 0x0000 request index ul6 request data pu08 near fdl u08 amp buffer 0 request bytecount 116 0x0005 request command enu FDL CMD WRITE BYTES FDL Execute amp request while request status enu FDL BUSY FDL Handler if reguest status emu l FDL ErrorHandler set initial values buffer 0 OxFF buffer 1 OxFF buffer 2 OxFF buffer 3 OxFF buffer 3 OxFF request index 116 0 0000 request data_pu08 near fdl u08 amp buffer 0 request bytecount_ul6 0 0005 request command_enu FDL CMD READ BYTES FDL Execute amp request if wequest status enu 1 FDL ErrorHandler EDL Closet RO1US0061ED0120 User Manual RENESAS d Data Flash Access Library Type T02 Tiny European Release Chapter 5 5 1 Resource Consumption All values are based on the FDL version V1 01 for CA78KOR GNU Compiler and FDL version V1 02 for Characteristics IAR Compiler Table 16 Resource consumption CA78KOR IAR GNU CC RL Compiler Compiler Compiler Compiler Max code size code flash 57
21. 061ED0120 58 User Manual 134 NE SAS Data Flash Access Library Type T02 Tiny European Release FDL Usage by User Application 4 6 Example of FDL used in Operating Systems The background operation feature and request response structure of the FDL allow the user to use the FDL in an efficient way in operating systems Note Please read the chapter Cautions carefully before using the FDL in such operating systems The following figure illustrates a sample operating system where the FDL is used for Data Flash access operating system Task 1 each 50ms if reql status FDL BUSY FDL Execute req1 IDLE Task FDL Handler Task 2 each 100ms if req2 status FDL BUSY FDL Execute req2 Task 3 emergency task FDL Execute req et FDL Handler while req et status FDL ERR REJECTED while req et status FDL BUSY FDL Handler Figure 16 FDL used in an operating system This operating system example shows three different task types which are described below Requesting tasks Examples of this type of task are Task 1 and 2 Such tasks just start any FDL command via the FDL_Execute function and assume that it will be finished in the background via the IDLE task Please note that the mandatory error handling is not shown in this example for the sake of readability IDLE task The IDLE task will be used by the application for continuing any running FDL command That
22. 2 bytes 591 bytes 596 bytes 548 bytes Constants code flash 10 bytes 10 bytes 10 bytes 10 bytes Internal data 2 2 byt 2 byt 2 byt SADDR RAM bytes ytes ytes ytes Max stack RAM 56 bytes 56 bytes 60 bytes 48 bytes Characteristics 5 2 Library Timings In the following certain timing characteristics of the Tiny FDL are specified All timing specifications are based on the following library versions e Tiny FDL V1 00 Please note that there might be deviations from the specified timings in case you are using other library versions than the ones mentioned 5 2 1 Maximum Function Execution Times The maximum function execution times are listed in the following tables These timings can be seen as worst case durations of the specific Tiny FDL function calls and therefore can aid the developer for time critical considerations e g when setting up the watchdog timer Please note however that the typical and minimum function execution times can be much shorter Table 17 Maximum function execution times full speed mode Function MAX FDL Init 1199 fclk FDL_Execute 167 fclk read command 17 fclk x BYTE_COUNT FDL_Execute non read command 646 fclk FDL_Handler 284 fclk 15us FDL_Open 27 fclk 14us FDL Close 30 fclk no command running FDL_Close 1 running command in background FDL_StandBy FDL_WakeUp FDL_Abort FDL_GetVersionString 836 fclk 444us 30
23. 5 fclk 15us 32 fclk 14us 350 fclk 28us 14 fclk R01US0061ED0120 62 User Manual 24 N S AS Data Flash Access Library Type T02 Tiny European Release Characteristics Note 1 It is not recommended to call the FDL_Close function in case of any running command in background Table 18 Maximum function execution times wide voltage mode Function MAX FDL Init 1199 fclk FDL Execute 167 fclk read command 17 fclk x BYTE COUNT FDL Execute non read command 646 fclk FDL Handler 284 fclk 15us FDL_Open 27 fclk 14us FDL Close no command running 30 fclk FDL_Close 1 running command in background 791 fclk 969us FDL_StandBy 305 fclk 15us FDL_WakeUp 32 fclk 14us FDL Abort 350 fclk 40us FDL_GetVersionString 14 fclk Note 1 It is not recommended to call the FDL_Close function in case of any running command in background R01US0061ED0120 User Manual 12 NE S AS 63 Data Flash Access Library Type T02 Tiny European Release 5 2 2 Command Execution Times Characteristics The command execution times are listed in the following tables These timings are divided into the typical timings which will appear during the normal operation and the max timings for worst case considerations Table 19 Command execution times full speed mode Command TYP MAX blank
24. Assembler interface files are available for the CA78KOR and CC RL Compiler only R01US0061ED0120 54 User Manual 2 N S AS Data Flash Access Library T02 Tiny European Release FDL Usage by User Application 4 4 Configuration 4 4 1 Linker Sections Following segments are defined by the library and must be configured via the linker description file FDL CODE Segment for library code Can be located anywhere in the code flash FDL CNST Segment for library constants like descriptor Can be located anywhere in the code flash FDL SDAT Segment for library data Must be located inside the SADDR RAM Note Please refer to the Chapter 6 and device user s manual for restrictions of RAM and ROM usage 4 4 2 Descriptor Configuration Partitioning of the Data Flash Before the FDL can be used the FDL pool and its partitioning have to be configured first The descriptor is defining the physical virtual addresses and parameter of the pool which will be automatically calculated by using the FDL POOL BLOCKS and EEL POOL BLOCKS definition Because the physical starting address of the data flash is fixed by the hardware the user can only determine the total size of the pool expressed in blocks Also the physical size of the pool is limited by the hardware and must not be defined by the user Also the physical size of a flash block is a predefined constant determined by the used hardware The first configuration parameter is FDL P
25. L StandBy R01US0061ED0120 User Manual 124 N S AS Table of Contents Data Flash Access Library Type T02 Tiny European Release Table of Contents 3 3 8 FDL WakeUp e RET inst 43 3 3 9 FDL_GetVersionString d ha Cus d Y CHA n UR RN 45 3 4 Commands u uie nuca cuv cidit una ku ark a ua EU CV aa T CR FEY a Sus 47 BlANKCHOCK d 47 3 4 2 Internal Verify ierant chart ion iu rk c rra 48 34 9 s usus su S SS NA MORE Mi EMEN E 49 m P Ri M 50 9 4 5 us uuu saiue 51 3 5 Basic functional Workflow 1 J 52 Chapter4 FDL Usage by User Application 53 4 1 First Steps 53 4 2 Special Considerations J J J 53 4 2 1 Reset ConsISfeD nbn adn e ai Cd GR RR 53 4 2 2 EELSFDE or FDL OB 53 4 3 File SEU CUI u uu DESEE a
26. L1234GV101 my version string pointer FDL GetVersionString R01US0061ED0120 User Manual RENESAS a8 Data Flash Access Library Type T02 Tiny European Release 3 4 Commands 3 4 1 Blankcheck User Interface API The blankcheck command can be used to check if all bits within the addressed range are still erased e g before initiating a write The blankcheck command is initiated by FDL_Execute and must be continued by FDL Handler as long as command is not finished request status updated Note Due to the fact that the blankcheck command execution across block boundaries is not allowed the byte count range vary between 1 byte up to 1024 bytes Table 5 Request variable usage for blankcheck command index u16 data 08 bytecount u16 command enu byte index byte count FDL CMD __ inside the FDL pool 1 byte to 1024 bytes BLANKCHECK_BYTES Table 6 Status of FDL_CMD_BLANKCHECK_BYTES Status Class Status meaning and handling meaning FDL not initialized or not opened FDL ERR INITIALIZATION heavy reason wrong handling on user side remedy initialize and open FDL before using it FDL is in standby and cannot accept new meaning commands FDL_ERR_STANDBY heavy reason wrong handling on user side call FDL_WakeUp before initiating new remedy commands meaning request cannot be accepted FDL ERR PA
27. OOL BLOCKS The minimum value is 0 and means any access to the FDL pool is closed The maximum value is the data flash size expressed in blocks in case EEL pool is not used The second configuration parameter is EEL POOL BLOCKS the size of the EEL pool used exclusively for Renesas EEPROM emulation library only When proprietary EEPROM emulation library is used the EEL pool shall be set to 0 The maximum size of the EEL pool is the data flash size build on the device Note The virtual address 0 of the FDL pool corresponds with the successor of the last EEL pool bytes 4 4 3 Prohibited RAM Area The Tiny FDL may use a fraction of the user RAM as working area referred as prohibited RAM area The size and position of this area is strictly device dependent many devices do not even have this area and vary between the different RL78 products For details please refer to the document User s Manual Hardware of your RL78 product If a prohibited RAM area is specified for the utilized device it is not allowed to access this area while the Tiny FDL is active Whenever FDL functions are called the data in the prohibited area may be rewritten 4 4 4 Register Bank The CA78KOR CC RL and IAR releases of the FDL use the registers of the currently selected register bank No implicit register bank switch is performed by the library For the GNU release of the FDL it is mandatory that register bank 0 is active on function entry No implicit registe
28. PARAMETER 0x05 FDL ERR STANDBY 0x06 FDL ERR ERASE 0x1A FDL ERR BLANK VERIFY 0x1B FDL ERR WRITE 0xlC FDL ERR CONFIGURATION 0x01 y status tj Note Due to the fact that the library has been implemented in Assembler it is mandatory that the enumeration type fdl status t has a size of exactly 1 byte The GNU compiler uses 16 bit enumeration types by default Therefore for GNU compiler the declaration of the enumeration type has to be extended with an attribute in order to be compiled to 1 byte attribute packed Table 2 Enumeration type fdl status t details Status value Description FDL OK Command finished without problems FDL BUSY Command is being processed FDL ERR INITIALIZATION FDL_Init FDL_Open missing FDL ERR REJECTED Request could not be accepted ABORTED Erase command has been aborted FDL_ERR_PARAMETER Parameter error FDL_ERR_STANDBY FDL_WakeUp missing FDL_ERR_ERASE Erase error FDL_ERR_BLANK_VERIFY Blank or verify error FDL_ERR_WRITE Write error FDL_ERR_CONFIGURATION Pool or frequency configuration wrong RO1US0061ED0120 User Manual 24 N S AS 24 Data Flash Access Library T02 Tiny European Release User Interface API 3 2 4 Structured Type 4 request t This type is used for definition of request variables and used for information exc
29. RAMETER heavy reason wrong command code index outside the used pool or request data structure on odd address remedy correct affected request member and try again least one byte within the specified pool area meaning i is not blank FDL ERR BLANK VERIFY light any bit in the addressed flash area is not erased remedy nothing free interpretation at requester side meaning request cannot be accepted FDL ERR REJECTED normal reason other command is being executed remedy Handler and try again meaning request is being processed FDL BUSY maria reason request checked and accepted nothing call FDL Handler until status remedy changes meaning request was finished regular FDL OK normal reason no problems during execution remedy nothing R01US0061ED0120 User Manual RENESAS 47 Data Flash Access Library Type T02 Tiny European Release 3 4 2 Internal Verify The internal verify command can be used to check if all bits 0 s and 1 s are electronically correct written Inconsistent and weak data caused by an asynchronous RESET can be detected by using the internal verify command The user can use the verify command freely to check the quality of user data The internal verify command is initiated by FDL_Execute and must be continued by FDL_Handler as long as command is not finished request status updated Note An execution of internal verify commands across block boundaries is not allowed As a result t
30. _enu FDL_BUSY FDL_Abort FDL_Abort returns FDL_BUS FDL_Abort FDL_Abort returns FDL_BUS FDL_Abort FDL_Abort returns FDL_OK Blank Check or or Internal Verify same procedure for FDL CMD WRITE BYTES FDL CMD IVERIFY BYTES Figure 10 Abort Blankcheck Write Internal Verify command R01US0061ED0120 User Manual 124 NE S AS Architecture 20 Data Flash Access Library Type T02 Tiny European Release Architecture 2 7 StandBy and WakeUp Functionality The StandBy and WakeUp feature provides the possibility to temporarily turn off the data flash functionality including the hardware e g for power consumption and resume the functionality The StandBy mode is active in case the FDL_StandBy function returns FDL_OK In case the return status is FDL_BUSY any command is running and FDL_StandBy function has to be re called The following figure shows the sequence of using the StandBy WakeUp feature Data Flash hardware background FDL_Execute req command_enu FDL BLANKCHECK BYTES Y req status_enu Blank Check FDL_BUSY or FDL StandBy or Internal Verify FDL StandBy returns FDL BUSY or FDL StandBy FDL StandBy returns FDL OK FDL WakeUp Y DFLEN 1 FDL_WakeUp returns FDL_OK Data Flas
31. ace for CC RL Compiler void X far FDL Handler void ASM function label FDL Handler Arguments Parameters none Return value none Destructed registers Tool chain Destructed registers CA78KOR None IAR None GNU None CC RL A C HL Pre The library initialization and open via FDL_Init and FDL_Open shall be done before conditions calling this function Post In case of finished command the status is written to the request structure associated to conditions the currently running command RO1US0061ED0120 User Manual RENESAS us Data Flash Access Library Type T02 Tiny European Release User Interface API Description This function is used by the application to proceed the execution of a running command initiated by FDL_Execute function Example do while true infinite scheduler loop proceed potential command execution FDL Handler 20ms time slize potential FDL requester 20 10ms time slize potential FDL requester k B 10 7 40ms time slize potential FDL requester 40 10ms time slize potential FDL requester Tas k D 10 wy aed ed RO1US0061ED0120 User Manual 7CENESAS 37 Data Flash Access Library Type 02 Tiny European Release User Interface 3 3 6 FDL_Abort Outline Function for erase command abo
32. cess Library T02 Tiny European Release FDL Usage by User Application 4 3 File Structure The Tiny FDL is delivered as precompiled library for CA78KOR IAR GNU and CC RL environments The library and its header files are stored in the ib subdirectory inside the installation folder The smp directory contains sample setups which are no integral part of the library itself and should be modified according to the project needs All files are listed in Table 15 Table 15 File structure of the Tiny FDL File Description lt installation folder gt fdl_info txt contains release specific information about the installed library lt installation folder gt lib FDL header file FDL interface definition 1 types h FDL header file FDL types definition fdl lib CA78KOR TURBO IAR precompiled library file GNU fdl lib installation folder gt smp C fdl_descriptor c descriptor calculation part fdl_descriptor h pool configuration part fdl_sample_linker_file dr CA78KOR fdl_sample_linker_file xcl fdl_sample_linker_file ld GNU fdl_sample_linker_file sub CC RL linker sample file lt installation folder gt smp asm descriptor asm descriptor calculation part fdl_descriptor inc pool configuration part fdl_sample_linker_file dr CA78KOR sample linker file sub CC RL linker sample file Note
33. ct descriptions of the CPU system control functions peripheral functions and electrical characteristics and usage notes Particular attention should be paid to the precautionary notes when using the manual These notes occur within the body of the text at the end of each section and in the Usage Notes section The revision history summarizes the locations of revisions and additions It does not list all revisions Refer to the text of the manual for details 2 Related documents Document number Description R01AN1416EDxxxx EEPROM Emulation Library Type TO2 Tiny European Release 3 List of Abbreviations and Acronyms Abbreviation Full form Block Smallest erasable unit of a flash macro Embedded Flash where the application code is stored Code Flash For devices without Data Flash EEPROM emulation might be implemented on that flash in the so called data area Embedded Flash where mainly the data of the Data Flash EEPROM emulation are stored Beside that also code operation might be possible Dual Operation Dual operation is the capability to fetch code during reprogramming of the flash memory Current limitation is that dual operation is only available between different flash macros Within the same flash macro it is not possible EEL EEPROM Emulation Library EEPROM emulation In distinction to a real EEPROM the EEPROM emulation uses some portion of the flash memo
34. cute req command_enu FDL_CMD_IVERIFY_BYTES or FDL_CMD_BLANKCHECK_BYTES req status_enu FDL_BUSY Blank Check x bytes FDL Handler OR Internal Verify x bytes req status enu FDL BUSY FDL Handler req status enu FDL OK Figure 7 Background operation Internal Verify Blankcheck R01USO0061ED0120 User Manual 134 NE SAS Data Flash Access Library Type T02 Tiny European Release Architecture 2 5 3 Background Operation Write Compared to the erase verify blankcheck command the write commands is running only partially in the background Each byte is written in the background whereas the administrative part of selecting the next byte is done by the FDL_Handler Therefore it is mandatory to call the FDL_Handler not only for checking the current progress but also to drive the command forward Data Flash hardware background FDL_Execute req command_enu FDL_CMD_WRITE_BYTES 1 T req status enu FDL BUSY J FDL_Handler req status_enu FDL_BUSY FDL_Handler req status_enu FDL_BUSY FDL_Handler req status_enu FDL_BUSY FDL_Handler req status_enu FDL_OK Figure 8 Background operation Write R01US0061ED0120 User Manual RENESAS 18 Data Flash Access Library
35. demarks are the property of their respective owners RO1US0061ED0120 User Manual 24 N S AS Data Flash Access Library Type T02 Tiny European Release Table of Contents Chapter 1 Introduction 1 1 Components of the EEPROM Emulation System 1 1 1 Physical Flash Layer 1 1 2 Flash Access Layer coerceri asia se niii aee 1 1 3 EEPROM Access Layer 1 1 4 Application Layer nunana nanana Chapter 2 Architecture 2 1 Data Flash Fragmentation 2 1 1 EEL N 2 2 Address Virtualization U aoa 2 3 Access Right Supervision J 2 4 Request Response Architecture 2 5 Background Operation dE Uu MED UNE 2 5 1 Background Operation 2 5 2 Background Operation Internal Verify and Blankcheck 2 5 3 Background Operation Write
36. 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 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 User Manual Data Flash Access Library Type T02 Tiny European Release Regional information Regional information Some information contained in this document may vary from country to country Before using any Renesas Electronics product in your application please contact the Renesas Electronics office in your country to obtain a list of authorized representatives and distributors They will verify e Device availability e Ordering information e Product release schedule e Availability of related technical literature e Development environment specifications for example specifications for third party tools and components host computers power plugs AC supply voltages and so forth e Network requirements In addition trademarks registered trademarks export restrictions and other legal issues may also vary from country to country Visit http Awww renesas com t
37. e TinyFDL In order to reduce the probability of type mismatches in the user application please make strict usage of the provided types and avoid using standard data types instead 3 2 1 Library specific simple Type Definitions This type defines simple numerical type used by the library typedef unsigned char typedef unsigned int typedef unsigned long int fdl u08 fdl 116 1323 3 2 2 Enumeration command t The enumeration type 9 command t defines all allowed codes used to specify library commands This type is used within the structure fdl request t see Section 3 2 4 in order to specify which command shall be executed via the function Execute A detailed description of each command can be found in Section 3 4 typedef enum fdl command t FDL CMD READ BYTES 0x00 FDL CMD IVERIFY BYTES 0x01 FDL CMD BLANKCHECK BYTE 0x02 FDL CMD WRITE BYTES 0x03 FDL CMD ERASE BLOCK 0x04 Note Due to the fact that the library has been implemented in Assembler it is mandatory that the enumeration type fdl command t has a size of exactly 1 byte The GNU compiler uses 16 bit enumeration types by default Therefore for GNU compiler the declaration of the enumeration type has to be extended with an attribute in order to be compiled to 1 byte attribute packed Table 1 Command codes Command Description
38. e configured as FDL pool 2 2 Address Virtualization To facilitate the access to the FDL pool the physical addresses were virtualized The virtualized pool looks like a simple one dimensional array R01US0061ED0120 12 User Manual 124 N S AS Data Flash Access Library Type T02 Tiny European Release Architecture FDL EEL Data Flash Pool C OXF2FFF d N Block 3 OxF2C00 0x0C00 OxF2BFF OxOBFF Block 2 OxF2800 0x0800 gt si aaa OxF27FF 0x07FF Block 1 0 2400 0 0400 Flash block 0x03FF and address transformation Block 0 0xF2000 0x0000 lt OxF1C00 OxF1BFF OxF 1800 OxF17FF gt EEL pool OxF 1400 OxF13FF EE Physical Virtual address byte index Figure 3 Relationship between physical and virtual pool addresses 2 3 Access Right Supervision As mentioned before the complete Data Flash is divided into two parts which are accessable by pool owner FDL does not allow user access to the EEL pool and vice versa R01US0061ED0120 User Manual RENESAS Data Flash Access Library Type T02 Tiny European Release Architecture R01US0061ED0120 User Manual N 1 FDL FDL pool access N N flash bytes 0 0000 FDL Figure 4 FDL pool access supervision RENESAS B Data Flash Access Library Type T02 Tiny European Release Architecture
39. eason O O ee ont remedy correct affected request member and try again meaning request cannot be accepted FDL ERR REJECTED normal reason other command is being executed remedy call FDL_Handler and try again meaning request was finished regular FDL OK normal reason no problems during execution remedy nothing RENESAS i Data Flash Access Library Type T02 Tiny European Release 3 4 4 Write The write command can be used for writing a number of bytes located in a RAM buffer to the data flash It is initiated by FDL_Execute and must be continued by FDL_Handler as long as command is not finished request status updated Note 1 An execution of write commands across block boundaries is not allowed As a result the byte count can range from 1 byte up to 1024 byte Note 2 For a regular write please follow the suggested sequence of blankcheck write internal verify in order to ensure full data retention Table 11 Request variable usage for write command index_u16 data_pu08 bytecount_u16 command_enu byte index inside the FDL pool pointer to the write buffer 1 byte to 1024 bytes byte count FDL_CMD_WRITE BYTES Table 12 Status of FDL_CMD_WRITE_BYTES Status Class Status meaning and handling meaning FDL not initialized or not opened FDL_ERR_INITIALIZATION heavy reason wrong handling on u
40. eature is a powerful especially in operation systems were each task could start FDL commands which will be executed in the background during task switching 2 5 1 Background Operation Erase The erase command is the longest command Once started the erase command is executed in the background leaving the user the option to execute other application tasks in the meantime By calling the FDL_Handler the current progress of the command can be checked via the status of the used request structure As shown in the figure below the application has the possibility to execute other user code during the background operation Data Flash USER hardware background FDL_Execute req command_enu FDL_CMD_ERASE_BLOCk req status_enu FDL_BUSY FDL_Handler req status_enu FDL_BUSY FDL_Handler Y T req status_enu FDL_BUSY FDL_Handler req status_enu FDL_BUSY FDL_Handler req status_enu FDL_OK Figure 6 Background operation Erase R01US0061ED0120 16 User Manual 2 N S AS Data Flash Access Library Type T02 Tiny European Release Architecture 2 5 2 Background Operation Internal Verify and Blankcheck Just like the erase command also the internal verify and the blankcheck are performed in the background once they have been triggered Data Flash USER hardware background FDL_Exe
41. g voltage mode full wide It shall be chosen by the user e wide voltage mode 08 shall be set to 1 for wide voltage mode e wide voltage mode 08 shall be set to 0 for full speed voltage mode For details of the voltage mode refer to the user s manual of the target RL78 microcontroller R01US0061ED0120 User Manual 24 N S AS User Interface API 27 Data Flash Access Library T02 Tiny European Release User Interface API 3 3 Functions 3 3 1 FDL_Init Outline Initialization of the Flash Data Library Interface C Interface for CA78KOR Compiler fal status t far FDL Initiconst _ far 191 descriptor t descriptor pstr C Interface for IAR Compiler func status t FDL Initi const _ idl descriptor t _ descriptor pstr C Interface for GNU Compiler fdl status t FDL Init const fdl descriptor t 3X descriptor pstr _ ateribute _ sooLion FDL y C Interface for CC RL Compiler fdl status t far FDL Initi const far fdl descriptor t descriptor ASM function label FDL Init Arguments Parameters Passed via CA78KOR IAR GNU CC RL BC highw A high loww SIAK BAUK DE loww Pointer to the descriptor describing the FDL configuration The virtualization of the data flash address room is done based on that descriptor The user can use different descriptors to switch
42. h enable SFR same procedure for FDL CMD ERASE BLOCK FDL_CMD_WRITE_BYTES and FDL CMD IVERIFY BYTES Figure 11 StandBy and WakeUp sequence Note It is not allowed to call any FDL function other than FDL_WakeUp and FDL Handler when FDL is in StandBy mode R01US0061ED0120 User Manual RENESAS a Data Flash Access Library T02 Tiny European Release User Interface API Chapter 3 User Interface API 3 1 Run time Configuration The configuration of the FDL can be changed dynamically at runtime Thereby more than one descriptor constant has to be defined by the user in advance Depending on the application different descriptors can be used for the FDL Init function JUS aab qud edu Wed ui ge some code id Cee ee eee load standard descriptor my status FDL Init efdl descriptor str some code 7 PE _ _ bonus has Close load alternative descriptor EF my status FDL Init amp fdl descr 2 str ee ee Ug t some code f Note Before changing FDL pool configuration by using a different FDL pool descriptor the user has to finish all running FDL EEL commands and close the FDL via the Close function RO1US0061ED0120 User Manual RENESAS BS Data Flash Access Library T02 Tiny European Release User Interface API 3 2 Data Types This chapter describes all data definitions used by th
43. handler E G CONTINUE WITH LIBRARY APPLICATION EXECUTION HERE usus ss wawa awa 42 lt Data Flash Access Library Type T02 Tiny European Release User Interface API 3 3 8 FDL WakeUp Outline Function to wake up the library from StandBy mode Interface C Interface for CA78KOR Compiler far func fdl status t FDL WakeUp void C Interface for IAR Compiler fdl status t _ far FDL WakeUp void C Interface for GNU Compiler fdl status t FDL WakeUp void _ attribute section FDL CODE C Interface for CC RL Compiler far func fdl status t FDL WakeUp void ASM function label FDL WakeUp Arguments Parameters none Return value Passed via Type CAT78KOR IAR GNU CC RL R8 A A status t C X bank 1 FDL OK when FDL is up and running FDL ERR REJECTED when library isn t in StandBy mode Destructed registers Tool chain Destructed registers CA78KOR None IAR None GNU None CC RL x R01US0061ED0120 43 User Manual RENESAS Data Flash Access Library Type T02 Tiny European Release User Interface API Pre The library initialization and open via FDL Init and FDL Open shall be done before conditions calling this function Post Data flash clock is switched on and library is up and running conditions Description The main purpose of this function is to
44. hange between the application and the FDL A request variable is passed to the FDL to initiate a command and can be used by the requester EEL application to check the status of its execution Not every element of this structure is required for each command However all members of the request variable must be initialized once before usage Please refer to Section 3 4 for a more detailed description and the command specific usage of the structure elements FDL request type bas type for any FDL access typedef struct fdl ul near fdl u08 fal ulg fdl command t fal status fdl request tj index 116 data pu08 bytecount ul6 command enu Status enu Note The GNU compiler does not require the near keyword to declare near pointers All pointers are near by default as long as keyword is not used Table 3 Structured type fdl request t details Struct member Description Start address of the target area e Erase virtual block number inside FDL pool index u16 e Read write blankcheck internal verify virtual byte number inside FDL pool data 08 Pointer to the first byte of the data buffer to be written or read Only used for read write commands bytecount u16 Number of bytes to be transferred starting from the start byte specified in index u16 The byte count range is from 1 byte to 1024 bytes Please note that the execution of the read write blan
45. he byte count can range from 1 byte up to 1024 byte Table 7 Request variable usage for internal verify command index_u16 data_pu08 bytecount_u16 command_enu byte index unused byte count FDL_CMD_IVERIFY_ inside the FDL pool 1 byte to 1024 bytes BYTES Table 8 Status of FDL_CMD_IVERIFY_BYTES Status Class Status meaning and handling meaning FDL not initialized or not opened FDL_ERR_INITIALIZATION heavy reason wrong handling on user side remedy initialize and open FDL before using it FDL is in standby and cannot accept new meaning commands FDL_ERR_STANDBY heavy reason wrong handling on user side call FDL_WakeUp before initiating new remedy commands meaning request cannot be accepted wrong command code index outside the used POR ERR PARAMETER heavy reason pool or request data structure on odd address remedy correct affected request member and try again at least one byte within the specified pool area meaning could not be verified FDL ERR BLANK VERIFY light any bit in the addressed flash word is not electrically correct remedy nothing free interpretation at requester side meaning request cannot be accepted FDL ERR REJECTED normal reason other command is being executed remedy Handler and try again meaning request is being processed FDL BUSY reason request checked and accepted remedy
46. ialized before calling EEL Execute Otherwise a RAM parity error may cause a reset of the device For details please refer to the document User s Manual Hardware of your RL78 product Note 2 The request structure used for execution has to be word aligned i e located at an even memory address Example _ Hear fal request t my request str near fdl 108 buffer 4 bufter 0 0x01 0x23 0x45 0x67 my fdl request index 116 0x0000 my fdl request data pu08 near fdl u08 buffer my fdl request bytecount_ulb 0x0004 my fdl request command enu FDL CMD WRITE BYTES command initiation do FDL Execute amp my fdl request FDL Handler proceed background process while my fdl request status enu FDL ERR REJECTED command execution do FDL Handler while my fdl request status enu FDL BUSY if my fdl request status enu FDL OK error handler R01US0061ED0120 35 User Manual NE SAS Data Flash Access Library T02 Tiny European Release User Interface API 3 3 5 FDL_Handler Outline Function for command proceeding Interface C Interface for CA78KOR Compiler void far Handl r void C Interface for Compiler __far func void FDL Handler void C Interface for GNU Compiler void FDL Handler void attribute section FDL CODE C Interf
47. ice 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 equipment communications equipment test and measurement equipment RO1US0061ED0120 RENESAS audio and visual equipment home electronic appliances machine tools personal electronic equipment and industrial robots High Transportation equipment automobiles trains ships etc traffic control systems anti disaster Quality 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 spec
48. ified ranges Although Renesas Electronics endeavours 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 certain 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
49. iler __far func void FDL Close void C Interface for GNU Compiler void FDL Close void attribute section FDL CODE C Interface for CC RL Compiler void FDL Close void ASM function label FDL Close Arguments Parameters none Return value none Destructed registers Tool chain Destructed registers CA78KOR None IAR None GNU None CC RL C Pre The library initialization and open via FDL_Init and FDL_Open shall be done before conditions calling this function If FDL is not yet activated the FDL_Close has no functionality Post Data flash clock is switched off All hardware background activities will be stopped conditions immediately R01US0061ED0120 User Manual RENESAS Pe Data Flash Access Library Type T02 Tiny European Release User Interface API Description This function must be used by the application to deactivate the data flash Example FDL Close RO1US0061ED0120 User Manual RENESAS 88 Data Flash Access Library T02 Tiny European Release User Interface API 3 3 4 FDL_Execute Outline Initiates the execution of an FDL command Interface C Interface for CA78KOR Compiler void PUL Execute near fdl request t request pstr C Interface for IAR Compiler far func void FDL Execute near fdl request t request pstr C Interface for GNU Compiler void FDL Exec
50. kcheck internal verify command across block boundaries is not allowed This struct member is not required for erase command command enu Command code to be executed status enu Request status code feedback R01US0061ED0120 User Manual RENESAS 5 Data Flash Access Library T02 Tiny European Release User Interface API 3 2 5 Structured Type fdl descriptor t This type defines the structure of the FDL descriptor It contains all characteristics of the FDL It is used in the fdl descriptor c sample file for definition of the ROM constant fdl descriptor str Based on configuration data inside the fdl descriptor h the initialization data of descriptor constant is generated automatically in the fdl descriptor c FDL descriptor type typedef struct fdl 116 eel pool bytes ul6 016 fal pool bytes 116 fdl 116 fdl delay 116 fdl u08 eel pool blocks u08 fdl u08 fdl pool blocks u08 fdl u08 fx MHz u08 fal ugg wide voltage mode 108 fdl descriptor t Table 4 Structured type fdl descriptor t details Struct member Description EEL pool size in bytes It shall be computed by the compiler pre processor based on the following formula DATA FLASH BLOCK SIZE eel pool blocks u08 DATA FLASH BLOCK SIZE is the physical size of a Flash block specified in the device HW user manual eel pool bytes u16 FDL pool size in bytes It shall be computed by the co
51. lation Library EEL or alternatively any other user specific implementation 1 1 4 Application Layer The application layer represents user s application software that can freely access all visible specified by the API definition commands The EEPROM layer and the flash access layer can be used simultaneously The FDL manages the access rights to it in a proper way R01US0061ED0120 11 User Manual 24 N S AS Data Flash Access Library Type T02 Tiny European Release Architecture Chapter 2 Architecture This chapter describes the overall architecture of the Tiny FDL 2 1 Data Flash Fragmentation The physical address range of the Data Flash depends on the utilized hardware e g for RL78 G13 OxF1000 OxF1FFF However the logical fragmentation of the Data Flash can be configured within the given range Following figure shows the logical fragmentation of RL78 G13 physical Data Flash OxF 1 FFF Data Flash FDL pool Access by application only EEL pool Access by EEL only OxF 1000 Figure 2 Logical fragmentation of physical Data Flash 2 1 1 EEL Pool The EEL pool is exclusively used by the Renesas EEPROM Emulation Library EEL In case the EEL is not used the whole Data Flash can be reserved as FDL pool 2 1 2 FDL Pool The FDL pool is exclusively used by the application In case of a proprietary EEPROM emulation implementation user specific the complete FDL pool has to b
52. lectronics has used reasonable care in preparing the information included in this document but 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 7 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 RO1US0061ED0120 User Manual 12 N S AS 8 Data Flash Access Library Type T02 Tiny European Release Not
53. mpiler pre processor based on the following formula DATA FLASH BLOCK SIZE eel pool blocks u08 DATA FLASH BLOCK SIZE is the physical size of a Flash block specified in the device HW user manual fd pool bytes u16 Constant delay depending on configured frequency It shall be computed by the compiler pre processor by the elay HB following formula 10 fx MHz 08 6 EEL pool size in blocks It shallbe chosen by the user with the condition that eel_pool_blocks_u08 fdl_pool_blocks_u08 eel pool blocks u08 may not exceed the size of the data flash specified in the device HW user manual FDL pool size in blocks It shall be chosen by the user with the condition that fdl pool blocks u08 fdl pool blocks u08 eel pool blocks u08 may not exceed the size of the data flash specified in the device HW user manual RO1US0061ED0120 RENESAS 26 User Manual Data Flash Access Library Type T02 Tiny European Release Struct member Description fx MHz u08 CPU frequency Frequency must be rounded up as follows descr fx MHz u08 SYSTEM FREQUENCY 999999 1000000 FDL SYSTEM FREQUENCY specifies the device frequency and not the HOCO internal high speed on chip oscillator frequency In case the frequency is smaller than 4MHz the only supported physically frequencies by FDL are the following 1MHz 1000000Hz 2MHz 2000000Hz and 3MHz 3000000Hz wide voltage mode u08 Programmin
54. n described in this document No license express implied or otherwise is granted hereby under any patents copyrights or other intellectual property rights of Renesas Electronics or others 3 You should not alter modify copy or otherwise misappropriate any Renesas Electronics product whether in whole or in part 4 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 5 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 6 Renesas E
55. o get in contact with your regional representatives and distributors R01US0061ED0120 User Manual 124 N S AS Data Flash Access Library Type T02 Tiny European Release Preface Readers Preface This manual is intended for users who want to understand the functions of the concerned libraries Purpose This manual presents the software manual for the concerned libraries Numeric Binary XXXX or xxxB notation Decimal XXXX Hexadecimal xxxx Numeric Representing powers of 2 address space memory capacity prefix K kilo 210 1024 M mega 220 1024 1 048 576 G giga 230 1024 1 073 741 824 Register X x don t care Diagrams Block diagrams do not necessarily show the exact software flow but the functional structure Timing diagrams are for functional explanation purposes only without any relevance to the real hardware implementation R01US0061ED0120 5 User Manual 12 NE S AS Data Flash Access Library Type T02 Tiny European Release How to Use This Document How to Use This Document 1 Purpose and Target Readers This manual is designed to provide the user with an understanding of the hardware functions and electrical characteristics of the MCU It is intended for users designing application systems incorporating the MCU A basic knowledge of electric circuits logical circuits and MCUs is necessary in order to use this manual The manual comprises an overview of the produ
56. or CC RL compiler the library takes care in the code to define these sections with TEXTF_UNIT64KP relocation attribute For IAR compiler the user has to ensure that the linker file specifies the Flash page size equal to 64K when defining FDL CODE and FDL_CNST sections e For GNU compiler the user shall take care that FDL CODE and FDL_CNST sections are not mapped across any boundary of 64KB Flash page e The library initialization by FDL Init must be performed before the execution of FDL Open FDL Close FDL Handler Execute FDL Abort StandBy FDL WakeUp e It is not allowed to read the data flash directly meaning without FDL during a command execution of the FDL e Each request variable must be located at an even address e Before executing any command all members of the request variable must be initialized If there are any unused members in the request variable please set arbitrary values to these members e All functions are not re entrant That means it is not allowed to call FDL functions inside the ISRs while any FDL function is already running e Task switches context changes and synchronization between FDL functions e All FDL functions depend on FDL global available information and are able to modify this information In order to avoid synchronization problems it is necessary that at any time only one FDL function is executed So it is not allowed to start an FDL function then switch to another task
57. pulse is initiated otherwise the erase command will be finished immediately Table 13 Request variable usage for erase command index u16 data 08 bytecount u16 command_enu inj unused unused POR GMD ERASE inside the FDL pool BLOCK Table 14 Status of FDL_CMD_ERASE_BLOCK Status Class Status meaning and handling meaning FDL not initialized or not opened FDL_ERR_INITIALIZATION heavy reason wrong handling on user side remedy initialize and open FDL before using it FDL is in standby and cannot accept new meaning commands FDL_ERR_STANDBY heavy reason wrong handling on user side call FDL_WakeUp before initiating new remedy commands meaning request cannot be accepted wrong command code index outside the used POL ERM PARAMETER heavy SESER pool or request data structure on odd address remedy correct affected request member and try again at least one byte within the specified pool area meaning is not blank PORE ERR ERABE heavy reason internal flash problems remedy do not use this block anymore meaning request cannot be accepted FDL_ERR_REJECTED normal reason other command is being executed remedy call FDL_Handler and try again meaning block oriented command has been aborted FDL ERR ABORTED normal reason FDL_Abort has been called by the user during block command execution remedy restart the erase command
58. r bank switch is performed by the library Return values are placed in register bank 1 For details on GNU calling conventions please refer to the GNU documentation for RL78 devices RO1US0061ED0120 User Manual RENESAS a8 Data Flash Access Library T02 Tiny European Release FDL Usage by User Application 4 4 5 Stack and Data Buffer The Tiny FDL utilizes the same stack as specified in the user application It is the developer s duty to reserve enough free stack for the operation of both user application and FDL The data buffer used by the Tiny FDL refers to the RAM area in which data is located that is to be written into the data flash and where data is to be copied to when read is performed These buffers need to be allocated and managed by the user Note In order to allocate the stack and data buffer to a user specified address please utilize the link directives of your framework Caution In contrast to the internal FDL data FDL SDAT segment both stack and data buffer may not be allocated in the short address range from OxFFE20 to OxFFEFF and also not in the prohibited RAM area if it exists in the target device 4 4 6 Request Structure Depending on the user application architecture more than one request variable could be necessary e g in case of accessing the EEL from different tasks 4 5 General Flow 4 5 1 Initialization The following figure illustrates the initialization flow FDL Init
59. rtion Interface C Interface for CA78KOR Compiler fdl status t _ far FDL Abort void C Interface for Compiler far func fdl status t FDL Abort void C Interface for GNU Compiler fdl status t FDL Abort void _ attribute section FDL CODE C Interface for CC RL Compiler fdl status t far FDL Abort void ASM function label FDL Abort Arguments Parameters none Return value Passed via Type CA78KOR IAR GNU CC RL R8 A A status t C X bank 1 FDL OK when either no command is running or erase has been aborted FDL BUSY when byte oriented command is still running Destructed registers Tool chain Destructed registers CA78KOR None IAR None GNU None CC RL BC HL in Manual didi RENESAS 38 Data Flash Access Library T02 Tiny European Release User Interface API Pre The library initialization and open via FDL_Init and FDL_Open shall be done before conditions calling this function Post In case of arunning erase the command will be aborted and requester will be informed conditions the request status FDL ERR ABORTED Description This function enables the application to abort a running erase command independent of the affected pool immediately The requester will be informed regarding the stopped erase via the request status FDL_ERR_ABORTED In such case the application shall re star
60. ry to emulate the EEPROM behavior To gain a similar behavior some side parameters have to be taken in account FDL Data Flash Library Data Flash access layer Flash Electrically erasable and Flash programmable nonvolatile memory The difference to ROM is that this type of memory can be re programmed several times A flash block is the smallest erasable unit of the flash Flash Block memory RO1US0061ED0120 6 User Manual 24 N S AS Data Flash Access Library Type T02 Tiny European Release How to Use This Document Abbreviation Full form A flash comprises of the cell array the sense amplifier Flash Macro and the charge pump CP For address decoding and access some additional logic is needed Non volatile memory All memories that hold the value NVM even when the power is cut off E g Flash memory EEPROM MRAM Random access memory volatile memory with RAM random access ROM Read only memory nonvolatile memory The content of that memory can not be changed Serial programming The onboard programming mode is used to program the device with an external programmer tool Single Voltage For the reprogramming of single voltage flashes the voltage needed for erasing and programming are generated onboard of the microcontroller No external voltage needed like for dual voltage flash types All trademarks and registered tra
61. ser side remedy initialize and open FDL before using it FDL is in standby and cannot accept new meaning commands FDL_ERR_STANDBY heavy reason wrong handling on user side call FDL_WakeUp before initiating new remedy commands meaning request cannot be accepted wrong command code index outside the used PRE ERR EARAMETER heavy pool or request data structure on odd address remedy correct affected request member and try again at least one byte within the specified pool area meaning is not blank FDL ERR WRITE heavy any bit in the addressed flash word is not reason electrically correct remedy nothing free interpretation at requester side meaning request cannot be accepted FDL ERR REJECTED normal reason other command is being executed remedy call FDL Handler and try again meaning request is being processed FDL BUSY reason request checked and accepted nothing call FDL_Handler until status remedy changes meaning request was finished regularly FDL_OK normal reason no problems during execution remedy nothing RO1US0061ED0120 User Manual RENESAS User Interface API 50 Data Flash Access Library T02 Tiny European Release User Interface API 3 4 5 Erase The erase operation can be used to erase one block of the pool After starting the erase command the hardware is checking if the addressed block is already blank to avoid unnecessary erase cycles In case the block is not blank the erase
62. sh via the FDL e Execution of byte commands blankcheck internal verify write and read across block boundaries is not allowed R01US0061ED0120 65 User Manual 124 N S AS Data Flash Access Library Type T02 Tiny European Release Revision History Chapter Page Description Initial revision Revision V1 10 32 23 Add a more detailed description of types and their meaning 3 3 27 Adding description of GNU API 4 3 51 Extend file structure for GNU 4 4 4 52 Add register bank selection chapter 5 1 59 Updated resource consumption information 6 62 Explain how library can be mapped in the same 64K flash page for each compiler Revision V1 20 3 3 28 Adding description of CC RL API 4 3 54 Extended file structure for CC RL all all Renesas REN Compiler renamed to CA78KOR 3 4 3 4 Byte count range specification added 5 1 62 Resource consumption added for CC RL RENESAS Revision History 67 Data Flash Access Library N ESAS R01US0061ED0120 Renesas Electronics Corporation
63. t the erase command otherwise the block cannot be used Other commands like blankcheck write and verify cannot be aborted and therefore have to be finished properly If the application calls this function during the above described byte commands the return value FDL_BUSY will be returned That means a byte command is still running Please re call the FDL Abort functions as long as the status is BUSY Only when the return value is changed to FDL OK the command is properly finished Example _ near fdl request t my fdl request str _ near fdl 108 cmd finished 0 request structure initialization fdl request index 116 0x0000 my fdl request data pu08 near fdl u08 0x0000 my fdl request bytecount ul6 0x0000 my fdl request command enu fdl command t OxFF my fdl request status enu FDL ERR PARAMETER set erase command my fdl request index 116 0x0000 my fdl request command enu FDL CMD ERASE BLOCK HHPHHHHHEHHHEHHHEHE TASK 1 t TRY TO ERASE HERE ONE BLOCK dea at ae aE aE a aE Ea aE aE aE EE aE aE EE EE EEE EEE EE EE EERE FDL Execute request cmd finished 0 while cmd_finished 0 switch my fdl request status enu case FDL BUSY FDL Handler break case FDL ERR ABORTED start erase again in case it was aborted FDL Execute fdl request FDL Handler break
64. tionality to read write and erase the Data Flash memory at smallest possible granularity Beside the pure access commands some maintenance functionality to check the quality of the flash content is also provided by the library R01US0061ED0120 10 User Manual 134 NE SAS Data Flash Access Library Type 02 Tiny European Release Introduction 1 1 Components of the EEPROM Emulation System To achieve a high degree of encapsulation the EEPROM emulation system is divided into several layers with narrow functional interfaces 1 1 1 Physical Flash Layer The FDL is accessing the Data Flash as a physical media for storing data in the EEPROM emulation system The Data Flash is a separate memory that can be accessed independent of the Code Flash memory This allows background access to data stored in the Data Flash during program execution located in the code flash 1 1 2 Flash Access Layer The flash access layer is represented by the flash access library provided by Renesas In case of devices incorporating data flash the Data Flash Library FDL is representing this layer It offers all atomic functionality to access the Data Flash To isolate the data flash access from the used flash media this layer the FDL is transforming the physical addresses into a virtual linear address room 1 1 3 EEPROM Access Layer The EEPROM layer allows read write access to the Data Flash on an abstract level It is represented by a Renesas EEPROM Emu
65. ute fdl request t request pstr attribute seotion FDL CODE C Interface for CC RL Compiler void far FDL Execute near fdl request t request pstr ASM function label FDL Execute Arguments Parameters Passed via Argument Type Access CA78KOR IAR GNU CC RL request pstr request t near RW AX AX stack AX This argument defines the command which should be executed by FDL It is a request variable which is used for bidirectional information exchange before and during execution between FDL and the application For details please refer to the Request Response Architecture chapter Return value none Destructed registers Tool chain Destructed registers CA78KOR AX IAR AX HL CS ES GNU None CC RL AX BC DE HL User Manual RENESAS Data Flash Access Library Type T02 Tiny European Release User Interface API Pre The library initialization and open via FDL Init and FDL Open shall be done before conditions calling this function Post None conditions Description This is the main function of the FDL which can be used inside of the application to initiate the execution of any command Please refer to the chapter Commands for detailed explanation of each command Note 1 Although there are commands that do not require all request structure elements to be specified the whole structure needs to be init
66. via FDL_Execute meaning request is being processed FDL_BUSY normal reason request checked and accepted nothing call FDL_Handler until status remedy changes meaning request was finished regularly FDL_OK normal reason no problems during execution remedy nothing RO1US0061ED0120 51 User Manual RENESAS Data Flash Access Library T02 Tiny European Release User Interface API 3 5 Basic functional Workflow To be able to use the FDL execute pool related commands in a proper way the requester has to follow a specific startup and shutdown procedure Power OFF N POWER OFF O FDL_Init FDL_WakeUp FDL_Close request status lt gt busy FDL_StandBy FDL_Open FDL_Execute CMD FDL_Abort erase command only FDL Handler also indirectly via FDL_StandBy and FDL Abort Figure 12 Basic flowchart R01USO0061ED0120 User Manual 134 NE SAS Data Flash Access Library T02 Tiny European Release FDL Usage by User Application Chapter 4 FDL Usage by User Application 4 1 First Steps It is very important to have theoretic background about the Data Flash and the FDL in order to successfully integrate the library into the user application Therefore it is important to read this user manual completely in advance especially chapter Cautions 4 2 Special Considerations 4 2 1 Reset Consistency During the execution of FDL commands write and erase a
Download Pdf Manuals
Related Search
Related Contents
入札説明書に関する質問への回答書 GTI 1500 Administrationshandbuch - At Operating instructions Ørsted INDICE INDEX EMULSUR-N Peerless ACC840 SPARC Enterprise M3000 Server Overview Guide Dixon 3000 Series Lawn Mower User Manual Copyright © All rights reserved.
Failed to retrieve file