Application Note R01AN4837EJ0111 RE01 1500KB Group, 256KB Group Rev.1.11 2020.09.24 Maintenance free power management by RE energy harvesting controller

Summary This application note (hereafter "APN") , "Maintenance free power management by RE energy harvesting controller ", is provided with the associated sample code. It describes the power management strategy for an energy harvesting system that does not require battery maintenance, in terms of the replacement or the recharging of batteries by an external power source and provides specific sample code examples for these applications. Chapter 1 summarizes the power management for energy harvesting. Chapter 2 and subsequent chapters describe the hardware and software configuration and operation of the specific sample code examples.

⚫ Attached sample project name: ➢ r01an4837_re_power_management_1500kb ➢ r01an4837_re_power_management_256kb

Target Device  The RE01 group 1500KB product in the RE family (model name: R7F0E015D2CFB)  The RE01 group 256KB product in the RE family (model name: R7F0E01182CFP)

Video Contents RE family Course You can easily get how to use RE family to learn these video contents. https://academy.renesas.com/?eid=1625

R01AN4837EJ0111 Rev.1.11 Page 1 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller Table of Contents

1. Summary of Power Management for an Energy Harvesting System ...... 4 1.1 About Energy Harvesting ...... 4 1.2 About Power Management ...... 4 1.3 Basic Design Method ...... 4 1.3.1 Hardware Design ...... 4 1.3.2 Software Design ...... 10 1.4 Shipping Products Equipped with Energy Harvesting Systems ...... 13

2. Overview of Sample Code ...... 14 2.1 Sample Code...... 14 2.2 Implemented Software Functions ...... 14 2.3 Operation Specifications ...... 15 2.4 Confirmation of Operation ...... 17 2.5 Procedure for Operating Sample Code ...... 18 2.5.1 Board Settings...... 19

3. Hardware Configuration ...... 21 3.1 Components ...... 21 3.2 Circuit Configuration ...... 22 3.2.1 Power Supply Line Configuration ...... 24 3.2.2 Signal Line Configuration ...... 24 3.3 Pins Used and Connections ...... 25

4. Software Operation ...... 26 4.1 Folder Structure...... 26 4.2 File Configuration ...... 27 4.3 Option-Setting Memory ...... 29 4.4 Hardware Resources ...... 30 4.5 List of Constants ...... 30 4.6 Flowcharts ...... 31 4.6.1 Sample Code Overall ...... 31 4.6.2 Startup Operation ...... 32 4.6.3 Application Operation ...... 35 4.6.4 Battery Recovery Operation ...... 37 4.6.5 Safe Shutdown Operation ...... 39 4.6.6 Demo operation (The example of user application) ...... 40 4.7 List of Functions ...... 41 4.7.1 List of LCD Control Functions ...... 48 4.7.2 List of LVD LVDBAT Control Functions ...... 52 4.8 How to replace a demo operation with user application ...... 55

5. Debugging ...... 57 5.1 Debugging Energy Harvesting Startup Program ...... 57 5.1.1 Procedure for Program Debugging ...... 57 5.1.2 LVD1 function Debugging Method ...... 58

R01AN4837EJ0111 Rev.1.11 Page 2 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

5.1.3 LVDBAT function Debugging Method ...... 58 5.1.4 Method of Debugging while Maintaining Debugger Connections ...... 59

6. Troubleshooting ...... 61

R01AN4837EJ0111 Rev.1.11 Page 3 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller 1. Summary of Power Management for an Energy Harvesting System This chapter covers the basic concepts of the power management strategy for energy harvesting applications that does not require battery replacement or charging from and external power source and the basic design method using the RE01 group products.

1.1 About Energy Harvesting "Energy harvesting" refers to technology for electric power generation by converting energy in the environment--whether in the form of sunlight, temperature differences, vibrations, dynamo (water turbines and wind turbines), pressure, or something else--into electric power. The electric power generated in this way can be stored in capacitors or secondary batteries to provide the power to operate an electronic system.

1.2 About Power Management In this document, "power management" is defined as maintaining an energy input/output balance between energy generation/accumulation and energy consumption. By performing power management, battery replacement and charging by human intervention becomes unnecessary, and the system operate autonomously. In order to maintain an input/output balance, the system-level control described below is necessary.

1.3 Basic Design Method 1.3.1 Hardware Design (1) Circuit configuration

Figure 1-1 shows an example of a power management circuit configuration in an energy harvesting system. For information on the power generating element, storage capacitor, and secondary battery connections, refer to the User's Manual: Hardware Edition.

R01AN4837EJ0111 Rev.1.11 Page 4 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

RE01 AVCC0 PWR Generation SW Sensor1 Element VSC_VCC EHC 【Important Note2】 Storage Capacitor SW REG

VCC_SU port Analog Secondary domain AVCC0 Battery VBAT_EHC SW Sensor2 VCC/IOVCC VCC MCU

【Important Note2】

Digital IO port port IODigital IOVCC1 domainIOVCC1 Digital IO port IODigital SW REG Wireless Port Output domain IOVCC1 【Important Note1】 IOVCC1 Port Output 【Important Note1】

Signal Line

【Important Note1】: Use VCC / IOVCC domain ports or IOVCCn (n = 0,1,2,3) Power Line domain ports that are directly powered from VCC / IOVCC for load switch ON / OFF control. The ports in the IOVCCn domain (n = 0, 1, 2, 3) that supply power after the load REG Regulator switch do not operate when the load switch is OFF, so the load switch cannot be turned ON permanently. SW Road Switch 【Important Note2】: It is recommended that the load switch fix the output to L even when the ON / OFF control port is floating. If the output of the load switch is floating while the energy harvesting is starting up, an inrush current will flow to the regulator or external LSI connected to the output of the load switch, which may hinder energy harvesting.

Figure 1-1 Power Management Power Supply Circuit Configuration in Energy Harvesting System

R01AN4837EJ0111 Rev.1.11 Page 5 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

(2) Component selection

When selecting components, the following should be kept in mind. (1) Selections should be made to adhere to the electrical ratings for the various LSIs. (2) The power generation elements, secondary batteries, and storage capacitors, as well as the regulators, load switches, and peripheral LSIs should be selected such that the sum of the input/output of power generation/accumulation and power consumption is positive.

Selection criteria for various components are indicated below.

(a) Power generation elements (connected to the VSC_VCC pin) Table 1-1 presents selection criteria for power generation elements.

Power generation elements that can be connected to RE01 1500KB and 256KB Group (hereafter “this device”) include solar cells, Peltier elements, and vibration power generation elements. When the output voltage and the output current fall within the electrical characteristics of the energy harvesting control circuit (hereafter "EHC circuit"), the element can be connected directly to the VSC_VCC pin. When the output voltage and current are outside this range, a voltage conversion circuit such as a DC/DC converter, or a rectifying circuit, must be added. Power generation elements are divided into those that are handled as current sources and those that are handled as voltage sources. (1) Current sources: Solar cells (2) Voltage sources: Peltier elements, vibration power generation elements, DC/DC converters, and other constant-voltage sources

When connected to a voltage source, a resistor must be inserted between the voltage source and the VSC_VCC pin. By thus inserting the resistor, the value of the current flowing into the VSC_VCC pin is limited as follows. Current value = (output voltage of voltage source - voltage at VSC_VCC)/value of inserted resistor

Moreover, there is an on-resistance of approximately 100 Ω in this device between VSC_VCC and VBAT_EHC, present between the inserted resistor and the batteries. Resistors are not needed for current sources. The output current and the output voltage must satisfy the following relationships. (1) Case of a current source: i. For an output current of 10 mA, the output voltage must be 3.6 V or lower ii. For an output current of 3 μA, the output voltage must be 2.62 V or higher

(2) Case of a voltage source: i. Output voltage of 3.6 V or lower and output current of 10 mA or lower ii. Output voltage of 2.62 V or higher and output current of 3 μA or higher

R01AN4837EJ0111 Rev.1.11 Page 6 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

Table 1-1 Power Generation Element Selection Criteria and Connection Examples

Connection examples Temperature Dynamos Differences (Water Turbines, Vibration Power (Peltier Effect Parameter Selection Criteria Solar Cells Wind Turbines) Generation etc.) Output current 10 mA or less Several mA Tens of mA Tens of 100uA Tens of mA Output voltage 2.62 V to 3.6 V Several V several V several 10V Tens to hundreds to to of mV Lower limit, 2.62 Connection several 10V several 100V V, is same as method: Connection VCC_SU_H Adjustment to Connection Connection method: voltage, and 2.62 V to 3.6 V method: method: Adjustment to must be higher by a number of Adjustment to Adjustment to 2.62 V to 3.6 V by than lower limit series 2.62 V to 3.6 V 2.62 V to 3.6 V step-up regulator of secondary connection by rectification by rectification battery charging stages circuit, step- circuit, step- voltage. down regulator down regulator Output For AC, DC AC AC DC frequency rectification and several tens of several Hz smoothing are Connection Hz to several tens of Connection necessary method: Hz method: Rectification not Connection Rectification not required method: Connection required Rectification method: required Rectification required

(b) Capacitors at power generation element pins (connected to the VSC_VCC pin) When connecting a power generation element the output voltage of which is a DC voltage, the capacitance shown in Table 1-2 should be connected to the power generation element connection pin. In the case of an AC voltage, a determination should be made based on an evaluation.

Table 1-2 Capacitor Selection Criterion for Power Generation Element Connection Pin

Parameter Selection Criterion Capacitance 0.047 μF * When the power generation element has an AC output, the capacitance should be determined based on an evaluation.

Parameter Selection Criterion Capacitance 0.047 μF * When the power generation element has an AC output, the capacitance should be determined based on an evaluation.

(c) Storage capacitors (connected to the VCC_SU pin) Table 1-3 shows selection criteria for the storage capacitor necessary for VCC_SU. The value of this capacitor changes depending on the temperature of the usage environment.  -40°C to 60°C: 100 μF  ~40°C to 85°C: 150 μF

R01AN4837EJ0111 Rev.1.11 Page 7 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

The capacitor should be selected from among the following capacitor types.  Tantalum capacitors  Aluminum electrolytic capacitors  Multilayer ceramic capacitors

Capacitors with an equivalent series resistance (ESR) of at most several ohms or so should be used. if the charging current is to be raised to approx. 10 mA or so, capacitors with low ESRs should be used. It should be noted that aluminum electrolytic capacitors tend to have high ESRs. A withstand voltage of about 6 V or so is enough, but when a capacitor with a low withstand voltage is used, the insulation resistance is low, and the voltage dependence of the capacitance is increased, so that caution must be exercised when selecting capacitors. Tantalum capacitors and aluminum electrolytic capacitors tend to have low insulation resistances, and become a cause of increased standby currents, and so must be used with caution in systems that are sensitive to standby currents. When it is necessary to reduce standby currents, ceramic capacitors with a withstand voltage of several tens of volts are suitable for use at VCC_SU.

Table 1-3 Storage Capacitor Selection Criteria and Connection Examples

Connection examples Parameter Selection Criteria Tantalum Al Electrolytic Multilayer Ceramic Capacitance 100 μF Various possible Various possible Various possible (-40°C to 60°C) 150uF (-40°C to 85°C) Capacitance stability Good stability Good Inferior to tantalum Inferior to tantalum recommended Rated voltage >6 V Various possible Various possible Various possible Insulation resistance High resistance Several MΩ at 10 μF Several MΩ at 10 μF Several 10MΩ at 10 recommended to μF reduce leakage currents ESR <10Ω Several Ω at 10 μF Approx. 10Ω at 10 μF <1Ω at 10 μF Size Selected according Small Large Large to the system

(d) Secondary batteries (connected to VBAT_EHC pin) Table 1-4 shows selection criteria for secondary batteries. The secondary batteries shown in the table can be connected to the VBAT_EHC pin. Alternatively supercapacitors can be used. When a secondary battery is connected with VBAT 3.0V, the maximum charging current is 6mA. When secondary battery is connected at VBAT 2.6V, maximum charging current is 10mA. This setting values are needed within the recommended operating voltage of VSC_VCC. Then, this EHC circuit performs constant- voltage charging. For the most efficient secondary battery charging, we recommend choosing a secondary battery with an output impedance smaller than 10Ω. NiMH batteries should be used with two cells connected in series. In order to maintain cell balance, two batteries of the same type must always be used. The charging current should be approximately 1/10 of the nominal secondary battery capacity (C/10).

R01AN4837EJ0111 Rev.1.11 Page 8 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

Table 1-4 Secondary Battery Selection Criteria and Connection Examples

Connection examples Manganese Lithium Lithium Titanate Nickel-Metal Hydride Parameter Selection Criteria (ML) (LTO) (NiMH) Charging 2.6 V or 3.0 V 2.8 V to 3.2 V 2.7 V (max) 1.3 V to 1.6 V voltage Nominal voltage Selected according 3.0 V 2.3 V 1.2 V to the system Termination selected according 2.0 V 1.8 V 1.0 V voltage to the system Output <10Ω for charging 10Ω to several <10Ω <10Ω impedance hundred ohms Possible <10 mA (for 2.6 V Several mA, 10 mA possible <6 mA; however, charging charging) depending on because of low should be 1/10 of currents <6 mA (for 3.0 V battery size impedance rated capacity charging) Standard Selected according Various possible Various possible Various possible discharge to the system current

