background image

RX230 Group, RX231 Group 

Initial Settings and Usage Procedure of RTC Battery Backup Function 

R01AN4831EJ0100  Rev.1.00 

 

Page 12 of 23 

Aug.20.19 

 

3.  Software 

The configuration and functions of the software referenced in this application note are described below. The 
folder containing the files generated automatically by the FIT modules and SC is smc_gen, which is in the src 
folder. 

3.1  FIT Modules 

The folders containing the FIT modules used by the sample program are listed below.  

Table 3.1   FIT Module Folders 

Folder Name 

Module Name 

Description 

r_bsp 

Board support package module 

Supplies code for the MCU and the board used. 

r_vbat_rx 

Battery backup module 

Supplies battery backup control functionality. 

r_flash_rx 

Flash control module 

Supplies control functionality and drivers for flash 
programming. 

r_config 

FIT header files 

Header files of FIT modules used 

Note:  For the configuration and functions of the various FIT modules, refer to the specifications of each 

module. 

3.2  SC Components 

The folders containing the SC components used by the sample program are listed below. 

Table 3.2   SC Component Folders 

Folder Name 

Component Name 

Description 

Config_RTC  

Realtime clock module 

Supplies control functionality and drivers for the 
realtime 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 functionality and drivers for the 
SPI clock synchronous communication. 

general 

SC header files 

Header files of SC components used 

Note:  For the configuration and functions of the various SC components, refer to the description of each 

component in Smart Configurator User’s Manual: RX API Reference (R20UT4360). 

3.3  File Composition 

The file configuration of the software referenced in this application note is described below. 
Files, including components of FIT modules, generated automatically by the integrated development 
environment are omitted. 

Table 3.3   User Files 

Folder Name 

File Name 

Description 

Remarks 

src 

main.c 

Main processing source file 

Created by user 

r_okaya_lcd.c 

LCD display software 

RSK sample code 

ascii.c 

ASCII data file for LCD display 

RSK sample code 

Note:  The smc_gen folder in the src folder contains files generated automatically by FIT modules and the 

SC environment. 

3.4  Option-Setting Memory Settings 

Table 3.4, Option-Setting Memory Settings, lists the option-setting memory settings used by the sample 
program. 

Содержание 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...

Отзывы: