background image

RX230 Group, RX231 Group 

Initial Settings and Usage Procedure of RTC Battery Backup Function 

R01AN4831EJ0100  Rev.1.00 

 

Page 4 of 23 

Aug.20.19 

 

1.  Overview 

1.1  About this Application Note 

The battery backup function uses a dedicated battery backup power supply (VBATT) to ensure that the 
RTC

’s clock function continues to operate even if the VCC power supply is interrupted. In the operation 

example described below, time information from the RTC is displayed on an LCD panel, allowing 
confirmation that the RTC continues to operate when in the battery backup state.  
The operating conditions of the sample program are described in (1) to (6) below, and the VCC and VBATT 
states are listed in Table 1.1. 

 

Figure 1.1   Battery Backup Function 

(1) Power-on (VCC on and VBATT on) 

The RTC operates, and time information is displayed on the LCD. 

 
(2) Automatic switch to VBATT at VCC drop (VCC on 

 off, VBATT on) 

When the VCC power supply drops below the monitoring voltage (3.10V), the time information and switch 
(connected to P34 pin) press count are stored in the data flash. 
When the VCC power supply drops still further and reaches VDETBATT ±0.1 V (typ.), the power supply of 
the RTC sub-clock switches automatically to the VBATT power supply. The LCD that displays the time 
information goes blank. 

 
(3) VBATT voltage drop detection (VCC off, VBATT on) 

During battery backup, RTC operation continues. Dung this period, if battery voltage drops below 1.8V, 
RTC operation is not guaranteed and VBATRLVDETF bit set to 1. By checking this bit, we can confirm 
whether VBAT voltage dropped below 1.8V.  
Also, time information is captured using the RTCIC1 pin (rising-edge input). 

 
(4) VCC recovery (VCC off 

 on, VBATT on) 

When VCC recovers to VD ±0.1 V (typ.), use of the VCC power supply resumes. 
VBATTSR.VBATRLVDETF is checked. If the value is 1, VBATT is determined to be less than 1.8 V and 
the RTC is initialized. 

 
(5) Power supply recovery (VCC on, VBATT on) 

If VBATT hasn’t dropped below 1.8V, after VCC recovery, the elapsed time is updated, and the latest time 
information is displayed on the LCD. 

 
(6) VBATT pin voltage monitor function (VCC on, VBATT on 

 off) 

When VBATT is less than Vdetvbt (is set to 2.2 V), a VBATT pin voltage drop detection interrupt is 
generated and a voltage drop alert is displayed on the LCD. 

 
 

Sub Clock Circuit

RTC

RTC Regulator

VDETBATT

VBATT Voltage Monitor

VBATT Volt. Drop Detection

PORT

P34

Battery 

Backup 

Function

VCC

VBATT

RTCIC1

Voltage Monitoring 1

Switch

Switch

Vcc

VBATT

(1)

(2)

VDETBATT

(3)

VDETBATT

(4)

(5)

(6)

Содержание RX230

Страница 1: ...nded after making modifications to comply with the alternate MCU Related Application Notes Application notes related to this application note are listed below Consult them in conjunction with this application note Firmware Integration Technology User s Manual R01AN1833 RX Family Adding Firmware Integration Technology Modules to Projects R01AN1723 RX Family Adding Firmware Integration Technology Mo...

Страница 2: ...tion 12 3 4 Option Setting Memory Settings 12 3 5 Constants 13 3 6 Variables 13 3 7 Functions Used 13 3 8 Function Specifications 14 3 8 1 main 14 3 8 2 flash_Init 14 3 8 3 display_time 14 3 8 4 display_info 15 3 8 5 backup_time 15 4 Flowcharts 16 4 1 main Function main 16 4 2 Erase Data Flash Function flash_Init 17 4 3 Display Time Information Function display_time 17 4 4 Battery Status and Switc...

Страница 3: ...RX230 Group RX231 Group Initial Settings and Usage Procedure of RTC Battery Backup Function R01AN4831EJ0100 Rev 1 00 Page 3 of 23 Aug 20 19 Revision History 23 ...