Standard Selected according Various possible Various possible Various possible capacity to the system Suppliers - , etc. Panasonic, FDK etc. etc.

(e) Load switches (connected to the VCC pin of RE01) Immediately after power is applied to the system , supplying power to the peripheral LSIs connected to the load switches must be avoided. This is because if power is supplied to peripheral LSIs immediately after the start of power generation, an inrush current or large reset current may flow, impeding the startup of energy harvesting. In order to prevent such a phenomena, load switches should be selected such that, immediately after startup, the output is low even when the output control pin (the name of which differs among manufacturers) is in the open state. Moreover, load switches should be selected that have as small off leakage current as possible.

(f) Regulators (connected to load switch outputs) ISL9122 Regulators with small inrush currents and quiescent currents should be selected. The Renesas ISL9122 with low Iq or similar is recommended. (ISL9122 samples are available and ISL9122 is planned to be released in the 1st half of 2020)

(g) Peripheral LSIs (connected to regulator outputs) LSIs with inrush currents and consumption currents during standby and operation that are as small as possible should be selected.

R01AN4837EJ0111 Rev.1.11 Page 9 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller 1.3.2 Software Design Table 1-5 describes power management by software in different states, and Figure 1-2 shows the state transition. In order to construct a system in which battery maintenance isnot required,, operating loads must be switched appropriately and the energy input/output balance must be adjusted in each of the following circumstances.

Table 1-5 Power management by software in different states

Power Management Battery Remaining Power Control of This Power Supply Control State Level Device Itself of Peripheral LSIs System Operation Startup Battery charge from Charging control of Peripheral power Minimum operation empty EHC circuit supply SW OFF (initial screen display transition to low etc.) power consumption state (VBB mode) Application Battery sufficient Transition to normal Peripheral power Application operation operating mode supply SW ON (active: VBB mode cancelled) Battery recovery Battery low Transition to low Peripheral power Stopped power consumption supply SW OFF state (VBB mode) Safe shutdown Battery very low EHC circuit, MCU unit Peripheral power Stopped switched off supply SW OFF

Startup Safe Shutdown RE01 RE01

EHC EHC Periph Periph SW REG SW REG LSI Battery LSI MCU MCU CPU Charge CPU Flash Periph from Flash Periph Empty Battery Sufficient Battery Very Low Battery Application Low Battery Recovery RE01 RE01

EHC EHC Periph Periph SW REG SW REG LSI LSI MCU MCU CPU CPU

Flash Periph Battery Flash Periph Sufficient

Operating or power-on state Power supplied Abbreviation SW: Load switch Halt (standby) or power-off state No power supplied REG: Regulator Figure 1-2 State Transition Diagram of Power Management

Figure 1-3 shows the state of the EHC circuit switch in each state, and Figure 1-4 shows an example of the voltage waveform. The numbers at the top of Figure 1-4 are associated with the numbers for the operating period of Figure 1-3.

R01AN4837EJ0111 Rev.1.11 Page 10 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

1. Initial charging period RE01-1500KB

EHC VSC_VCC VBAT_EHC PWR SW1 SW2 2ndry G gen SW5 batt elem SW4 VCC_SU SW3

SW6 VSC_GND Storage cap

VCC Periph LSI Inside MCU

VCC_SU >2.6 V SW6 shorted

2. 2ndry battery charging period RE01-1500KB

EHC

VSC_VCC VBAT_EHC SW1 PWR SW2 2ndry G gen SW5 batt elem SW4 VCC_SU SW3 SW6 VSC_GND Storage cap Startup VCC Periph LSI Inside MCU

Start program execution Enable 2ndry batt charging 3-2 2ndry battery charging period* 3-1 2ndry battery charging period* RE01-1500KB RE01-1500KB EHC EHC Storage cap voltage drop VSC_VCC VBAT_EHC VSC_VCC VBAT_EHC SW1 PWR SW2 2ndry SW1 SW2 2ndry PWR G gen SW5 batt batt G gen SW5 elem SW4 elem SW4 VCC_SU VCC_SU SW3 SW3 SW6 SW6 VSC_GND Storage VSC_GND Storage Storage cap charging cap VCC cap VCC completed Periph LSI Periph LSI Inside Inside MCU MCU * Minimum required Start supply of power supply from operation possible 2ndry battery to inside MCU by software

4-1 Steady operation period 4-2 Operation hold period RE01-1500KB PWR generation by PWR RE01-1500KB EHC generation elem halted EHC VSC_VCC VBAT_EHC VSC_VCC VBAT_EHC SW1 SW2 2ndry PWR SW1 SW2 2ndry G SW5 batt PWR gen G gen SW5 batt elem SW4 VCC_SU elem Application SW4 VCC_SU SW3 Battery Recovery SW3 SW6 Storage VSC_GND SW6 Storage cap VSC_GND VCC VCC cap Periph LSI Periph LSI Inside MCU Inside PWR generation by PWR MCU generation elem restarted

2ndry battery voltage dropped close to lower limit for operation

5. Operation stop period RE01-1500KB

EHC

VSC_VCC VBAT_EHC PWR SW1 SW2 2ndry G gen SW5 batt elem SW4 VCC_SU Safe Shutdown SW3

SW6 Storage VSC_GND VCC cap

Periph LSI Inside MCU

Supply of power supply from PWR generation element restarted 1. Initial charging period Figure 1-3 Relationship between Power Management States and EHC Circuit

R01AN4837EJ0111 Rev.1.11 Page 11 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

Startup Application, Battery Recovery Safe Shutdown

1 2 3 4 5

Waveform excerpt from hardware user's manual

Figure 1-4 Voltage waveform in each state

R01AN4837EJ0111 Rev.1.11 Page 12 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller 1.4 Shipping Products Equipped with Energy Harvesting Systems In an energy harvesting system that uses a RE01 group device, the starting point for startup of the power supply is power generation by a power generation element. As shown in Figure 1-5, in order to cold-start this device from a secondary battery, the VBAT_EHC pin and the VSC_VCC pin must be manually shorted. This task should be performed when causing a product equipped with an RE01 group device to be operated for inspection or shipment without power generation.

RE01 AVCC0 PWR generation SW Sensor 1 elem VSC_VCC EHC

Storage capacitor

VCC_SU SW REG Analog port Analog 2ndry battery VBAT_EHC SW Sensor 2 VCC MCU

SW REG Wireless Digital port IO Digital

IOVCC1

VSC_VCC PWR supply line Shorted REG Regulator

VBAT_EHC SW Load switch

Figure 1-5 Method for Manual Cold-Starting from Secondary Battery

R01AN4837EJ0111 Rev.1.11 Page 13 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller 2. Overview of Sample Code In this and subsequent chapters, sample code created as a specific example of power management in energy harvesting is explained. The hardware configuration is described in Chapter 3, Hardware Configuration. The software operation is described in Chapter 4, Software Operation.

2.1 Sample Code In this application note the following sample code project is included. • r01an4837_re_power_management_1500kb: Sample code for RE01_1500KB group • r01an4837_re_power_management_256kb: Sample code for RE01_256KB group

These sample code projects are created using the model name of this device (see the target chip in Table 2-1) mounted on the Evaluation Kit. When using the device of the different model name, modify the projects according to the model name of the device used.

2.2 Implemented Software Functions This sample code was created in order to enable rapid construction of the power management required of an energy harvesting system using this device. Implemented software functions are as follows.

1. Startup of the device using a power generation element and charging of a secondary battery by the EHC circuit 2. Supply of power to the entire system after completion of charging, and execution of application operation 3. During normal operation, transition to standby mode when the battery voltage drops, using secondary battery voltage monitoring, and return to normal operation when adequate charging is recovered 4. Safe shutdown processing if the battery voltage has dropped to a critical level

Using this sample code enables the design of a system that will reliably operate from a power generation element, from startup to the safe shutdown of the system in concert with a drop in secondary battery voltage, so that adaptation to the entire product life cycle is possible. The hardware on which the sample code operates is based on the Evaluation Kit, but the sample code was created assuming expansion into a system in which new peripheral LSIs are connected. When expanding the system, processing suited to the user system should be added in accordance with the explanations in the next and subsequent sections. In chapter 4.6, "Flowchart", and chapter 4.8, "How to replace the demo behavior with a user application", the chapter shows the parts of the code that can be changed or added.

R01AN4837EJ0111 Rev.1.11 Page 14 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

2.3 Operation Specifications This sample code implements a example application usingthe MIP-LCD expansion board included in the Evaluation Kit as the example of user application. Figure 2-1 shows the flow of sample code demo operation.

• Startup ⎯ When a power-on reset is generated on start up of the power supply by the power generation element, the application displays the image on the LCD, indicating that battery charge is in progress (only for RE01_256KB group). ⎯ Charges the secondary battery and transitions to the Application operation.

• Application ⎯ Displays the product logo on the LCD, indicating start of demo operation and transitions to the Low Power demo operation. ⎯ Low Power demo operation Intermittently updates the LCD every 2 seconds in low-power operating mode at 2-MHz system clock. ⇒Transitions to the Normal Power demo operation upon detection of SW being pressed down. ⇒Transitions to the Battery Recovery operation upon detection of a drop in the secondary battery voltage. ⎯ Normal Power demo operation Intermittently updates the LCD every second at 32-MHz system clock. ⇒Transitions to the High Power demo operation upon detection of SW being pressed down. ⇒Transitions to the Battery Recovery operation upon detection of a drop in the secondary battery voltage. ⎯ High Power demo operation Continuously updates the LCD at 64-MHz system clock. ⇒Transitions to the Low Power demo operation upon detection of SW being pressed down.

⎯ Transitions to the Safe Shutdown operation upon detection of an extreme drop in the operating voltage in the Application state.

• Battery Recovery ⎯ Displays the image on the LCD, indicating that the battery charge is in progress and turns off the LCD. ⎯ Shuts off power supply to the peripheral LSIs and peripheral functions. ⎯ Stands by in low-power standby mode until detecting recovery of the secondary battery voltage. ⎯ Transitions to the Application demo operation upon detection of recovery of the secondary battery voltage. ⎯ Transitions to the Safe Shutdown operation upon detection of an extreme drop in the operating voltage in the Battery Recovery state.

• Safe Shutdown ⎯ Displays the image on the LCD, indicating that power shutoff is in progress and turns off the LCD. ⎯ Shuts off power supply to the peripheral LSIs and peripheral functions. ⎯ Transitions to the initial charging state and shuts off power supply.

During the High Power demo operation, when the secondary battery voltage drops, it will transition to Safe Shutdown without going through the Battery Recovery state. Please implement Safe Shutdown state when considering a situation where the system will continue to consume power unintentionally.

R01AN4837EJ0111 Rev.1.11 Page 15 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

Startup Safe Shutdown

LCD Power OFF 2 seconds later Power On Reset Battery Charge

(VCC 1.50V) from Empty (VCC_SU > 0V)

LCD Power OFF

RE01 256KB Group Only LED lights for 2 seconds

Battery Sufficient Battery Very Low Battery Very Low (VBAT_EHC 2.33V) (VCC < 1.84V) (VCC < 1.84V) Application Battery Recovery

2 seconds later LED flash 5 times LED flash 1 time Battery Low Update (VBAT_EHC < 2.00V) every 2 seconds

Battery Sufficient 2 seconds later Push Switch Pressed (VBAT_EHC 2.33V)

LED flash 2 times

Update every second LCD Power OFF

Push Switch Pressed

LED flash 3 times

Update continueously Push Switch Pressed

Figure 2-1 Flow of Demo Operation

R01AN4837EJ0111 Rev.1.11 Page 16 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

2.4 Confirmation of Operation Table 2-1 shows the conditions for which operation has been confirmed.

Table 2-1 List of Conditions for Which Operation has been Confirmed

Parameter Description Remarks RE01_1500KB Group RE01_256KB Group Device used R7F0E015D2CFB 144pin R7F0E01182CFP 100pin This device Operating System clock (ICLK), Peripheral module clock B (PCLKB): - frequency -Low Power demo operation: ICLK, PCLKB = MOCO 2MHz -Normal Power demo operation: ICLK, PCLKB=MOSC 32MHz -High Power demo operation : ICLK = HOCO 64MHz :PLCKB = HOCO 64MHz* divided by 2 VBB clock in low power standby mode: SOSC 32.768kHz Operating voltage Input from power generation element: Up to 5.0 V (depends on solar - panel output) IO power supply: 3.3 V - illuminance 300 lux or more Target board Evaluation Kit RE01 1500KB Evaluation Kit RE01 256KB Included in (Model: (Model: RTK70E0118CxxxxxBE) Evaluation Kit RTK70E015DCxxxxxBE) IAR Integrated IAR Embedded Workbench® for Arm® v8.40.2 - Developm ent Environm ent compiler IAR C/C++ Compiler for Arm® v8.40.2 - Optimization: Low GCC Integrated Renesas e2 studio v7 Renesas e2 studio 2020-07 - Developm ent Environm ent compiler GCC Arm Embedded v6.3.1.2070620 - GNU 6-2017-q2-update Optimization: -O2 Versions of the RE01 1500KB Group RE01 256KB Group - CMSIS Driver CMSIS Driver Package CMSIS Driver Package Rev1.00 Package Rev1.10 Emulator Segger J-Link OB Onboard debugger; installed in Evaluation Kit

R01AN4837EJ0111 Rev.1.11 Page 17 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

2.5 Procedure for Operating Sample Code This sample code can be operated by the following procedure. For details of compilation and downloading, refer to the startup guide.

• Compilation Compile the sample code.

• Preparation for downloading Prepare for downloading the compiled program to the target board. Refer to section 2.5.1 to ensure that the board configuration is ready for downloading because the board settings for downloading are different from the board settings for operating. Connect the debugger to be used for downloading.

• Downloading Download the compiled program to the target board.

• Preparation for operating Prepare for operating the downloaded program in the energy harvesting system. Refer to section 2.5.1 to ensure that the board configuration is ready for operating because the board settings for operating are different from the board settings for downloading. Disconnect the debugger used during downloading.

• Startup of operation To start the sample program, supply power to the VSC_VCC pin from the power generation elements or short-circuit the VBAT_EHC pin connected to the secondary battery and VSC_VCC pin. See section 1.4 for shorting the VBAT_EHC and VSC_VCC pins.

• Restarting To restart power supply to the VSC_VCC pin after transitioning to the initial charging state in the Safe Shutdown state, wait approximately 40 seconds.*

* Upon restart, it is necessary that a voltage is not applied to the VCC pin. This is in order for POR reset to occur in a state with no voltage applied to the VCC pin. On the Evaluation Kit, at the time of energy harvesting startup settings the load switch is connected to the VCC pin; a discharge path is provided between VCC and the load switch, discharge can be done by manually pressing the discharge switch (Evaluation Kit RE01 1500KB SW9 or Evaluation Kit RE01 256KB SW7). To operate startup → power depletion → restart without pressing down on the switch, it is necessary to wait for natural discharge of electric charge between the VCC pin and the load switch. In the case of the Evaluation Kit, after power-off for safe shutdown, wait for approximately 40 seconds before resuming the supply of power from the power generation element.

R01AN4837EJ0111 Rev.1.11 Page 18 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

2.5.1 Board Settings Figure 2-2 and Figure 2-3 show the board settings to download and run this sample code into the Evaluation Kit. This section describes only the settings that require modification from the initial state of the board. For the initial state of the Evaluation Kit, refer to the user’s manual of the relevant board and circuit diagrams.

【When downloading】

Do not connect the generator発電素子は接続しない element PMOD1: Don’t care × USB1:USB1:Connecting PCと接続 toPC SW5: NORMAL SW6: NORMAL

J1: Don‘t care

J5: 1-2 short

J22: 1-2 short SW4: MD 1-2 short SW7: EHMD Don’t care

【When operating】

発電素子 Do not connect the Power-generating(ソーラーパネル) element generator element (solar panel) PCは接続しない × PMOD1:PMOD1:Connect MIP-LCD拡張 MIPLCD基盤 を接続 SW5: EHC SW6: EHC

J1: 2-3 short

J5: 1-2 open 2-3 open

J22: 2-3 short SW4: MD 1-2 short SW7: EHMD 1-2 short

Figure 2-2 Pin Connection and Board Settings (1500KB)

R01AN4837EJ0111 Rev.1.11 Page 19 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

【When downloading】

J10: 1-2 short J15: Don’t care J6: Don’t care J9: short

USB1:USB1:Connecting PCと接続 to PC J8: 1-2 short

SW3: NORMAL PMOD1: Don’t care SW4: NORMAL SW5: NORMAL × SW6: NORMAL 発電素子は接続しない SW9 : MD 1-2 short Do not connect the SW10: EHMD Don’t care generator element

【When operating】

J10:J10:21--23 openshort 2-3 open J15: 2-3 short J6: 2-3 short J9: short

Do not connectPCは接続しない the generator element ×

J8: 2-3 short

SW3: EHC SW4: EHC SW5: EHC SW6: EHC SW9 : MD 1-2 short PMOD1:P MOD1:ConnectMIP-LCD拡張基盤を接続 MIPLCD 発電素子Power-generating SW10: EHMD 1-2 short (ソーラーパネル)element (solar panel)

Figure 2-3 Pin Connection and Board Settings (RE01_256KB)

R01AN4837EJ0111 Rev.1.11 Page 20 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

3. Hardware Configuration In this chapter, the hardware that is used with the sample code is described. The user can modify an application and expand the power supply configuration through the change or addition of the code for the specified area of the software. See the flowchart in chapter 4.6, the flowchart in chapter 4.8, and the demo in chapter 4.8 for details on the parts of the code that can be modified or added. See How to replace the behavior with user apps.

3.1 Components This sample code operates on a hardware mounted on or included with the Evaluation Kit. Table 3-1 shows hardware components to run the sample code. For details of each hardware, see the Evaluation Kit User's Manual description and circuit diagrams.

Table 3-1 List of Hardware Components; Part Numbers and Model Names

Name Hardware Components Remarks Evaluation Kit; Part No. and Model Name RE01_1500KB Group RE01_256KB Group Target board Model name: Model name: Included in Evaluation RTK70E015DCxxxxxBE RTK70E0118CxxxxxBE Kit Device used U1 U1 Model name: Model name: R7F0E015D2CFB R7F0E01182CFP Solar Panel Connected to T20, T21 Connected to T9, T10 Included in Evaluation Model name: AM-1815CA Model name: AM-1815CA Kit Storage capacitor C8 (100uF) C25, C30 (200 uF in total) Model name: Model name: TPSC107K010R0200 TPSC107K010R0200 Supercapacitor BT1 (0.22F) BT2 (0.047F) Serves as a secondary Model name: Model name: battery FC0H224ZFTBR24 FC0H473ZFTBR24 Load switch U10 - This manual treats Model name: TCK107AF, LF these as DCDC. Regulator U3 U3 Model name: ISL9122AIR Model name: ISL9122AIRNZ LCD Model name: PMOD1 Connected to PMOD1 Included in Evaluation Model name: Model name: Kit RTK70E015DB00000BE RTK70E015DB00000BE MIP-LCD expansion board Push switch SW2 SW2 LED LED1 LED1

R01AN4837EJ0111 Rev.1.11 Page 21 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

3.2 Circuit Configuration Figure 3-1 and Figure 3-2 show the circuit configurations that satisfy the conditions under which the operation of this sample code has been confirmed.

Power supply open RE01 control circuit*2

P008 LED Solar panel (power generation element) VSC_VCC EHC

Storage Analog IO port IO Analog capacitor VCC_SU AVCC1 AVCC0 Super capacitor (secondary VBAT_EHC ~3.0V*1 3.3V battery) SW REG

MCU

P404 VCC/IOVCC

X2 SPI SPI LCD P610 SCS P605 RST

P606 VCOM Digital IO port IO Digital

Push switch P508Power supply open 2 IOVCC3 IOVCC2 IOVCC1 IOVCC0 IOVCC1 IOVCC2 IOVCC3 control circuit*

: Power : Signal line SW : Load switch REG : Regulator supply line

*1: Depends on the VBAT_EHC voltage. *2: The power supply open control circuit prevents propagation of the undefined signal, which appears when a power is not being supplied to the peripheral ICs. For details, refer to Power Supply Open Control Register (VOCR), in the Hardware Edition of the User's Manual.

Figure 3-1 Circuit Configuration (1500KB)

R01AN4837EJ0111 Rev.1.11 Page 22 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

RE01 Power supply open Solar panel (power control circuit*2 generation element) VSC_VCC EHC

Storage AVCC0

capacitor VCC_SU port IO Analog Super capacitor (secondary VBAT_EHC ~3.0V*1 REG 3.3V battery) MCU LED P209

P410 VCC/IOVCC

x2 SPI SPI LCD

IOVCC0 P015 SCS

P813 RST

P814 VCOM

Digital IO port IO Digital Push P508

IOVCC1 switch Power supply open control circuit*2

: Power : Signal line REG : Regulator supply line

*1: Depends on the VBAT_EHC voltage. *2: The power supply open control circuit prevents propagation of the undefined signal, which appears when a power is not being supplied to the peripheral ICs. For details, refer to Power Supply Open Control Register (VOCR), in the Hardware Edition of the User's Manual. Figure 3-2 Circuit Configuration (RE01_256KB)

R01AN4837EJ0111 Rev.1.11 Page 23 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

3.2.1 Power Supply Line Configuration For the power supply line configuration satisfying the operation confirmation conditions of this sample code, see Figure 3-1 and Figure 3-2.

(1) Secondary Battery

When repeatedly evaluating an energy harvesting startup program, time is required for charging and discharging when secondary batteries are used. Hence a supercapacitor with smaller capacity than a secondary battery is mounted on the Evaluation Kit to facilitate voltage evaluations. When using a secondary battery provided by the user, set as follows to perform evaluation. The sample code is confirmed to run using the supercapacitor. When using a secondary battery provided by the user for the RE01_1500KB group, the battery should be attached to the part No. BT2 of the Evaluation Kit and the jumper J1 be set to short-circuit 1-2. When using a secondary battery provided by the user for the RE01_256KB group, the battery should be attached to the part No. BT1 of the Evaluation Kit and the jumper J12 be set to short-circuit 1-2.

(2) Power Generation Element

The solar panel included with the Evaluation Kit is used as the power generation element. As the storage capacitor (100 μF), load switch, and regulator, the components mounted in advance on the Evaluation Kit are used.

3.2.2 Signal Line Configuration For the signal line configuration satisfying the operation confirmation conditions of this sample code, see Figure 3-1 and Figure 3-2.

(1) Power Supply Open Control Circuit

This device is provided with a power supply open control circuit that prevents propagation of undefined signals into the device. When a power supply is not being supplied to the peripheral LSIs or the like, signal states are undefined. Should such undefined signals be input to an IC during operation, runaway operation of the module and undefined leakage currents may result. In this device, a power supply open control circuit is provided as a measure that anticipates input of such undefined signals. In a state in which a power supply is not being supplied to peripheral LSIs, the power supply open control circuit should be kept enabled (the initial state; input signal blocked), and when a power supply is supplied to the peripheral LSIs and the undefined state is cancelled, the power supply open control should be disabled (signal input is enabled). For details of the power supply open control circuit, refer to Power-Saving Functions, Power Supply Open Control Register (VOCR), in the Hardware Edition of the User's Manual.

R01AN4837EJ0111 Rev.1.11 Page 24 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

3.3 Pins Used and Connections Table 3-2 shows the devices connected to the product and the pins used with the conditions under which this sample code operation has been confirmed.

Table 3-2 List of Pins of Devices Connected and Connections

Device Connected Pin Names of RE01 Products Name Pin Name RE01_1500KB Group RE01_256KB Group Solar panel Positive terminal VSC_VCC VSC_VCC Storage capacitor Positive terminal VCC_SU VCC_SU Supercapacitor Positive terminal VBAT_EHC VBAT_EHC Load switch Vin VCC/IOVCC - CONTROL P404 VOUT - (Regulator VIN) Regulator VIN - (Load switch VOUT) VCC/IOVCC EN P404 P209 VOUT IOVCC0, 1, 2, 3 IOVCC1 AVCC0, 1 AVCC0 VREFH0 VREFH0 LCD VDD - (Regulator VOUT) IOVCC0 (Connected to VCC/IOVCC) SCLK RSPCKB_B (P607) RSPCKA_B (P011) SI MOSIB_B(P609 MOSIA_B(P010) SCS P610 P015 RST P605 P813 VCOM P606 P814 Push switch Pull-up power - (Regulator VOUT) IOVCC1 supply Positive terminal P508 P508 LED Positive terminal - (Regulator VOUT) VCC/IOVCC Negative terminal P008 P410

R01AN4837EJ0111 Rev.1.11 Page 25 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller 4. Software Operation This chapter describes software specifications of the sample code.

4.1 Folder Structure Figure 4-1 shows the folder structure of the sample code for the RE01-1500KB group. For the sample code for the RE01-256KB group, ”1500” contained in the file names and folder names should be replaced with ”256”. This sample code is created using the CMSIS Driver Packages of the RE01-1500KB group and RE01- 256KB group. Modification and addition of the files to each CMSIS Driver Package are indicated in the figure.

r01an4837_re_power_management_1500kb

Device Config r_core_cfg.h 【change】 r_dmac_cfg.h 【change】 r_lpm_cfg.h 【change】 r_smip_cfg.h 【change】 r_spi_cfg.h 【change】

r_system_cfg.h 【change】 …

Driver Include r_lpm_api.h r_smip_api.h

r_system_api.h …

Src

… r_ehc r_ehc.c 【change】 r_lpm r_lpm_api.c r_smip r_smip_api.c r_system

… r_system_api.c

pin.c 【change】 pin.h

RE01_1500KB.h …

Documents Driver Specification :Driver Specifications

Getting_Started :Getting Started Guide …

main.c 【change】 appli_cfg.h 【addition】 lcd.c 【addition】 lcd.h 【addition】 lvd_lvdbat.c 【addition】 lvd_lvdbat.h 【addition】 Resource 【addition】

… resource.h 【addition】 bitmap_charge_data.c 【addition】

bitmap_opening_data.c 【addition】 …

Figure 4-1 Folder Structure

R01AN4837EJ0111 Rev.1.11 Page 26 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller 4.2 File Configuration Table 4-1 lists the application files that have been added to or modified from the files of the CMSIS Driver Packages of the RE01-1500KB group and RE01-256KB group and Table 4-2 lists the driver files that have been modified.

Table 4-1 Added or Modified Application Files in Sample Code

File Name Summary of Processing/Settings Remarks main.c Main processing Modified file appli_cfg.h Definitions that can be Added file modified by the user lcd.c、lcd.h LCD control Added file lvd_lvdbat.c、lvd_lvdbat.h Voltage monitoring control Added file bitmap_charge_data.c Image data (charge) Added file bitmap_opening_data.c Image data (product logo) Added file bitmap_wakeup_data.c Image data (initial charging) Added file (RE01_256KB group only) bitmap_walk1_data.c Image data Added file bitmap_walk2_data.c (Low Power demo) bitmap_jogging1_data.c Image data Added file bitmap_jogging2_data.c (Normal Power demo) bitmap_run1_data.c Image data Added file bitmap_run2_data.c (High power demo) bitmap_run3_data.c bitmap_shutdown_data.c Image data (power shutoff) Added file bitmap_shutdown_black_data.c Image data (black screen) Added file (RE01_1500KB group only) resource.h Image data definition Added file

R01AN4837EJ0111 Rev.1.11 Page 27 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

Table 4-2 Driver Files That Have Been Modified in Sample Code

File Name Summary of Processing/Settings Remarks r_ehc.c Energy harvesting startup LCD function call added to startup processing processing( RE01- 256KB group only) pin.c Pin setting Switch pin enabled ⎯ IRQ4 LCD pin enabled ⎯ SPI1( RE01- 1500KB group only) ⎯ SPI0( RE01- 256KB group only) r_core_cfg.h Initial clock settings HOCO frequency: 64 MHz SOSC: Used (low power CL, noise filter disabled) Power control: Low-speed mode ( RE01- 1500KB group only) Energy harvesting startup enabled r_dmac_cfg.h R_DMAC driver settings API Flash memory/RAM placement modified r_lpm_cfg.h R_LPM ド driver settings API Flash memory/RAM placement modified r_smip_cfg.h R_SMIP driver settings API Flash memory/RAM placement modified Pins to use modified Line info addition feature disabled Data arrangement modified to LSB r_spi_cfg.h R_SPI driver settings API Flash memory/RAM placement modified Transmission control modified to use DMAC2 r_system_cfg.h System settings Interrupt NVIC registered ⎯ AGT0_AGTI ⎯ AGT1_AGTI ⎯ PORT_IRQ4 ⎯ LVD_LVDBAT ⎯ DMAC2_INT ⎯ SPI1_SPII( RE01- 1500KB group only) ⎯ SPI0_SPII( RE01- 256KB group only)

R01AN4837EJ0111 Rev.1.11 Page 28 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

4.3 Option-Setting Memory Table 4-3 shows the option-setting memory setting for the sample code. Set suitable values for the system if required. The charging voltage for a secondary battery can be selected for this device by using the secondary battery (VBAT) charging voltage selection bit in the optional function selection register 1 (OFS1). In this sample code, the charging voltage of 3.0 V (initial value) is selected for the RE01_1500KB group and 3.1 V (initial value) for the RE01_256KB group. Change the voltage setting for a secondary battery selected by user.

Table 4-3 Option Setting Memory Setting for Sample Code

Symbol Address Setting Value Description AWS 0100A164h to 0100A167h FFFF FFFFh No access window settings OSIS 0100A150h to 0100A15Fh FFFF FFFFh No ID code protection (ALL FFh) SECMPUxxx 00000408h to 0000043Bh FFFF FFFFh MPU disabled OFS1 00000404h to 00000407h FFFF FFFFh After reset, voltage monitoring 0 reset disabled After reset, HOCO oscillation disabled Secondary battery charging voltage: 3.0 V 3.1 V Flash memory power reduction function: Not supported Disabled OFS0 00000400h to 00000403h FFFF FFFFh IWDT auto-startup disabled WDT auto-startup disabled

R01AN4837EJ0111 Rev.1.11 Page 29 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller 4.4 Hardware Resources This sample code uses hardware interrupts as necessary. Table 4-4 shows the hardware interrupts used in this sample code.

Table 4-4 List of Hardware Interrupts Used for Interrupt Name Description Operation voltage drop LVD_LVD1 Interrupt is used for returning from standby detection (Non-maskable interrupt) mode. Interrupt is always enabled. Battery voltage drop LVD_LVDBAT Interrupt is used for returning from standby detection mode. Battery voltage Interrupt is enabled only in standby mode. recovery detection Monitor flag is used for detecting battery voltage drop. Periodic timer AGT1_AGTI Interrupt is used for returning from standby mode. SW pressing detection PORT_IRQ4 Interrupt is used for setting the flag to determine the state transition. LCD display SPI0_SPII Interrupt is used by R_SMIP driver used for LCD SPI1_SPII display. AGT0_AGTI DMAC2_INT

4.5 List of Constants In this sample code, the constants that can be changed by the user are defined in the appli_cfg.h file. Table 4-5 indicates the constants that can be changed by the user.

Table 4-5 List of User-Modifiable Definitions

Initial Definition Name Value Description APPLI_CFG_TIMER_INTVL_NORMALPOWER 1000 Defines the periodic timer interrupt time during Normal Power demo operation for intermittent application operation. AGT1_AGTI, which is AGT1 underflow interrupt is used as an interrupt; the count value is calculated from the time defined in this definition and written to the AGT counter register (AGT).

Setting = Expected period [ms] Setting range: 1,000 to 10,000 APPLI_CFG_TIMER_INTVL_LOWPOWER 2000 Defines the periodic timer interrupt time during Low Power demo operation for intermittent application operation. AGT1_AGTI, which is AGT1 underflow interrupt is used as an interrupt; the count value is calculated from the time defined in this definition and written to the AGT counter register (AGT).

Setting = Expected period [ms] Setting range: 1,000 to 10,000

R01AN4837EJ0111 Rev.1.11 Page 30 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

4.6 Flowcharts This section describes the sample code operation in the flowcharts below. Processing that can be modified or added according to the system of the user are also described.

4.6.1 Sample Code Overall Figure 4-2 shows overall of sample code. Some processes relating to demo operation are omitted. For details of operation and addition/modification of user application, see description in the next chapter.

Interrupt Handler Startup Maskable Interrupt Handler Non-Maskable Interrupt Handler Application Battery Safe Shutdown Reset Recovery Resume from Resume from Standby of Execute Safe Shutdown Standby of Battery Application (Battery Very Low) Minimum low-power operation is Recovery (Regular timer interrupt) Start EHC possible. (Battery Sufficient) r_ehc_Startup() *1: In this sample code, charging Operation voltage 1 drop detection * Timer periodic Battery voltage rise start is displayed on LCD. interrupt detection interrupt interrupt (RE01 256KB Group only) Processing before shutdown (storing data, Set pins Set pins according to the user board. User processing for etc.) BoardInit() *2: In this sample code, pins are set for Safe Shutdown *2 7 Evaluation Kit. * *7: In this sample code, Timer Lvdbat transition to Safe Shutdown is User processing User processing displayed for a short period of 6 *6 * Turn system time. From here to Initial setting of voltage/battery power OFF main function voltage detection Application (to detect drop)

Initialize EHC End End circuit Initial setting of Set clocks. peripheral functions Set periodic timer.

End *6:Not provided in this sample code Turn system power ON Battery Recovery

Yes Enter Battery Recovery Battery Low? (Battery Low) No Processing before transition to low power Battery Recovery Enter Application state (suspending application, storing data, user processing etc.) (Battery Sufficient) 4 * *4:In this sample code, transition to Battery Recovery is displayed on LCD for a short period of time. Turn system power OFF

Change setting of battery voltage Appli *3:In this sample code, user processing detection *3 LCD display is updated. (to detect rise)

Enter standby state

Enter standby state Return from standby state on detection of rise of battery voltage Return from standby state by the periodic timer. Change setting of battery voltage No detection Battery Low? (to detect drop)

Yes Place where user can Turn system power change parameters ON

Place where processing User processing for Processing after return from low-power state executed as an application is added by user Battery Recovery (starting application, etc.) *5 *5:In this sample code, LCD display is resumed Place where processing is (RE01 256KB Group only). added if user system includes multiple DCDC or load SW controls Figure 4-2 Sample Code Flowchart

R01AN4837EJ0111 Rev.1.11 Page 31 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller 4.6.2 Startup Operation Figure 4-3 shows the flowchart of the startup routine. The startup operation consists of energy harvest startup to charge a secondary battery, initial pin settings, and initial clock settings.

Start power supply from power generation element or short-circuit VBAT_EHC and VSC_VCC.

Reset r_ehc_Startup function ehc_Startup_ramfunc function

User processing In this sample code, Charing start is displayed on LCD Copy Startup code to RAM quick_startup() Start EHC (RE01 256KB Group only) r_ehc_Startup() Function prepared in (RE01 256KB Group only) r_ehc.c file

Initial setting of LVD1 Transit to low-power operation In MINPWON mode, Flash Set levels, enable NMI interrupt MINPWON mode power is shut off. Set pins BoardInit() Function added by user

Set LVDBAT Transit to low-power operation Set levels, enable interrupts VBB mode, 32-kHz operation Set clocks according to Set clocks definition in r_core_cfg.h system_clock_init() file. Enable charging to secondary battery RAM function for shutting Flash (EHCCR0.VBATCTL) power off ehc_Startup_ramfunc()

To Application operation (main function) Minimum low-power operation is User processing 1 possible. * *1: In this sample code, no processing Release low-power operation is performed. NORMAL, ALLPWON, 2-MHz operation

Place where user can Transit to standby mode Wait for charging change parameters VBB, MINPWON, SSTBY secondary battery. end Place where processing executed Return from standby by secondary battery voltage as application is added by user rise interrupt. (Battery Sufficient)

Stop LVDBAT Stop LVDBAT circuit, disable interrupts

Transit to normal operation state from EHC circuit secondary battery charging state (EHCCR1.QUICKMODE = 1)

Release low-power operation In ALLPWON mode, Flash power is ALLPWON mode supplied.

end

Figure 4-3 Startup Flowchart

R01AN4837EJ0111 Rev.1.11 Page 32 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

(1) Startup condition: Battery Charge from Empty (Energy Harvesting Startup)

By supplying power from the power generation element or short-circuiting the VBAT_EHC pin connected to the secondary battery and the VSC_VCC pin, the EHC circuit operates and the startup (energy harvesting startup) processing is executed. * For short-circuit of the VBAT_EHC and VSC_VCC pins, refer to section 1.4.

(2) End condition: Battery Sufficient

When the secondary battery has enough charge, the r_ehc_Startup function is ended and the main function is called. Then a transition is made to the application operation state.

(3) Energy Harvesting Startup

The energy harvesting startup processing is executed using the r_ehc_Startup function included in the CMSIS driver R_CORE. Figure 4-3 shows the main processing flow of the r_ehc_Startup function. For detailed specifications, refer to the R7F0E01 Group (1.5 MB) R_CORE Detailed Specifications included in the CMSIS Driver Package.

(4) Pin Settings

When changing the ports to be used, modify the processing of the pin setting BoardInit function.

(5) Initial Clock Settings

When changing the initial clock settings, set the r_core_cfg.h file Change the configuration definition settings.

(6) Addition of user processing: Method for executing user processing during energy harvesting startup

During energy harvesting startup, simultaneously with secondary battery charging, minimum operation at low power consumption is possible. User processing should be added to the r_ehc.c file. Figure 4-3 shows the places where the user can add user processing. When adding processing before the secondary battery has enough charge, power consumption should be considered and adequate evaluation performed. When adding user processing during energy harvesting startup, the following points should be noted. ⚫ The power required for the processing should be lower than the power supplied from the power generation element. ➢ Regarding the place for addition, the limited power stored in the storage capacitor is used to operate this device, and the excess power is used to charge the secondary battery. Hence if the power consumption of added processing is large, charging of the battery is not completed, and transition to application operation is not possible. ➢ When adding processing, balanced charging of the storage capacitor and the secondary battery should be considered and enough evaluation performed prior to implementation. ⚫ Processing should be performed in the operating mode where the required functions are available. ➢ During Startup, a transition to low-power operation is made to charge the secondary battery. In low-power operating mode, several different peripheral functions stop depending on the mode and the system operates at the LOCO clock. Processing should therefore be added to the places where the required functions are available. ⚫ In the code that is to be added, variables having an initial value, such as in the BSS section, are initialized after execution of this processing, and so global variables not having an initial value should

R01AN4837EJ0111 Rev.1.11 Page 33 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

be used to store values. Moreover, this is before execution of the C runtime library, so that depending on the development environment, standard functions may not be available.

R01AN4837EJ0111 Rev.1.11 Page 34 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller 4.6.3 Application Operation Figure 4-4 shows the Application flowchart. Application operation consists of initial setting and loop operation, which is the kernel of Application operation.

Start when secondary battery is sufficiently charged in Startup

main

Initial settings for Application

Copy application code to RAM Initialize the driver

Initial settings for For operation voltage detection, operation voltage/ enable non-maskable interrupts. battery voltage detection For battery voltage detection, lvd_lvdbat_init() disable interrupts for monitoring.

Initial settings for peripheral functions Set clocks. re01_init() Set timers.

Initialize peripheral LSI connection pins. Start power supply to peripheral Turn system power ON LSIs/peripheral functions. ext_power_on() (Turn load switch and regulator ON.) Disable power supply open control circuit. Initial setting of peripheral LSIs.

In this sample code, product User processing logo for Application start is displayed on LCD.

Application loop operation Place code in RAM for shutting Flash power off during operation. Yes (In this flow, Low Power demo operation is shown as an example.) Battery Low? No For time management in Start timer count intermittent operation timer_start() Used as a return source from standby mode To Battery Recovery operation battery_recovery()

In this sample code, Low User processing Power demo operation image is updated in LCD. LED blinks once.

Turn system power OFF This processing is not performed in this ext_power_off() sample code.

RE01 1500KB Group only Transit to low-power operation For 256KB, this processing is not VBB, EXFPWON necessary because 256KB can directly transfer_toVBB_SOSC() enter low-power standby mode.

Transit to standby state VBB, MINPWON, SSTBY R_LPM_SSTBYModeEntry()

Return from standby on detection of battery voltage drop, SW pressed, timer interrupt, or non-maskable interrupt.

RE01 1500KB Group only Release low-power operation For 256KB, this processing is not necessary because Transfer_toLowspeedExfpwon_ 256KB can directly return to the original operation MOCO() mode from low-power standby mode.

Place where user can change parameters This processing is not performed in this Turn system power ON sample code.

Place where processing executed as an application is No added by user Battery Low? Place where processing is Yes added if user system includes multiple DCDC or load SW controls Stop timer count timer_stop()

Figure 4-4 Application Flowchart

R01AN4837EJ0111 Rev.1.11 Page 35 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

(1) Startup condition: Battery Sufficient

When the secondary battery has enough charge, Application operation is started.

(2) End condition: Battery Low, Battery Very Low

When the battery voltage drops, the Application operation stops (Battery Low). When the battery voltage drops extremely, a non-maskable interrupt is generated and Application operation is ended (Battery Very Low).

(3) Application initial settings

The l settings for the Application operation are initialized.. The initial settings of the operating voltage/battery voltage detection sets LVD1 setting for the detection of Battery Very Low and LVDBAT setting for the detection of Battery Low. The peripheral functions, the clocks and operating mode, periodic timer used for intermittent operation are initialized . For turning on the system power, the load switches and regulators are turned on to supply power to the peripheral LSIs and peripheral functions. The pins connected to the peripheral LSIs to which power should be supplied are initialized and the power supply open control circuit for the power system that supplies power is set.

(4) Application loop operation

The main application loop executes.In Application loop operation, user processing and standby mode are repeatedly executed until a battery voltage drop is detected. By transitioning to the standby mode state while user processing is not executed, power consumption can be reduced. The system returns from the standby mode state upon detection of either of the following interrupts. • Periodic timer interrupt • Battery voltage drop • Non-maskable interrupt (operating voltage drop) • IRQ interrupt (this interrupt is used in the sample code to detect that SW is pressed down)

Time of the cycle timer interrupt can be changed by changing the definitions in the appli_cfg.h file. For the definitions that can be changed by the user, refer to section 4.5.

(5) Addition of user processing: Turn system ON/OFF

The system power supply is not controlled in the main Application loop of this sample code. When connecting another power supply system to a peripheral LSI to expand the system, add the processing for the newly added power supply system and peripheral LSI to the system power turn-ON/OFF processing and execute the system power turn-ON/OFF function. In the sample code, the following comments are used to indicate the place examples where the system power supply should be turned on/off. • Turn system power ON: Write user's code to turn ON other user's power control device here. • Turn system power OFF: Write user's code to turn OFF other user's power control device here.

R01AN4837EJ0111 Rev.1.11 Page 36 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

4.6.4 Battery Recovery Operation Figure 4-5 shows the Battery Recovery flowchart. In Battery Recovery operation, power supply to the peripheral LSIs and peripheral functions are shut off to wait for enough recovery of the secondary battery voltage. By suspending the Application operation when the secondary battery voltage drops and resuming the Application operation when the voltage recovers, the energy harvesting system that requires no battery maintenance can be configured.

Start on detection of secondary battery voltage drop in Application

battery_recovery

In this sample code, Battery Recovery transition image is User processing displayed for a short period of time.

Set to end peripheral LSIs. Enable power supply open control circuit. Turn system power OFF Shut power to peripheral LSIs/peripheral ext_power_off() functions off. (Turn load switch and regulator OFF.) Open peripheral LSI connection pins.

Change battery voltage detection Change battery voltage level for returning from standby detection setting mode, and enable the rising lvdbat_change_setting() detection interrupt.

RE01 1500KB Group only Transit to low-power operation For 256KB, this processing is not VBB, EXFPWON necessary because 256KB can directly transfer_toVBB_SOSC() enter low-power standby state.

Transit to standby state VBB, MINPWON, SSTBY R_LPM_SSTBYModeEntry()

Return from standby mode on detection of the battery voltage recovery interrupt.

Release low-power operation transfer_toHispeedAllpwon_ RE01 1500KB Group only MOSC() For 256KB, this processing is not necessary because Transfer_toLowspeedExfpwon_ 256KB can directly return to the original operation MOCO() mode from low-power standby state.

Change battery voltage detection Change battery voltage level for monitoring battery detection setting voltage and disable the interrupt.

Initial settings of peripheral LSI connection pins Start power supply to peripheral LSIs/peripheral functions. Turn system power ON (Turn load switch and regulator ON.) Disable power supply open control circuit. Place where processing Initial settings of peripheral LSIs executed as an application is added by user

Place where processing is added if user system end includes multiple DCDC or load SW controls Figure 4-5 Battery Recovery Flowchart

R01AN4837EJ0111 Rev.1.11 Page 37 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

(1) Startup condition: Battery Low

When the secondary battery charge drops, Battery Recovery operation is started.

(2) End condition: Battery Sufficient, Battery Very Low

When the secondary battery voltage recovers, Battery Recovery operation is ended (Battery Sufficient). When the operating voltage drops extremely, a non-maskable interrupt is generated and Battery Recovery operation is ended (Battery Very Low).

(3) Addition of user processing: Turn system power ON/OFF

When connecting another power supply system to a peripheral LSI to expand the system, add the processing for the newly added power supply system and peripheral LSI to the system power turn-ON/OFF processing.

R01AN4837EJ0111 Rev.1.11 Page 38 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller 4.6.5 Safe Shutdown Operation Figure 4-6 shows the Safe Shutdown flowchart. In Safe Shutdown operation, the power supplies for the entire system are turned off in sequence, after which the energy harvesting circuit is initialized. This suppresses system runaway operation, enables safe restart, and protects the secondary battery.

Start on detection of significant drop of secondary battery

NMI_Handler cb_lvd lvd_callback

No Is the interruption caused by LVD1? Clear interrupt flag Stop all the modules Yes

LVD1 interrupt processing Yes Due to noise? cb_lvd() (Check 3 times) Transit to low-power operation VBB, 2MHZ, EXFPWON No

User processing lvd_callback function RE01 1500KB Group only end lvd_callback() For 256KB, this processing is not Turn system power ON necessary because LCD power is ext_power_on() supplied from IOVCC0. (IOVCC0 is connected to IOVCC.)

Change clock LOCO In this sample code, transition to Safe Shutdown is displayed on User processing LCD for a short period of time.

Initialize EHC from the EHC circuit normal operation state and restart Stop power supply initial charging to MCU. (EHCCR1.QUICKMODE = 0)

Turn system power OFF ext_power_off()

Place where processing executed as an application by user is added cb_lvd cb_lvd Place where processing is added if user system includes multiple DCDC or load SW controls Figure 4-6 Safe Shutdown Flowchart

(1) Startup condition: Battery Very Low

When the secondary battery voltage drops extremely, a non-maskable interrupt is generated and Safe Shutdown operation is started in the interrupt handler.

(2) End condition: None

When the initial charging state is set in the Safe Shutdown processing, Safe Shutdown operation is ended unconditionally.

(3) Addition of user processing

User processing can be added prior to powering off. However, because this would be positioned as emergency processing with the voltage near the limit for operation, only the absolute minimum required processing should be added. When adding user processing, it should be added to the lvd_callback function, which is executed in the interrupt handler function for the non-maskable interrupt LVD_LVD1. Since Safe Shutdown operation is executed in the non-maskable interrupt handler, no interrupts can be used.

R01AN4837EJ0111 Rev.1.11 Page 39 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

4.6.6 Demo operation (The example of user application) This sample code implements a example application using the MIP-LCD expansion board included with the Evaluation Kit as the example of a user application. The overall d operation of the sample code is described in section 4.6.3. In this chapter, the Application loop behavior flow for each demo is shown in Figure 4-7 Flowchart of Demo Operation.

sample_application

No Push switch pressed?

Yes

Update demo state

Demo state?

Low Power demo Normal Power demo High Power demo app_lowpower_continuous() function app_normalpower_continuous() function app_highpower_continuous() function

Set operation mode Set operation mode Set operation mode 2MHz, EXFPWON 32MHz, ALLPWON 64MHz, BOOST transfer_toLowspeedExfpwon_MOCO() transfer_toHispeedAllpwon_MOSC() transfer_toBoost_HOCO()

Blink LED once Blink LED twice Blink LED 3 times

Start timer count(2-second cycle) Start timer count (1-second cycle) timer_start() timer_start()

Yes Yes Battery Low or Battery Low or Yes push switch pressed? push switch pressed? Push switch pressed? No No No

Update the LCD display Update the LCD display Update the LCD display lcd_send() lcd_send() lcd_send()

Update LCD image number Update LCD image number Update LCD image number

Maintain LCD display Maintain LCD display lcd_suspend() lcd_suspend()

Transit to low-power operation Transit to low-power operation VBB, EXFPWON VBB, ALLPWON transfer_toVBB_SOSC() Transfer_toVBB_SOSC()

Yes Yes Battery Low? Battery Low?

No No

Transit to standby state Transit to standby state VBB, MINPWON, SSTBY VBB, MINPWON, SSTBY R_LPM_SSTBYModeEntry() R_LPM_SSTBYModeEntry()

Release low-power operation Release low-power operation transfer_toLowspeedExfpwon_MOCO() transfer_toHispeedAllpwon_MOSC()

Resume LCD display Resume LCD display lcd_resume() Lcd_resume()

Stop timer count Stop timer count timer_stop() timer_stop()

Place where user can RE01 1500KB Group only change parameters end Figure 4-7 Flowchart of Demo Operation

R01AN4837EJ0111 Rev.1.11 Page 40 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller 4.7 List of Functions This section describes function added to the CMSIS Driver Package in the sample code.

main Overview Main processing Header None Declaration Int main(void) Description Calls a system initial settings function, makes initial settings for voltage monitoring, and displays the product logo on the LCD. Then, calls the main_loop_on_ram function placed in RAM. Argument None Return Value None Code Placement Flash

re01_init Overview Initial settings of RE01 device peripheral functions Header None Declaration static void re01_init(void); Description Sets the RE01 device clocks and makes initial settings of peripheral functions. Argument None Return Value None Code Placement Flash

main_loop_on_ram Overview Application operation and battery voltage drop detection Header None Declaration void main_loop_on_ram(void) Description If the battery voltage is not low, it will transition to application operation. When a low battery voltage is detected, the unit enters the Battery Recovery state. Argument None Return Value None Code Placement RAM

sample_application Overview User process in application operation Header None Declaration static sample_application(void) Description In the user processing part of the application operation, the demonstration is executed. In this sample code, shifts demo operation state on detection of pressing of the switch. Argument None Return Value None Code Placement RAM

R01AN4837EJ0111 Rev.1.11 Page 41 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

app_lowpower_intermittet Overview Low Power demo operation body portion Header None Declaration static app_lowpower_intermittet(void) Description Low-power demo intermittent operation In this sample code, the demo operation to update the LCD in 2 second cycles is performed. After demo operation, enters low-power standby state and performs intermittent operation. When pressing of the switch or battery voltage drop is detected, exits this function. Argument None Return Value None Code Placement RAM

app_normalpower_intermittet Overview Normal Power demo operation body portion Header None Declaration static app_normalpower_intermittet(void) Description Normal-power demo intermittent operation In this sample code, demo of refreshing the LCD is performed in 1-second cycles. After demo operation, enters low-power standby state and performs intermittent operation. When pressing of the switch or battery voltage drop is detected, exits this function. Argument None Return Value None Code Placement RAM

app_highpower_continuous Overview High Power demo operation body portion Header None Declaration static app_highpower_continuous(void) Description High speed continuous demo In this sample code, demo to display LCD is performed continuously. When pressing of the switch is detected, exits this function. Argument None Return Value None Code Placement RAM

R01AN4837EJ0111 Rev.1.11 Page 42 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

battery_recovery Overview Transition to battery recovery state Header None Declaration static battery_recovery(void) Description Maintains low-power standby mode until detecting the battery voltage rise. In low- power standby mode, shuts off power to peripheral LSIs and enters the following state: • VBB operation mode (VBB clock = SOSC) • MINPWON state • Software standby mode Argument None Return Value None Code Placement RAM

quick_startup Overview User process during startup operation(RE01 256KB group only) Header None Declaration void quick_startup(uint32_t clock) Description A function for user process executed during startup operation. Displays the charging image on LCD. Argument “clock" is used for time management. Argument uint32_t clock Operation clock frequency [kHz] Return Value None Code Placement RAM

ext_power_on Overview Supply power to peripheral LSIs Header None Declaration static ext_power_on(void) Description Turns DCDC on to supply power to the on-board peripheral LSIs. Before turning DCDC on, initializes the pins of peripheral LSIs to be affected. After turning DCDC on, disables the power supply open control circuit to which power is supplied. When this function is executed in a non-maskable interrupt, the LCD pins are controlled by using LCD control functions that do not use interrupts. Turns on the load switch and regulator on the Evaluation Kit. Power is supplied to all the power domains and LCD. Turns on the regulator on the Evaluation Kit. Power is supplied to power domains for IOVCC1 and AVCC0. LCD is powered regardless of the DCDC state. Argument None Return Value None Code Placement RAM

R01AN4837EJ0111 Rev.1.11 Page 43 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

ext_power_off Overview Stop power supply to peripheral LSIs Header None Declaration static ext_power_off(void) Description Turns DCDC off to shut off power supply to the on-board peripheral LSI. Before turning DCDC off, enables the power supply open control circuit of the peripheral LSIs to be shut off. After turning DCDC off, opens the pins of peripheral LSIs to be affected. When this function is executed in a non-maskable interrupt, the LCD pins are controlled by using LCD control functions that do not use interrupts. Turns off the load switch and regulator on the Evaluation Kit. Power to all the power domains and LCD is shut off. Turns off the regulator on the Evaluation Kit. Power supply to power domains for IOVCC1 and AVCC0 is shut off. LCD is powered regardless of the DCDC state. Argument None Return Value None Code Placement RAM

timer_start Overview Start periodic timer count Header None Declaration static timer_start(uint32_t time) Description Starts counting of the periodic timer that generates an interrupt periodically AGT1_AGTI. Argument uint32_t time Sets a period to generate an interrupt [ms] Settable range: 1,000 to 10,000 Return Value None Code Placement RAM

timer_stop Overview Stop periodic timer count Header None Declaration static timer_stop(void) Description Stops counting of the periodic timer that generates an interrupt periodically AGT1_AGTI. Argument None Return Value None Code Placement RAM

R01AN4837EJ0111 Rev.1.11 Page 44 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

transfer_toBoost_HOCO Overview Enter Boost mode and change the system clock to HOCO Header None Declaration static transfer_toBoost_HOCO(void) Description The device is switched to the BOOST mode and the system clock is changed to HOCO (64MHz). Argument None Return Value None Code Placement RAM

transfer_toHispeedAllpwon_MOSC Overview Enter Normal operation ALLPWON mode and change the system clock to MOSC Header None Declaration static transfer_toHispeedAllpwon_MOSC(void) Description The device is switched to the ALLPWON mode for NORMAL operation and changes the system clock to MOSC (32MHz). Argument None Return Value None Code Placement RAM

transfer_toLowspeedExfpwon_MOCO Overview Change the system clock to MOCO and enter NORMAL operation EXFPWON mode Header None Declaration static transfer_toLowspeedExfpwon_MOCO(void) Description The system clock of this device is changed to MOCO (2MHz) and it shifts to EXFPWON mode (NORMAL operation). Argument None Return Value None Code Placement RAM

transfer_toVBB_SOSC Overview Change the system clock to SOSC and enter VBB operation mode (RE01 1500KB group only) Header None Declaration static transfer_toVBB_SOSC(void) Description The system clock is changed to SOSC (32.768kHz). The device is shifted to the EXFPWON mode and shift to the VBB operation mode. 256KB does not need this function because direct transition to standby in low-power mode is possible. Argument None Return Value None Code Placement RAM

R01AN4837EJ0111 Rev.1.11 Page 45 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

board_led_on Overview Turn LEDs on Header None Declaration static board_led_on(void) Description Turns on the LEDs on the Evaluation Kit. Argument None Return Value None Code Placement RAM

board_led_off Overview Turn LEDs off Header None Declaration static board_led_off(void) Description Turns off the LEDs on the Evaluation Kit. Argument None Return Value None Code Placement RAM

lvd_callback Overview User process during Safe Shutdown operation Header None Declaration static lvd_callback(void) Description A callback function for user process executed during Safe Shutdown operation. Enters low-power operation, displays power-shutoff image on LCD, and shuts off power to peripheral LSIs. Argument None Return Value None Code Placement RAM

NMI_Handler Overview Callback function for non-maskable interrupt Header None Declaration void NMI_Handler(void) Description A callback function for non-maskable interrupts of the RE01 group. Non-maskable interrupts are used for detecting operation voltage drop. When this function is used for the LVD_LVD1 interrupt, the cb_lvd function for controlling LVD LVDBAT is used for Safe Shutdown. Argument None Return Value None Code Placement RAM

R01AN4837EJ0111 Rev.1.11 Page 46 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

cb_port_irq4 Overview Callback function for PORT_IRQ4 interrupt Header None Declaration static cb_port_irq4(void) Description A callback function for the IRQ4 interrupt PORT_IRQ4 of the RE01 group. PORT_IRQ4 interrupt is used to detect pressing of the switch on the Evaluation Kit. This function set the switch management variable s_sw_flag. Argument None Return Value None Code Placement RAM

cb_agt1_agti Overview Callback function for AGT1_AGTI interrupt Header None Declaration static cb_agt1_agti(void) Description A callback function for the periodic timer AGT1 underflow interrupt AGT1_AGTI of the RE01 group. AGT1_AGTI interrupt is only used as a return source from standby, for which this function performs no processing. Argument None Return Value None Code Placement RAM

R01AN4837EJ0111 Rev.1.11 Page 47 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

4.7.1 List of LCD Control Functions This section describes the LCD control functions added to the sample code for the CMSIS Driver Package. The functions for LCD control are provided in the lcd.c file. Include the lcd.h file. Some LCD control functions use interrupts and the others do not..

⎯ Functions using interrupt: Uses the R_SMIP driver functions and used in the normal user program. Functions not using interrupt: Used before driver initialization or used in a non-maskable interrupt. not_int is attached to the end of the names of the functions not using interrupts.

By controlling the LCD according to the following procedure, LCD display can be resumed with a black screen conforming to the power-on/off sequence. • Power-on sequence ⎯ Power supply to LCD is currently shut off. ⎯ Execute lcd_open function. ⎯ Supply power to LCD. ⎯ Execute lcd_on function.: LCD display is started with a black screen.

⎯ Power-off sequence ⎯ Power is currently supplied to LCD. ⎯ Execute lcd_off function.: LCD display is terminated with a black screen. ⎯ Shut off power supply to LCD. ⎯ Execute lcd_close function.

lcd_open Overview Initialize LCD pins Header lcd.h Declaration void lcd_open(void) Description Initializes LCD pins. Executes the following R_SMIP driver function to initialize LCD pins: ⎯ R_SMIP_Open function Argument None Return Value None Code Placement RAM

lcd_close Overview Open LCD pins (RE01 1500KB Group only) Header lcd.h Declaration void lcd_close(void) Description Opens LCD pins. Executes the following R_SMIP driver function to open LCD pins: ⎯ R_SMIP_Close function In 256KB, this function is not supported because LCD power is not shut off and pins are not opened. Argument None Return Value None Code Placement RAM

R01AN4837EJ0111 Rev.1.11 Page 48 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

lcd_on Overview Start LCD display Header lcd.h Declaration void lcd_on(void) Description Starts LCD display. Executes the following R_SMIP driver function to control pins according to the LCD power-on sequence: ⎯ R_SMIP_PowerOn function Argument None Return Value None Code Placement RAM

lcd_off Overview End LCD display Header lcd.h Declaration void lcd_off(void) Description Ends LCD display. Executes the following R_SMIP driver function to control pins according to the LCD power-off sequence: ⎯ R_SMIP_AllZero function (RE01 1500KB group only) ⎯ R_SMIP_PowerOff function

In 1500KB, it takes time to completely shut the LCD power off. Therefore, this function sends black screen data to prevent data before ending display from being re-displayed when the lcd_close function is executed. In 256KB, sending black screen data is not necessary because LCD power is not shut off. Argument None Return Value None Code Placement RAM

lcd_send Overview Send LCD display data Header lcd.h Declaration void lcd_send(uint8_t *buf) Description Sends image data specified by the argument to LCD. Executes the following R_SMIP driver function to send LCD display data: ⎯ R_SMIP_Send function This function loops during data transmission and ends when transmission is complete. Argument uint8_t *buf Address of the area where image data is stored Return Value None Code Placement RAM

R01AN4837EJ0111 Rev.1.11 Page 49 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

lcd_reconfig_speed Overview Re-set LCD clock Header lcd.h Declaration void lcd_reconfig_speed(void) Description Re-sets LCD communication rate based on the operation clock. Executes the following R_SMIP driver function to re-set LCD communication rate: ⎯ R_SMIP_ReconfigSpiSpeed function LCD communication rate is set on execution of the lcd_open function. When the operation clock is changed after execution of the lcd_open function, execute this function before executing the lcd_send function. Argument None Return Value None Code Placement RAM

lcd_suspend Overview Retain LCD display Header lcd.h Declaration void lcd_suspend(void) Description Stops the SPI module with LCD display retained. Executes the following R_SMIP driver function to retain LCD display: ⎯ R_SMIP_Suspend function This function retains LCD display even though the SPI module stops. This function state is released with the lcd_resume function to enable update of LCD display. Argument None Return Value None Code Placement RAM

lcd_resume Overview Cancel LCD display retention Header lcd.h Declaration void lcd_resume(void) Description Restarts SPI module stopped by the lcd_suspend function. Executes the following R_SMIP driver function to cancel LCD display retention: ⎯ R_SMIP_Resume function This function enables update of display to restart the SPI module. Argument None Return Value None Code Placement RAM

lcd_open_not_int Overview Initialize LCD pins: Interrupts not used Header lcd.h Declaration void lcd_open_not_int(uint32_t clock) Description Initializes LCD pins without executing R_SMIP driver functions. Argument "clock" is used for time management. Argument uint32_t clock Operation clock frequency [kHz] Return Value None Code Placement RAM

R01AN4837EJ0111 Rev.1.11 Page 50 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

lcd_close_not_int Overview Open LCD pins (RE01 Group 1500KB only): Function not using interrupts Header lcd.h Declaration void lcd_close_not_init(uint32_t_clock) Description Opens LCD pins without executing R_SMIP driver functions. Argument "clock" is used for time management. In RE01 256KB Group, this function is not supported because LCD power is not shut off and pins are not opened. Argument uint32_t clock Operation clock frequency [kHz] Return Value None Code Placement RAM

lcd_off_not_int Overview End LCD display: Function without using interrupts Header lcd.h Declaration void lcd_off_not_init(uint32_t_clock) Description Controls pins according to the LCD power-off sequence without executing the R_SMIP driver functions. Argument "clock" is used for time management. Argument uint32_t clock Operation clock frequency [kHz] Return Value None Code Placement RAM

lcd_send_not_int Overview Send LCD display data: Function without using interrupts Header lcd.h Declaration void lcd_send_not_int(uint8_t *buf, uint32_t clock) Description Sends image data specified by the argument without executing the R_SMIP driver functions. This function loops during data transmission and ends when transmission is complete. Argument uint8_t *buf Address of the area where image data is stored uint32_t clock Operating clock frequency [kHz] Return Value None Code Placement RAM

smip_callback Overview Callback function on completion of R_SMIP driver transmission Header None Declaration static smip_callback(uint32_t event) Description A callback function executed when the R_SMIP driver transmission process is complete. This function sets argument "event" for the transmission completion management variable s_end_flag. Argument uint32_t event Sent result is stored. Return Value None Code Placement RAM

R01AN4837EJ0111 Rev.1.11 Page 51 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

4.7.2 List of LVD LVDBAT Control Functions This section describes voltage monitoring functions added to the sample code for CMSIS Driver Package. The voltage monitoring functions are provided in the lvd_lvdbat.c file. To use the voltage-monitoring functions, include the lvd_lvdbat.h file and use the Please give me a copy.

lvd_lvdbat_init Overview Initialize operation voltage and battery voltage monitoring functions Header lvd_lvdbat.h Declaration void lvd_lvdbat_init (e_lvd_level_t lvd_leve, e_lvdbat_level_t lvdbat_level, lvd_cb_t cb) Description Sets initial values for operation voltage and battery voltage monitoring functions. For the operation voltage, sets the values to generate a non-maskable interrupt when the operation voltage drops to the voltage level specified by the argument lvd_level or lower. For the battery voltage, sets the values to monitor the battery voltage level specified by the argument lvdbat_level. By using the lvdbat_status_get function, monitoring on the specified voltage level can be performed. Argument e_lvd_level_t lvd_level Voltage level for detecting operation voltage drop LVD_LEVEL0_2P83: 2.83V LVD_LEVEL1_2P66: 2.66V LVD_LEVEL3_2P50: 2.50V LVD_LEVEL5_2P33: 2.33V LVD_LEVEL7_2P17: 2.17V LVD_LEVEL9_2P00: 2.00V LVD_LEVELB_1P84: 1.84V LVD_LEVELD_1P67: 1.67V e_lvdbat_level_t lvdbat_level Voltage level for detecting battery voltage drop LVDBAT_LEVEL5_2P33: 2.33V LVDBAT_LEVEL7_2P17: 2.17V LVDBAT_LEVEL9_2P00: 2.00V LVDBAT_LEVELB_1P84: 1.84V LVDBAT_LEVELD_1P67: 1.67V lvd_cb_t cb Address for the user processing callback number to be executed during Safe Shutdown operation when the operation voltage drop is detected Set the type of void (*lvd_cb_t)(void) Return Value None Code Placement RAM

R01AN4837EJ0111 Rev.1.11 Page 52 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

lvdbat_change_setting Overview Change battery voltage monitoring function settings Header lvd_lvdbat.h Declaration void lvdbat_change_setting (e_lvdbat_direction_t dir, e_lvdbat_level_t level, uint8_t int_flag) Description Changes settings of detection voltage and interrupt for monitoring the battery voltage. By setting the argument int_flag to 1 and enabling the interrupt, the callback function specified by the argument cb in the lvd_lvdbat_init function is executed when the interrupt occurs. Argument e_lvdbat_direction_t dir Battery voltage monitoring direction LVDBAT_DIRECTION_UP: Detects rising. LVDBAT_DIRECTION_DOWN: Detects falling. LVDBAT_DIRECTION_BOTH: Detects both of rising and falling. e_lvdbat_level_t lvdbat_level Battery voltage level to be detected About e_lvdbat_level, see description of the argument lvdbat_level in the lvd_lvdbat_init function. uint8_t int_flag Enables/disables interrupt. 0: Interrupt disabled 1: Interrupt enabled Return Value None Code Placement RAM

lvdbat_status_get Overview Acquire battery voltage monitoring results Header lvd_lvdbat.h Declaration e_lvdbat_status_t lvdbat_status_get(void) Description Sets the battery voltage monitoring results in the return value. Get the high and low values for the battery voltage sensing voltage level set by the lvd_lvdbat_init or lvdbat_change_setting functions. Argument None Return Value e lvdbat_status_t LVDBAT_STATUS_LOW: Battery voltage is lower than the specified level. LVDBAT_STATUS_HIGH: Battery voltage is equal to or higher than the specified level. Code Placement RAM

cb_lvd Overview Callback function of LVD_LVD1 non-maskable interrupt Header None Declaration void cb_lvd(void) Description A callback function of RE01 group non-maskable interrupt. This function is executed from the NMI_Handler function and performs Safe Shutdown operation. Executes the lvd_callback function for user process during Safe Shutdown operation. In this function, power supply to the device is stopped to initialize the EHC circuit. Argument None Return Value None Code Placement RAM

R01AN4837EJ0111 Rev.1.11 Page 53 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

cb_lvdbat Overview Callback function of LVD_LVDBAT interrupt Header None Declaration void cb_lvdbat(void) Description A callback function of the voltage monitor BAT interrupt LVD_LVDBAT of the RE01 group voltage monitor BAT circuit. The LVD_LVDBAT interrupt is only used as a return source from standby, for which this function performs no processing. Argument None Return Value None Code Placement RAM

R01AN4837EJ0111 Rev.1.11 Page 54 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

4.8 How to replace a demo operation with user application The following Table 4-6 is an example of how you can change or add sample code processing. Table 4-6 Examples of changes and additions to processing

Example of Processing Modified Function Place of Change or Addition and Description Change/Addition When processing during ehc_Startup_ramfunc Add processing to this function. startup operation is to be () For details, see section 4.6.2. added When there is a need to re01_init() Change the initial settings of the peripheral hardware functions of change the processing of this function. the application operation sample_application() Change the function processing. When processing to be battery_recovery() Add processing before or after a transition to standby mode. performed before or after For details of this function, see section Battery Recovery the Battery Recovery state Operation. (standby) is to be added When processing to be lvd_callback() Add processing to this function. Since this function is executed performed before entering within a non-maskable interrupt, no interrupt can be used. the Safe Shutdown state For details of this function, see section 4.6.5. (power supply off) is to be added When a regulator and ext_power_on() Referring to this function, add or change the power system peripheral LSI have been turn-ON function in the following procedure: added, and the ⎯ Initialize the peripheral LSI pins to which power is controllable power system supplied. is to be expanded ⎯ Turn the regulator on. ⎯ Disable power supply open control circuit. ⎯ Initialize the powered peripheral LSIs. For where to execute the power system turn-ON function, refer to this function. ext_power_off() Referring to this function, add or change the power system turn-OFF function in the following procedure: ⎯ End the peripheral LSIs operation for which power is shut off ⎯ Enable power supply open control circuit. ⎯ Turn the regulator off. ⎯ Open the shut-off peripheral LSI pins. For where to execute the power system turn-OFF function, refer to this function. main() Change the argument of R_LPM_IOPowerSupplyModeSet() according to the initial settings of the added power system at the start of application operation When there is a need to re01_init() Add initial settings for a peripheral hardware function to be added. return from intermittent app_lowpower_ Add the return source from standby to the argument operation standby mode intermittet() s_st_sstby_cfg.wup of the standby mode setting function separately from the app_normalpower_ R_LPM_SSTBYModeSetup() called within this function. periodic timer intermittet() When using the peripheral function driver, assign IRQ numbers to standby mode return factor interrupts in r_system_cfg.h. Referring to timer_start(), enable the return source interrupt before entering standby mode.

R01AN4837EJ0111 Rev.1.11 Page 55 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

When the period of the - Change the definition in appli_cfg.h. (For details of the definition periodic timer is to be see section List of Constants.) changed The threshold voltages are main() Change the argument of lvd_lvdbat_init(). to be changed. battery_recovery() Change the argument of lvdbat_change_setting().

R01AN4837EJ0111 Rev.1.11 Page 56 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller 5. Debugging This chapter show how to debug a program for an energy harvesting system using the sample code for reference. 5.1 Debugging Energy Harvesting Startup Program When using the Evaluation Kit to debug the energy harvesting program, the explanation of this section should be followed.

5.1.1 Procedure for Program Debugging The program debugging procedure is shown below. For normal startup settings of the Evaluation Kit as well as energy harvesting startup settings, refer to the Evaluation Kit User’s Manual and schematics. In this chapter, the phrase "steady operation period" means an interval after energy harvesting startup has been performed and the register EHCCR1.QUICKMODE bit has been set to 1. (The definition is similar to that in Energy Harvesting Control Circuit, in the Hardware Edition of the User’s Manual for this device.)

(1) Debugging during normal operation period

1. Create a steady operation period program. (It can be a program that bypasses energy harvesting startup processing.) 2. Download the program to target device using Evaluation Kit with normal startup settings. 3. Evaluate the program in a normal operation period. (1) If operation differs from what is expected, return to step 1 and modify the program.

(2) Debugging including energy harvesting startup

1. Create a program that includes energy harvesting startup processing. 2. Change the Evaluation Kit to normal startup settings, and download the program to target device. 3. Disable debugger connections. 4. Change the Evaluation Kit to energy harvesting startup settings. 5. Supply an adequate power to the VSC_VCC pin of this device, and evaluate the program. (In particular, the voltage monitoring hardware functions LVD1 and LVDBAT of the RE01 group should be evaluated using separately prepared voltage sources. The evaluation method is described in the next chapter.) (1) When operation differs from what is expected, return to step 1 and modify the program. 6. Change the current source to the assumed power generation element and evaluate the program. (1) When operation differs from what is expected, after again examining the power balance, return to step 1 and modify the program.

It is also possible to debug the energy harvesting startup program while maintaining the connections between the debugger and this device, but partial modification of the Evaluation Kit RE01 1500KB is necessary. For details, refer to section 5.1.4.

R01AN4837EJ0111 Rev.1.11 Page 57 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller 5.1.2 LVD1 function Debugging Method When LVD1 function is implemented with energy harvesting startup, debugging uses the following procedure. Figure 5-1 shows an example of connections in the evaluation environment at this time.

1 Input an adequate power to the VSC_VCC pin and start up the device. 2 Transition the device to a secondary battery charging period or to a steady operation period. 3 Apply an arbitrary voltage to the VCC/IOVCC pin, and perform evaluation.

RE01-1500KB

REG レRギegulatorュレータ VSC_VCC VBAT_EHC

secondary current 二次電池 ロloadード スswitchイッチ 電流源 ↑ VSS battery SW source

VSC_GND VCC 周peripheral辺 V SW REG LSILSI

Voltage電圧源 source Figure 5-1 Example of Connections in Evaluation Environment when Evaluating LVD1 at Energy Harvesting Startup

5.1.3 LVDBAT function Debugging Method Debugging when LVDBAT is implemented should be performed based on the procedure indicated below. Figure 5-2 shows an example of connections in the evaluation environment at this time.

1 Input adequate power to the VSC_VCC pin and start up the device. 2 Transition the device to a secondary battery charging period or a steady operation period. 3 Apply an arbitrary voltage to VBAT_EHC, and perform evaluation.

RE01-1500KB REG Rレegulatorギュレータ VSC_VCC VBAT_EHC

Voltage SW ロloadード switchスイッチ current電流源 ↑ 電圧源 V source source VSS

VSC_GND VCC 周辺 SW REG peripheral LSILSI

Figure 5-2 Example of Connections in Evaluation Environment when Evaluating LVDBAT at Energy Harvesting Startup

R01AN4837EJ0111 Rev.1.11 Page 58 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

5.1.4 Method of Debugging while Maintaining Debugger Connections In debugging of the device during energy harvesting startup, the two points noted in Table 5-1 must be kept in mind. When debugging an energy harvesting startup program using the Evaluation Kit while maintaining debugger connections, the measures described in Table 5-2 should be taken.

Table 5-1 Points to be Noted when Debugging Energy Harvesting Startup Program

Point to Note Description Increased power With a debugger connected, the power consumption of most microcontrollers increases consumption with debugger due to operation of specialized circuits. connected Mismatch of communication The voltage supplied from a power generation element varies depending on the levels with the debugger environment. Depending on the hardware configuration, this voltage variation may cause mismatches in the communication levels of the debugger and target chip.

Table 5-2 Measures to Take when Using Evaluation Kit for Debugging with Debugger Connections Maintained

Problem Measures Using Evaluation Kit Increased power consumption with Either adjust the power generation environment of the power generation debugger connected element, or use a current source to supply adequate power to VSC_VCC. Mismatch of communication levels J-Link OB cannot be used. A separate emulator should be prepared and with the debugger connected to the MIPI20 connector (CN2). In addition, when using RE01 1500KB Group,the following two measures should be taken. (1) Power supply input from the emulator that has been prepared to the board should be disabled. (2) The circuit line to the Vin pin -J22 of I-Jet/E2 connector (CN2) should be cut out, and the Vin pin and VCC/IOVCC connected. (A schematic circuit diagram appears in Figure 5-3; a modified example is shown in Figure 5-4.)

REG SW RE01-1500KB U3 U10 3 VCC/IOVCC 2 1 2 J5 1 REG J22 U8 PWR1 IOVCC0-3 AVCC0-1 Step1.Step.1 Board_3V3 VREFH0 パターンカットPattern cut VCC_SUB x 電源Powerライン Line Step.2 ShortShort Step2. 短絡 Vin Vout 1

REG Rレギュレータegulator PatternPattern cut cut SWCLK SWDIO

Patter I-Jet/E2 SW ロードスイッチload switch n cut CN2

Figure 5-3 Schematic Diagram of Measure to Use with Evaluation Kit to Maintain Debugger Connections during Energy Harvesting Startup(RE01 1500KB Group only)

R01AN4837EJ0111 Rev.1.11 Page 59 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

(component side) After Modification Before Modification

(reverse side) Step 1: Pattern cutting Disconnect CN2-1 pin from Board_3V3

Step2. Short J5 Short CN2-1 pin and J5-2 pin (reverse side) (VCC/IOVCC terminals)

Figure 5-4 Example of Measure Taken with Evaluation Kit to Maintain Debugger Connections during Energy Harvesting Startup(RE01 1500KB Group only) (Photos show items in development, and so the silkscreen printing differs from that of commercial products)

R01AN4837EJ0111 Rev.1.11 Page 60 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller 6. Troubleshooting Table 6-1 indicates phenomena that tend to occur during debugging, and items to be checked at such times.

Table 6-1 Troubleshooting

Phenomenon Items to Check The time required to complete startup Use the discharge switches (Evaluation Kit RE01 1500KB switches operation (energy harvesting startup) SW8 and SW9, Evaluation Kit RE01 256KB switches SW7 and SW8) to changes. remove electric charge and repeat evaluation. Once the system is started up, electric charge may remain within the LSIs and in wiring even after power supplies are turned off. These switches are used to remove residual charge. (Avoid long pressing of the discharge switches.) Check whether the initial voltages of the supercapacitor and the secondary battery have changed. In startup operation, processing is performed to charge the device connected to VBAT_EHC; if the voltages of the supercapacitor and secondary battery are different, the time required to complete charging will be different. Check whether the power generation environment is the same. For example, the amount of power generated by a solar panel will be different during the day and at night even if the panel is indoors, depending on the room arrangement. Application operation does not start. Has energy harvesting startup completed? The battery capacity may be large, requiring more time to charge. If processing to be performed during energy harvesting startup has been added, is the power consumed by this processing less than the power generated by the power generation element? If the power consumed by the added processing is greater than the amount of power generated, the battery will not be charged, and transition to the application operation state will not be possible. The program stops running. Does it stop running before or after a transition to EXFPWON mode or MINPWON mode? If it stops before or after EXPWON, are any added functions and code present in RAM? In EXFPWON mode, the Flash power supply is turned off; therefore code for execution must be present in RAM. Does it stop running before or after a transition to standby mode? If it stops before or after a standby mode transition, it may be that the interrupt return processing cannot be executed. Re-check the module interrupt settings, and check whether the wakeup interrupt enable register (WUPEN) is set correctly. There is no response to a signal input to Is the power supply open control register (VOCR) set correctly? this device. In order to prevent the propagation of undefined signals on system startup, the initial VOCR settings are set to block input signals. Is the multi-pin function controller register set correctly? It may be that module hardware functions are not allocated to pins. The debugger cannot be connected at the In order to continue debugger connection during energy harvesting time of energy harvesting startup. startup using the Evaluation Kit, the measures described in chapter 5.1.4 are necessary.(RE01 1500KB Group only)

R01AN4837EJ0111 Rev.1.11 Page 61 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller Reference Documents ⚫ User’s Manual: Hardware ・ RE01 Group User’s Manual: Hardware (The latest version can be downloaded from the website.)

⚫ User's Manual: Evaluation Kit RE01 Evaluation Kit RE01 1500KB User's Manual (R20UT4379) Evaluation Kit RE01 1500KB Main board schematic (R20UT4563) Evaluation Kit RE01 256KB User's Manual (R20UT4801) Evaluation Kit RE01 256KB Main board schematic (R20UT4802) MIP-LCD expansion board circuit diagram (R20UT4564) (Please get the latest version from Renesas Electronics website)

 Driver Software Package  RE01 1500KB CMSIS Driver Package (R01AN5355)  RE01 256KB CMSIS Driver Package(R01AN5473)  RE01 1500KB,256KB Group Getting Started Guide to Development Using CMSIS Package Application Note (R01AN4660) (The latest version can be downloaded from the Renesas Electronics website.)

 Driver Software Manuals (There documents are included in CMSIS Driver Package)  Getting Started Guide to Development Using CMSIS Package  Maintenance free power management by RE energy harvesting controllers  Maintenance free power management by RE energy harvesting controllers  CMSIS Driver R_LPM Driver Specifications  CMSIS Driver R_SMIP Driver Specifications (The latest version can be downloaded from the Renesas Electronics website.)

 Technical Update/Technical News (The latest version can be downloaded from the Renesas Electronics website.)

 User’s Manual: Development Tools (The latest version can be downloaded from the Renesas Electronics website.)

R01AN4837EJ0111 Rev.1.11 Page 62 of 63 2020.09.24 RE01 1500KB Group, 256KB Group Maintenance free power management by RE energy harvesting controller

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.

R01AN4837EJ0111 Rev.1.11 Page 63 of 63 2020.09.24

Revision History Description Rev. Date Page Summary 1.00 Oct. 23, 2020 - First edition issued 1.10 Jul. 14, 2020 - Changed chapter structure Added RE01 256KB group information Changed behavioral specification of the sample code Changed structure of the sample code 1.11 Sep. 24, 2020 1 Video Contents was added. 62 Fixed an error in the driver software package document number Sample r01an4837_re_power_management_1500kb code Changed the project settings of e2 studio. (1500KB  Changed “Reset before download” option in Debug version) Configurations from “No” to “Yes”.

General Precautions in the Handling of Microprocessing Unit and Microcontroller Unit Products

The following usage notes are applicable to all Microprocessing unit and Microcontroller unit 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.

1. Precaution against Electrostatic Discharge (ESD) A strong electrical field, when exposed to a CMOS device, can cause destruction of the gate oxide and ultimately degrade the device operation. Steps must be taken to stop the generation of static electricity as much as possible, and quickly dissipate it when it occurs. Environmental control must be adequate. When it is dry, a humidifier should be used. This is recommended to avoid using insulators that can easily build up static electricity. Semiconductor devices must be stored and transported in an anti-static container, static shielding bag or conductive material. All test and measurement tools including work benches and floors must be grounded. The operator must also be grounded using a wrist strap. Semiconductor devices must not be touched with bare hands. Similar precautions must be taken for printed circuit boards with mounted semiconductor devices. 2. Processing at power-on The state of the product is undefined at the time when power is supplied. The states of internal circuits in the LSI are indeterminate and the states of register settings and pins are undefined at the time when power is supplied. In a finished product where the reset signal is applied to the external reset pin, the states of pins are not guaranteed from the time when power is supplied until the reset process is completed. In a similar way, the states of pins in a product that is reset by an on-chip power-on reset function are not guaranteed from the time when power is supplied until the power reaches the level at which resetting is specified. 3. Input of signal during power-off state Do not input signals or an I/O pull-up power supply while the device is powered off. The current injection that results from input of such a signal or I/O pull-up power supply may cause malfunction and the abnormal current that passes in the device at this time may cause degradation of internal elements. Follow the guideline for input signal during power-off state as described in your product documentation. 4. Handling of unused pins Handle unused pins in accordance with the directions given under handling of unused pins in the manual. The input pins of CMOS products are generally in the high- impedance state. In operation with an unused pin in the open-circuit state, extra electromagnetic noise is induced in the vicinity of the LSI, an associated shoot- through current flows internally, and malfunctions occur due to the false recognition of the pin state as an input signal become possible. 5. Clock signals After applying a reset, only release the reset line after the operating clock signal becomes stable. When switching the clock signal during program execution, wait until the target clock signal is stabilized. When the clock signal is generated with an external resonator or from an external oscillator during a reset, ensure that the reset line is only released after full stabilization of the clock signal. Additionally, when switching to a clock signal produced with an external resonator or by an external oscillator while program execution is in progress, wait until the target clock signal is stable. 6. Voltage application waveform at input pin

Waveform distortion due to input noise or a reflected wave may cause malfunction. If the input of the CMOS device stays in the area between VIL (Max.) and VIH (Min.) due to noise, for example, the device may malfunction. Take care to prevent chattering noise from entering the device when the input level is fixed, and also in

the transition period when the input level passes through the area between VIL (Max.) and VIH (Min.). 7. Prohibition of access to reserved addresses Access to reserved addresses is prohibited. The reserved addresses are provided for possible future expansion of functions. Do not access these addresses as the correct operation of the LSI is not guaranteed. 8. Differences between products Before changing from one product to another, for example to a product with a different part number, confirm that the change will not lead to problems. The characteristics of a microprocessing unit or microcontroller unit products in the same group but having a different part number might differ in terms of internal memory capacity, layout pattern, and other factors, which can affect the ranges of electrical characteristics, such as characteristic values, operating margins, immunity to noise, and amount of radiated noise. When changing to a product with a different part number, implement a system-evaluation test for the given product.

Notice

1. 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 or any other use of the circuits, software, and information in the design of your product or system. Renesas Electronics disclaims any and all liability for any losses and damages incurred by you or third parties arising from the use of these circuits, software, or information. 2. Renesas Electronics hereby expressly disclaims any warranties against and liability for infringement or any other claims involving patents, copyrights, or other intellectual property rights of third parties, by or arising from the use of Renesas Electronics products or technical information described in this document, including but not limited to, the product data, drawings, charts, programs, algorithms, and application examples. 3. No license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property rights of Renesas Electronics or others. 4. You shall not alter, modify, copy, or reverse engineer any Renesas Electronics product, whether in whole or in part. Renesas Electronics disclaims any and all liability for any losses or damages incurred by you or third parties arising from such alteration, modification, copying or reverse engineering. 5. Renesas Electronics products are classified according to the following two quality grades: “Standard” and “High Quality”. The intended applications for each Renesas Electronics product depends on the product’s quality grade, as indicated below. "Standard": Computers; office equipment; communications equipment; test and measurement equipment; audio and visual equipment; home electronic appliances; machine tools; personal electronic equipment; industrial robots; etc. "High Quality": Transportation equipment (automobiles, trains, ships, etc.); traffic control (traffic lights); large-scale communication equipment; key financial terminal systems; safety control equipment; etc. Unless expressly designated as a high reliability product or a product for harsh environments in a Renesas Electronics data sheet or other Renesas Electronics document, Renesas Electronics products are not intended or authorized for use in products or systems that may pose a direct threat to human life or bodily injury (artificial life support devices or systems; surgical implantations; etc.), or may cause serious property damage (space system; undersea repeaters; nuclear power control systems; aircraft control systems; key plant systems; military equipment; etc.). Renesas Electronics disclaims any and all liability for any damages or losses incurred by you or any third parties arising from the use of any Renesas Electronics product that is inconsistent with any Renesas Electronics data sheet, user’s manual or other Renesas Electronics document. 6. When using Renesas Electronics products, refer to the latest product information (data sheets, user’s manuals, application notes, “General Notes for Handling and Using Semiconductor Devices” in the reliability handbook, etc.), and ensure that usage conditions are within the ranges specified by Renesas Electronics with respect to maximum ratings, operating power supply voltage range, heat dissipation characteristics, installation, etc. Renesas Electronics disclaims any and all liability for any malfunctions, failure or accident arising out of the use of Renesas Electronics products outside of such specified ranges. 7. Although Renesas Electronics endeavors to improve the quality and reliability of Renesas Electronics products, semiconductor products have specific characteristics, such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. Unless designated as a high reliability product or a product for harsh environments in a Renesas Electronics data sheet or other Renesas Electronics document, Renesas Electronics products are not subject to radiation resistance design. You are responsible for implementing safety measures to guard against the possibility of bodily injury, injury or damage caused by fire, and/or danger to the public in the event of a failure or malfunction of Renesas Electronics products, 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 and impractical, you are responsible for evaluating the safety of the final products or systems manufactured by you. 8. Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product. You are responsible for carefully and sufficiently investigating applicable laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the EU RoHS Directive, and using Renesas Electronics products in compliance with all these applicable laws and regulations. Renesas Electronics disclaims any and all liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations. 9. Renesas Electronics products and technologies shall 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. You shall comply with any applicable export control laws and regulations promulgated and administered by the governments of any countries asserting jurisdiction over the parties or transactions. 10. It is the responsibility of the buyer or distributor of Renesas Electronics products, or any other party who distributes, disposes of, or otherwise sells or transfers the product to a third party, to notify such third party in advance of the contents and conditions set forth in this document. 11. This document shall not be reprinted, reproduced or duplicated in any form, in whole or in part, without prior written consent of Renesas Electronics. 12. Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas Electronics products. (Note1) “Renesas Electronics” as used in this document means Renesas Electronics Corporation and also includes its directly or indirectly controlled subsidiaries. (Note2) “Renesas Electronics product(s)” means any product developed or manufactured by or for Renesas Electronics.

(Rev.4.0-1 November 2017)

Corporate Headquarters Contact information TOYOSU FORESIA, 3-2-24 Toyosu, For further information on a product, technology, the most up-to-date Koto-ku, 135-0061, version of a document, or your nearest sales office, please visit: www.renesas.com www.renesas.com/contact/. Trademarks Renesas and the Renesas logo are trademarks of Renesas Electronics Corporation. All trademarks and registered trademarks are the property of their respective owners.

© 2020 Renesas Electronics Corporation. All rights reserved.