Renesas RL78 Series Application Note

Renesas RL78 Series Application Note

Vde certified self test library
Hide thumbs Also See for RL78 Series:

Advertisement

Quick Links

RL78 Family
VDE Certified IEC60730/60335 Self Test Library
Introduction
Today, as automatic electronic controls systems continue to expand into many diverse applications, the requirement of
reliability and safety are becoming an ever increasing factor in system design.
For example, the introduction of the IEC60730 safety standard for household appliances requires manufactures to
design automatic electronic controls that ensure safe and reliable operation of their products.
The IEC60730 standard covers all aspects of product design but Annex H is of key importance for design of
Microcontroller based control systems. This provides three software classifications for automatic electronic controls:
1. Class A: Control functions, which are not intended to be relied upon for the safety of the equipment.
Examples: Room thermostats, humidity controls, lighting controls, timers, and switches.
2. Class B: Control functions, which are intended to prevent unsafe operation of the controlled equipment.
Examples: Thermal cut-offs and door locks for laundry equipment.
3. Class C: Control functions, which are intended to prevent special hazards
Examples: Automatic burner controls and thermal cut-outs for closed.
Appliances such as washing machines, dishwashers, dryers, refrigerators, freezers, and Cookers / Stoves will tend to fall
under the classification of Class B.
This Application Note provides guidelines of how to use flexible sample software routines to assist with compliance
with IEC60730/60335 class B safety standards. These routines have been certified by VDE Test and Certification
Institute GmbH. A copy of the Test Certificate is available in the download package for this Application Note together
with the certified self test library source code and the test harness IAR project
Although these routines were developed using IEC60730/60335 compliance as a basis, they can be implemented in any
system for self testing of Renesas Microcontroller families.
These software routines provided are designed to be used after the system power on, or reset condition and also during
the application program execution. The end user has the flexibility of what routines are included and how to integrate
these routines into their overall application system design. This document and the accompanying test harness code
provide examples of how to do this.
Note. This document is based on the European Norm EN60335-1:2002/A1:2004 Annex R, in which the Norm IEC
60730-1 (EN60730-1:2000) is used in some points. The Annex R of the mentioned Norm contains just a single sheet
that jumps to the IEC 60730-1 for definitions, information and applicable paragraphs.
R01AN0749EG0201 Rev.2.01
Mar 04, 2014
APPLICATION NOTE
R01AN0749EG0201
Rev.2.01
Mar 04, 2014
Page 1 of 50

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the RL78 Series and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Renesas RL78 Series

  • Page 1 Although these routines were developed using IEC60730/60335 compliance as a basis, they can be implemented in any system for self testing of Renesas Microcontroller families. These software routines provided are designed to be used after the system power on, or reset condition and also during the application program execution.
  • Page 2 RL78 Family VDE Certified IEC60730/60335 Self Test Library Target Devices RL78 Family R01AN0749EG0201 Rev.2.01 Page 2 of 50 Mar 04, 2014...
  • Page 3: Table Of Contents

    RL78 Family VDE Certified IEC60730/60335 Self Test Library Contents     Self Test Libraries Introduction ......................4 •     CPU Registers ........................... 4 •     Invariable Memory ..........................4 •     Variable Memory ..........................4 •    ...
  • Page 4: Self Test Libraries Introduction

    RL78 Family VDE Certified IEC60730/60335 Self Test Library Self Test Libraries Introduction The self test library (STL) provides self test functions covering the CPU registers, internal memory and system clock. The library test harness provides an Application Programmers Interface (API) for each of the self test modules, which are described in this applications note.
  • Page 5: Self Test Library Functions

    RL78 Family VDE Certified IEC60730/60335 Self Test Library Self Test Library Functions CPU Register Tests This section describes CPU register tests routines. The test harness control file ‘main.c’ provides examples of the API for each of the CPU register tests using “C” language. These modules test the fundamental aspects of the CPU operation.
  • Page 6 RL78 Family VDE Certified IEC60730/60335 Self Test Library • Code Address Extension Register (CS) Figure 5 Working Register Configuration • Data Address Extension Register (ES) Figure 6 Working Register Configuration R01AN0749EG0201 Rev.2.01 Page 6 of 50 Mar 04, 2014...
  • Page 7 RL78 Family VDE Certified IEC60730/60335 Self Test Library 2.1.1 CPU Register Tests - Software API Table 1: Source files: CPU Working Registers Tests STL File name Header Files stl_RL78_registertest.asm None Test Harness File Names Header Files main.c stl.h stl_global_data_example.c main.h stl_main_example_support function.c stl_gobal_data_example.h stl_peripheralinit.c...
  • Page 8 RL78 Family VDE Certified IEC60730/60335 Self Test Library Table 2: Source files: CPU Registers Tests – PSW STL File name Header Files stl_RL78_registertest_psw.asm stl.h Test Harness File Names Header Files main.c main.h stl_global_data_example.c stl_gobal_data_example.h stl_main_example_support function.c stl_peripheralinit.c Syntax bool stl_RL78_registertest_psw(void) Description Test the 8bit Processor Status Word (PSW) register The following tests are performed:...
  • Page 9 RL78 Family VDE Certified IEC60730/60335 Self Test Library Table 3: Source files: CPU Registers Tests - SP STL File name Header Files stl_RL78_registertest_stack.asm stl.h Test Harness File Names Header Files main.c main.h stl_global_data_example.c stl_gobal_data_example.h stl_main_example_support function.c stl_peripheralinit.c Syntax bool stl_RL78_registertest_stack(void) Description Test the 16bit Stack Pointer (SP) register The following tests are performed:...
  • Page 10 RL78 Family VDE Certified IEC60730/60335 Self Test Library Table 4: Source files: CPU Registers Tests - CS STL File name Header Files stl_RL78_registertest_cs.asm stl.h Test Harness File Names Header Files main.c main.h stl_global_data_example.c stl_gobal_data_example.h stl_main_example_support function.c stl_peripheralinit.c Syntax bool stl_RL78_registertest_cs(void) Description Test the 8bit code extension (CS) register The following tests are performed:...
  • Page 11 RL78 Family VDE Certified IEC60730/60335 Self Test Library Table 5: Source files: CPU Registers Tests - ES STL File name Header Files stl_RL78_registertest_es.asm stl.h Test Harness File Names Header Files main.c main.h stl_global_data_example.c stl_gobal_data_example.h stl_main_example_support function.c stl_peripheralinit.c Syntax bool stl_RL78_registertest_es(void) Description Test the 8bit data extension (ES) register The following tests are performed:...
  • Page 12: Invariable Memory Test - Flash Rom

    RL78 Family VDE Certified IEC60730/60335 Self Test Library Invariable Memory Test – Flash ROM This section describes the Flash memory test using CRC routines. CRC is a fault / error control technique which generates a single word or checksum to represent the contents of memory. A CRC checksum is the remainder of a binary division with no bit carry (XOR used instead of subtraction), of the message bit stream, by a predefined (short) bit stream of length n + 1, which represents the coefficients of a polynomial with degree n.
  • Page 13 RL78 Family VDE Certified IEC60730/60335 Self Test Library 2.2.2 Software CRC - Software API The functions in the remainder of this section are used to calculate a CRC value and verify its correctness against a reference value stored in Flash ROM. Table 6: Source files: Software CRC STL File name Header Files...
  • Page 14 RL78 Family VDE Certified IEC60730/60335 Self Test Library Source files: Software CRC Parameter Structure The following structure is implemented in the files stl.h main.c and is used to provide calculation parameters for the for the CRC function. Syntax static CHECKSUM_CRC_TEST_AREA checksum_crc; Description Structure declaration and instance providing the parameters to be passed to software CRC module (stl_RL78_sw_crc.asm) by the calling function in...
  • Page 15 RL78 Family VDE Certified IEC60730/60335 Self Test Library Syntax uint16_t stl_RL78_peripheral_crc(uint16_t gcrc, CHECKSUM_CRC_TEST_AREA *p) Description This function calculates a CRC value over the address range supplied using the hardware CRC peripheral. The start address and calculation range (Length) are passed by the calling function via the structure detailed in the table below. The calculated result is returned.
  • Page 16: Variable Memory - Sram

    RL78 Family VDE Certified IEC60730/60335 Self Test Library Variable memory - SRAM March Tests are a family of tests that are well recognised as an effective way of testing RAM. A March test consists of a finite sequence of March elements, where a March element is a finite sequence of operations applied to every cell in the memory array before proceeding to the next cell.
  • Page 17 RL78 Family VDE Certified IEC60730/60335 Self Test Library March X The March X algorithm is a simpler and therefore faster algorithm, but not as thorough as it consists of only four March elements with a total of four operations 1. Stuck At Faults (SAF) 2.
  • Page 18 RL78 Family VDE Certified IEC60730/60335 Self Test Library 2.3.2 Variable Memory Test - Software API 2.3.2.1 System March C The system March C test is designed to run after the application system has been initialised and is executed using normal function call from the test harness, thus using some C stack resources. The module can be used to test part or all of the Ram area, but as the test is destructive, care should be taken to buffer the area being tested Therefore it is not advised to use this module to test the whole RAM memory area in a single operation.
  • Page 19 RL78 Family VDE Certified IEC60730/60335 Self Test Library 2.3.2.2 System March X The system March X self test function is the essentially the same as the system March C module except that it only implements the reduced March X algorithm. The module is designed to run after the application system has been initialised and so should not be used to test the whole memory area in a single operation.
  • Page 20 RL78 Family VDE Certified IEC60730/60335 Self Test Library 2.3.2.3 Initial March C The initial March C test is designed to run before the application system has been initialised and is executed without using function calls from the test harness. Entry to the self test is made by a “jump” from the modified “cstartup.s87” module and return to “cstartup.s87”...
  • Page 21 RL78 Family VDE Certified IEC60730/60335 Self Test Library 2.3.2.4 Initial March X The initial March X test is designed to run before the application system has been initialised and is executed without using function calls from the test harness. Entry to the self test is made by a “jump” from the modified “cstartup.s87” module and return to “cstartup.s87”...
  • Page 22: System Clock Test

    RL78 Family VDE Certified IEC60730/60335 Self Test Library System Clock Test Two self test modules (hardware and software base) are provided for the RL78 self test library in order to be able to test the internal system clock (CPU and Peripheral clocks). The software measurement module is included for backward compatibility with previous products and also to allow for any RL78 devices where the Timer Array does not include the additional hardware capability, or that the timer is used by the application and is not available to be used as part of the MCU self tests.
  • Page 23 RL78 Family VDE Certified IEC60730/60335 Self Test Library The principle behind the hardware measurement is based on the input capture measurement of the reference clock in the appropriate TAU channel. As this is a hardware capture measurement the time captured is the “period” of the reference clock as a of the system clock.
  • Page 24 RL78 Family VDE Certified IEC60730/60335 Self Test Library Figure 8 Timer Array Unit Channel 5 Configuration R01AN0749EG0201 Rev.2.01 Page 24 of 50 Mar 04, 2014...
  • Page 25 RL78 Family VDE Certified IEC60730/60335 Self Test Library Table 12: Source files: Software Clock test STL File name Header Files stl_RL78_sw_clocktest.asm stl_clocktest.h stl.h Test Harness File Names Header Files main.c main.h stl_global_data_example.c stl_gobal_data_example.h stl_main_example_support function.c stl_peripheralinit.c Declaration bool stl_RL78_sw_clocktest(void) Description This function tests the system clock using a software measurement (software counter) process.
  • Page 26 RL78 Family VDE Certified IEC60730/60335 Self Test Library Table 13: Source files: Hardware Clock test STL File name Header Files stl_RL78_hw_clocktest.asm stl_clocktest.h stl.h Test Harness File Names Header Files main.c main.h stl_global_data_example.c stl_gobal_data_example.h stl_main_example_support function.c stl_peripheralinit.c Declaration bool stl_RL78_hw_clocktest(void) Description This function tests the system clock using the hardware measurement (TAU channel n) feature.
  • Page 27: Example Usage

    RL78 Family VDE Certified IEC60730/60335 Self Test Library Example Usage In addition to the actual test software source files, the IAR Embedded Workbench test harness workspace is provided which includes application examples demonstrating how the tests can be run. This code should be examined in conjunction with this document to see how the various test functions are used.
  • Page 28: Flash Rom Verification

    RL78 Family VDE Certified IEC60730/60335 Self Test Library 3.2 Flash ROM Verification The ROM is tested by calculating a CRC value over the complete range of the Flash memory contents and comparing with a reference CRC value that must be added to a specific location in the ROM not included in the CRC calculation. The IAR embedded workbench tool chain can be used to calculate and add a CRC value and placed at a location at a location specified by the user.
  • Page 29: Ram Verification

    RL78 Family VDE Certified IEC60730/60335 Self Test Library 3.2.1 Power- Up Tests All the ROM memory used must be tested at power up. Both hardware and software CRC modules are capable of calculating the CRC value over the whole memory range. 3.2.2 Periodic It is suggested that the periodic testing of Flash memory is done in stages, depending on the time available to...
  • Page 30: System Clock Verification

    RL78 Family VDE Certified IEC60730/60335 Self Test Library 3.4 System Clock Verification If a fault is detected with the system clock then the aim of should be to get to a safe operating point, where system can be controlled using a different known clock. 3.4.1 Power-Up The system clock should be verified at power on or reset.
  • Page 31: Benchmarking

    RL78 Family VDE Certified IEC60730/60335 Self Test Library 4 Benchmarking Development Environment • IECUBE - QB-RL78G13-ZZZ-EE Full RL78/G13 In circuit Emulator • QB-R5F100LE-TB RL78/G13 Target Board 64pin LQFP (10 x 10mm) • Tool chain: IAR Embedded Workbench Version 1.20.1 MCU: R5F100LE (64KB Flash, 4KB RAM 64pin) Internal Clock: 32 MHz High Speed Oscillator...
  • Page 32 RL78 Family VDE Certified IEC60730/60335 Self Test Library Figure 11 IAR EW General Options – Stack/Heap Figure 12 IAR EW General Options – MISRA-C R01AN0749EG0201 Rev.2.01 Page 32 of 50 Mar 04, 2014...
  • Page 33 RL78 Family VDE Certified IEC60730/60335 Self Test Library 4.2.2 Complier Settings Figure 13 IAR EW Compiler Options - Language Figure 14 IAR EW Compiler Options - Optimisation R01AN0749EG0201 Rev.2.01 Page 33 of 50 Mar 04, 2014...
  • Page 34 RL78 Family VDE Certified IEC60730/60335 Self Test Library Figure 15 IAR EW Compiler Options - Listings Figure 16 IAR EW Compiler Options – Pre-processor Defined symbols R01AN0749EG0201 Rev.2.01 Page 34 of 50 Mar 04, 2014...
  • Page 35 RL78 Family VDE Certified IEC60730/60335 Self Test Library 4.2.2.1 Defined Symbols The following defined symbols are included in the Compiler options section. Each symbol is preset to enable the conditional build options for each of the self test projects is selected. Example shown below is for the “System”...
  • Page 36 RL78 Family VDE Certified IEC60730/60335 Self Test Library 4.2.3.1 Defined Symbols The following defined symbols are included in the IAR EW assembler options section. Each symbol is preset to enable the conditional build options for each of the self test projects selected. This differs from the compiler settings as if the symbol is omitted then the self test is disabled.
  • Page 37 RL78 Family VDE Certified IEC60730/60335 Self Test Library Figure 19 IAR EW linker Options – Listings (Map File) Figure 20 IAR EW linker Options – Diagnostics R01AN0749EG0201 Rev.2.01 Page 37 of 50 Mar 04, 2014...
  • Page 38: Resources

    RL78 Family VDE Certified IEC60730/60335 Self Test Library 5 Resources The following resource tables include only the resources and execution times needed for the self test modules. The figures do not include data for the test harness files. All timings are based on the following environment settings MCU: R5F100LE (64KB Flash, 4KB RAM, 64 pin) Internal Clock:...
  • Page 39 RL78 Family VDE Certified IEC60730/60335 Self Test Library 5.1.3 Stack Pointer Register Test Note: This test cannot be run on the E1 on Chip debugger. Table 18: Stack Pointer Register Resources Measurement Code size (Bytes) Stack usage (Module use plus function call) Data 30 cycles Execution time...
  • Page 40 RL78 Family VDE Certified IEC60730/60335 Self Test Library 5.2 Flash ROM Test 5.2.1 Software CRC test Table 21: Software CRC Test Resources Measurement Code size plus constants 616B Stack usage (Module use plus function call) Data 2496000 cycles Execution time (Range = 51KB) 78mS 5.2.2 Hardware CRC test Table 22: Hardware CRC Test Resources...
  • Page 41 RL78 Family VDE Certified IEC60730/60335 Self Test Library 5.3 RAM 5.3.1 System March C Table 23: System March C Test Resources Measurement Code size 354B Stack usage (Module use plus function call) Data 476800 cycles Execution time (Range = 1.3KB) 14.9mS 5.3.2 System March X...
  • Page 42 RL78 Family VDE Certified IEC60730/60335 Self Test Library 5.3.4 Initial March X Table 26: Initial March X Test Resources Measurement Code size 279B Stack Usage (Module use plus function call) Data Usage 768000 cycles Execution time (Range = 4KB) 24mS 5.4 Clock Monitor The execution time of this function is defined by the frequency of the reference clock therefore the execution time is not measured.
  • Page 43: Additional Hardware Resources

    6 Additional Hardware Resources The following additional safety and self test features have been included in the RL78 series to provide support for the user. While these additional functions have not been certified by VDE, they provide a valuable extra resource to the user and are included here for reference.
  • Page 44 RL78 Family VDE Certified IEC60730/60335 Self Test Library 6.1.2 RAM Guard Protection This is a write protection feature that when enabled allows data to be read from the selected Ram area, but prohibits a write to these locations. No error is generated if a write occurs to this area The Ram area available for this feature is limited and can be selected by the “GRAM0, GRAM1”...
  • Page 45 RL78 Family VDE Certified IEC60730/60335 Self Test Library 6.1.4 I/O Port SFR Protection This is a write protection feature that prohibits a write to the SFR registers. No error is generated if a write occurs, but the write operation does not change the state of the registers involved. Please note that the data port register (Pxx) cannot be protected.
  • Page 46 RL78 Family VDE Certified IEC60730/60335 Self Test Library 6.1.5 Interrupt SFR Protection This is a write protection feature that prohibits a write to the Interrupt SFR registers. No error is generated if a write occurs to this area, but the write operation does not change the state of the registers involved. The protection can be turned off, if a change is required for the SFR registers or for safety reasons the SFR settings are refreshed by the application.
  • Page 47 RL78 Family VDE Certified IEC60730/60335 Self Test Library 6.1.6 Control Register Protection This is a write protection feature that prohibits a write to the control registers. No error is generated if a write occurs to this area, but the write operation does not change the state of the registers involved. The protection can be turned off, if a change is required for the SFR registers or for safety reasons the SFR settings are refreshed by the application.
  • Page 48 RL78 Family VDE Certified IEC60730/60335 Self Test Library 6.2 Additional Self Test Functions The ADC includes additional inputs designed to help test the operation of the ADC. These include • Temperature Sensor • Internal Voltage Reference (1.44V) • External Analogue Voltage Reference pins (AVrefP and AVrefM) These internal analogue input pins can be used to verify the operation of the ADC against a known reference point.
  • Page 49: Vde Certification Status

    RL78 Family VDE Certified IEC60730/60335 Self Test Library 7 VDE Certification Status Module / Version V1.0 V1.1 V2.0 V3.0 stl_RL78_registertest.asm stl_RL78_registertest_psw.asm stl_RL78_registertest_stack.asm stl_RL78_registertest_cs.asm stl_RL78_registertest_es.asm stl_RL78_sw_crc.asm stl_RL78_peripheral_crc.asm stl_RL78_march_c.asm stl_RL78_march_x.asm stl_RL78_march_c_initial.asm stl_RL78_march_x_initial.asm stl_RL78_sw_clocktest.asm stl_RL78_hw_clocktest.asm Y = VDE Certified Module -- = No Code Change affecting VDE Certified Module in this update N = Module not VDE Certified.
  • Page 50: Website And Support

    RL78 Family VDE Certified IEC60730/60335 Self Test Library Website and Support Renesas Electronics Website http://www.renesas.com/ Inquiries http://www.renesas.com/contact/ All trademarks and registered trademarks are the property of their respective owners. R01AN0749EG0201 Rev.2.01 Page 50 of 50 Mar 04, 2014...
  • Page 51 Revision History Description Rev. Date Section Summary 0.01 Jul 01, 2011 Preliminary revision 0.02 Jul 21, 2011 Updated and corrected preliminary for review 1.00 July 06, 2011 First Release 1.01 Nov 16, 2011 P21 and P42 Text correction - March C corrected to March X. Removed error statement.
  • Page 52 General Precautions in the Handling of MPU/MCU Products The following usage notes are applicable to all MPU/MCU products from Renesas. For detailed usage notes on the products covered by this document, refer to the relevant sections of the document as well as any technical updates that have been issued for the products.
  • Page 53 10. It is the responsibility of the buyer or distributor of Renesas Electronics products, who distributes, disposes of, or otherwise places the product with a third party, to notify such third party in advance of the contents and conditions set forth in this document, Renesas Electronics assumes no responsibility for any losses incurred by you or third parties as a result of unauthorized use of Renesas Electronics products.

This manual is also suitable for:

Iec60730Iec60335

Table of Contents