Страница 4: ...supply of the RTC sub clock switches automatically to the VBATT power supply The LCD that displays the time information goes blank 3 VBATT voltage drop detection VCC off VBATT on During battery backup RTC operation continues Dung this period if battery voltage drops below 1 8V RTC operation is not guaranteed and VBATRLVDETF bit set to 1 By checking this bit we can confirm whether VBAT voltage drop...

Страница 5: ...initial state Vcc On active Vbatt On No generated Enable Operating Yes No Yes Enable 2 Vcc On Off Vbatt On On switch to battery Generated No Operating Turn off Saved No Enable 3 Vcc Off Vbatt On battery active On hold No Operating No if VBATT below 1 8V No Saved No Enable inputted 4 Vcc Off On switch to VCC Vbatt On Released No Operating Turn on Saved No Yes if VBATT below 1 8V detected Enable 5 V...

Страница 6: ...ttery backup power supply voltage drop 1 8 V detected VCC on Initialize LCD Display RTC information on LCD VBATRLVDETF 2 Initialize sub clock oscillator RTC setting and switch count Clear VBATRLVDETF bit to 0 No Yes Check whether battery voltage has dropped below 1 8V Vdet1 interrupt Save data to flash if VCC drops below 3 1V Return VBATT interrupt Display voltage drop alert If VBATT voltage drops...

Страница 7: ...ogram uses FIT modules to control battery backup function and programming of the flash memory LCD display software uses the sample code provided with the RSK board and the drivers of other functions than battery backup and flash programming are generated using Smart Configurator SC Note that in the sample program R_Config_RTC_Create function call which is generated for RTC battery backup operation...

Страница 8: ...SP RX Family Board Support Package Module Using Firmware Integration Technology R01AN1685 r_bsp_rx 5 20 Device driver RX Family Battery Backup Function Module Firmware Integration Technology R01AN2796 r_vbatt_rx 1 03 RX Family Flash Module Using Firmware Integration Technology R01AN2184 r_flash_rx 4 00 Table 1 4 Sample Code Type Application Note Title Document No Revision Sample Code RX231 Group R...

Страница 9: ...nector USB serial port Power LED Power connector 5 V E1 connector User LED USB Host USB Function port User switches E1 emulator Potentiometer Expansion board interface application header Touch keys Touch slider Figure 2 1 RSKRX231 2 2 Pins Used The MCU pins used are listed below Table 2 1 Related Pins Pin Name I O Description PC7 Output SCI8 transmit PC5 Output SCI8 clock P31 Input RTC input captu...

Страница 10: ...heral clock D PCLKD 27 MHz PLL 2 Flash interface clock FCLK 27 MHz PLL 2 2 4 LCD Panel The LCD panel Pmod specification included with the RSK is used 2 5 Hardware Modifications To confirm the operation of the sample program modifications were made to the RSK to enable battery backup operation 2 5 1 VBATT Connection The RX231 RSK board is provided with jumper J10 to allow confirming operation of th...

Страница 11: ...1 RSK board is designed SW1 for IRQ1 RTCIC1 input and it is set to pull up by VCC It is therefore necessary to make the following modifications 1 Remove resistor R271 2 Connect IRQ1 to VBATT battery through an external switch 3 When the switch is turned on VBATT is connected to IRQ1 For reference when performing modifications see Figure 2 4 RTCIC1 Circuit Detail Excerpted from RSKRX231 CPU Board S...

Страница 12: ...ealtime clock Config_CMT0 Compare match timer module Supplies control functionality and drivers for the compare match timer Config_LVD1 Voltage detection circuit module Supplies control functionality and drivers for the voltage detection circuit Config_PORT Port module Supplies control functionality and drivers for the port Config_SCI8 SPI clock synchronous communication module Supplies control fu...

Страница 13: ...nctions Function Name Outline main System main function display_time Display time information display_info Display battery and switch states backup_time Write time information to the data flash flash_Init Erase the data flash and perform blank checking The functions used in the sample code of each FIT SC modules are listed below Table 3 7 SC Module Functions Function Name Outline Contained in File...

Страница 14: ...R_Config_RTC_Set_CalendarCounterValue R_Config_RTC_Start R_VBATT_Open R_VBATT_GetStatus Arguments Return value 3 8 2 flash_Init Table 3 9 flash_Init Function Item Details Function Name flash_Init Outline Erases data flash to store RTC information Declaration void flash_Init void Description Erases block 0 of data flash and performs blank checking Functions called R_FLASH_Erase R_FLASH_BlankCheck A...

Страница 15: ...info uint8_t Description Displays the battery and switch states on the LCD Functions called R_LCD_Display Arguments Display start line count Return value 3 8 5 backup_time Table 3 12 backup_time Function Item Details Function Name backup_time Outline Save time information function Declaration void backup_time void Description Reads time information from the RTC and stores it in the data flash Func...

Страница 16: ...ation display_time PRD interrupt initial settings Initialize variable Erase data flash flash_Init Display RTC time information display_time Display battery state and switch push count display_info Check battery state R_VBATT_GetStatus Check switch push count Yes No Yes No Start voltage detection circuit R_Config_LVD1_Start Initialize VBATT R_VBATT_Open Is there a save history 55AAh at flash memory...

Страница 17: ...ase Data Flash Function 4 3 Display Time Information Function display_time Figure 4 3 is a flowchart of the function for displaying time information on the LCD display_time RETURN line_num 7 Read RTC capture value R_Config_RTC_Get_Calendar TimeCaptureValue1 Display on LCD R_LCD_Display Convert year month and day to ASCII Yes No Read RTC information R_Config_RTC_Get_CalendarCounterValue Convert hou...

Страница 18: ...witch Push Count Display Function display_time Figure 4 4 is a flowchart of the function for displaying the battery status and switch push count on the LCD display_info RETURN batty_err 1 Display on LCD R_LCD_Display Yes No Convert switch push count to ASCII Set empty field in array Set ALERT in array Figure 4 4 Battery Status and Switch Push Count Display Function ...

Страница 19: ...tion for saving time information to the data flash Vdet1 interrupt processing Figure 4 5 Save Time Information Function backup_time RETURN Write to data flash R_FLASH_Write Set year month day hour minute and second data in array Set battery state and switch push count in array Set flash write history in array Read RTC information R_Config_RTC_Get_CalendarCounterValue Verify data written to flash S...

Страница 20: ... count RTC input capture time Flash save data Figure 5 1 Display Setting 5 1 1 Execution During Battery Backup Operation 1 After VCC and VBATT are turned on the LCD displays the time counting every second The battery state and the number of times SW2 has been pressed are also displayed RX231 Bat backup Real time 19 04 30 23 59 40 BAT SW 12 Capture time Previous time Figure 5 2 Display During Norma...

Страница 21: ...ert is displayed Figure 5 4 Alert Display When VBATT Drops 5 1 2 Battery Backup Operation Disruption If VCC is turned on after VCC and VBATT were cut off the time information and SW2 push count saved at the previous time VCC dropped is displayed on the LCD screen Figure 5 5 Display when VCC Recovery after VCC and VBATT Disruption RX231 Bat backup Real time 19 05 01 00 10 30 BAT ALERT SW 00 Capture...

Страница 22: ...ring MCU is powered by VCC Moreover during VCC powers all functions multiplexed can be used However after power was switched to VBATT only RTC input capture function can continue to operate This means if these pins are set to other functions that RTC input capture during VCC power after switching to VBATT those function cannot continue to operate and pin states become Hi Z Therefore in case batter...

Страница 23: ...231 Group Initial Settings and Usage Procedure of RTC Battery Backup Function R01AN4831EJ0100 Rev 1 00 Page 23 of 23 Aug 20 19 Revision History Rev Date Description Page Summary 1 00 Aug 20 2019 First edition issued ...

Страница 24: ...put 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 ...

Страница 25: ...ons 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 hi...

Отзывы: