Renesas RX API User Manual

Smart Configurator
User's Manual: RX API Reference
Rev.1.05 Oct. 2020
Target Device RX Family
www.renesas.com
All information contained in these materials, including products and product specifications, represents information on the product at the time of publication and is subject to change by Renesas Electronics Corp. without notice. Please review the latest information published by Renesas Electronics Corp. through various means, including the Renesas Electronics Corp.
website (http://www.renesas.com).
How to Use This Manual
Readers The target readers of this manual are the application system engineers who use the
Code Generator and need to understand its function.
Purpose The purpose of this manual is to explain the user for understanding and using the
Code Generator functions. We aim to help their system development including their hardware and software.
Organization This manual can be broadly divided into the following units.
1.GENERAL
2.OUTPUT FILES
3.API FUNCITONS
How to Read This Manual It is assumed that the readers of this manual have general knowledge of electricity,
logic circuits, and microcontrollers.
Conventions Deata significance: Higher digits on the left and lower digits on the right Active low representation: XXX (overscore over pin or signal name) Note: Footnote for item marked with Note in the text Caution: Information requiring particular attention Remark: Supplementary information Numeric representation: Decimal ... XXXX Hexadecimal ... 0xXXXX
All trademarks and registered trademarks are the property of their respective owners.
TABLE OF CONTENTS
1. GENERAL...................................................................................................................................................... 6
1.1 Overview ............................................................................................................................................................ 6
1.2 Features ............................................................................................................................................................... 6
2. OUTPUT FILES ............................................................................................................................................. 7
2.1 Description .......................................................................................................................................................... 7
3. INITIALIZATION .......................................................................................................................................... 20
4. API FUNCTIONS ......................................................................................................................................... 21
4.1 Overview .......................................................................................................................................................... 21
4.2 Function Reference ........................................................................................................................................... 22
4.2.1 Common .................................................................................................................................................. 24
4.2.2 8-Bit timer ................................................................................................................................................ 34
4.2.3 Buses ........................................................................................................................................................ 42
4.2.4 Clock Frequency Accuracy Measurement Circuit ................................................................................... 50
4.2.5 Comparator .............................................................................................................................................. 59
4.2.6 Compare Match Timer ............................................................................................................................. 66
4.2.7 Complementary PWM Mode Timer ........................................................................................................ 76
4.2.8 Continuous Scan Mode S12AD ............................................................................................................... 86
4.2.9 CRC Calculator ...................................................................................................................................... 101
4.2.10 D/A Converter ....................................................................................................................................... 111
4.2.11 Data Operation Circuit ........................................................................................................................... 120
4.2.12 Data Transfer Controller ........................................................................................................................ 129
4.2.13 Dead Time Compensaion Counter ......................................................................................................... 135
4.2.14 DMA Controller ..................................................................................................................................... 142
4.2.15 Event Link Controller ............................................................................................................................ 156
4.2.16 General PWM Timer (GPT) .................................................................................................................. 166
4.2.17 Group Scan Mode S12AD ..................................................................................................................... 183
4.2.18 I2C Master Mode ................................................................................................................................... 200
4.2.19 I2C Slave Mode ..................................................................................................................................... 233
4.2.20 Interrupt Controller ................................................................................................................................ 249
4.2.21 Low Power Consumption ...................................................................................................................... 265
4.2.22 Low Power Timer .................................................................................................................................. 277
4.2.23 Normal Mode Timer .............................................................................................................................. 283
4.2.24 Phase Counting Mode Timer ................................................................................................................. 291
4.2.25 Port Output Enable................................................................................................................................. 300
4.2.26 I/O Port .................................................................................................................................................. 311
4.2.27 Programmable Pulse Generator ............................................................................................................. 315
4.2.28 PWM Mode Timer ................................................................................................................................. 319
4.2.29 Realtime Clock ...................................................................................................................................... 327
4.2.30 Remote Control Signal Receiver ........................................................................................................... 352
4.2.31 SCI/SCIF Asynchronous Mode ............................................................................................................. 368
4.2.32 SCI/SCIF Clock Synchronous Mode ..................................................................................................... 392
4.2.33 Single Scan Mode S12AD ..................................................................................................................... 415
4.2.34 Smart Card Interface Mode .................................................................................................................... 430
4.2.35 SPI Clock Synchronous Mode ................................ ................................................................ ............... 445
4.2.36 SPI Operation Mode .............................................................................................................................. 466
4.2.37 Voltage Detection Circuit ...................................................................................................................... 481
4.2.38 Watchdog Timer .................................................................................................................................... 488
4.2.39 Continuous Scan Mode DSAD .............................................................................................................. 496
4.2.40 Single Scan Mode DSAD ...................................................................................................................... 507
4.2.41 Delta-Sigma Modulator Interface .......................................................................................................... 518
4.2.42 Analog Front End .................................................................................................................................. 527
4.2.43 Motor ..................................................................................................................................................... 530
Revision Record ............................................................................................................................................... 543
Smart Configurator. 2.GENERAL
R20UT4360EJ0105 Rev.1.05 Page 6 of 533 Oct. 20, 2020
1.

GENERAL

This chapter gives an overview of the driver code generator (hereafter abbreviated as Code Generator)
of the Smart Configurator.

1.1 Overview

his tool can output source code (device driver programs as C source and header files) for controlling
peripheral modules (clock generation circuit, voltage detection circuit, etc.) of the device by using a GUI to
set various types of information on the requirements of the project.

1.2 Features

The features of the Code Generator are as follows.
- Generating code
The Code Generator outputs not only device driver files in accord with the information set in the GUI but also a complete set of programs for the build environment, such as a sample program containing
the call of the main function.
- Reporting
Information that was set by using the Code Generator can be output to files in various formats and
used as design documentation.
- Renaming
Default names are given to folders and files output by the Code Generator and to the API functions in
the source code, but these can be changed to user-specified names.
- Protecting user code
,The user can add user's original source code to each API function. When user generated the device
driver programs again by the Code Generator, user's source code within this comment is protected.
[Comment for user source code descriptions] /* Start user code. Do not edit comment generated here */ /* End user code. Do not edit comment generated here */
Code written by the user between these comments will be preserved even when the code is generated again.

Smart Configurator. 2. OUTPUT FILES

R20UT4360EJ0105 Rev.1.05 Page 7 of 533 Oct. 20, 2020
2.
OUTPUT FILES
This chapter explains the file output by the Code Generator.

2.1 Description

The Code Generator outputs the following files.
Table 2.1 Output File List (1/13)
Peripheral Function
File Name
API Function Name
Common
<workspaceName>.c
main
dbsct.c
resetprg.c
PowerON_Reset
sbrk.c
vecttbl.c
vecttbl.h
hwsetup.c
hardware_setup
hwsetup.h
r_cg_hardware_setup.c
r_undefined_exception R_Systeminit
r_cg_macrodriver.h
r_cg_userdefine.h
r_smc_entry.h
r_smc_cgc.c
R_CGC_Create
r_smc_cgc_user.c
R_CGC_Create_UserInit
r_smc_cgc.h
r_smc_interrup.c
R_Interrupt_Create
r_smc_interrupt.h
Pin.c
R_Pins_Create
Pin.h
Smart Configurator. 2. OUTPUT FILES
R20UT4360EJ0105 Rev.1.05 Page 8 of 533 Oct. 20, 2020
Table 2.2 Output File List (2/13)
Peripheral Function
File Name
API Function Name
8-Bit timer
<Config_TMR0>.c
R_<Config_TMR0>_Create R_<Config_TMR0>_Start R_<Config_TMR0>_Stop
<Config_TMR0>_user.c
R_<Config_TMR0>_Create_UserInit r_<Config_TMR0>_cmimn_interrupt r_<Config_TMR0>_ovin_interrupt
<Config_TMR0>.h
Buses
<Config_BSC>.c
R_<Config_BSC>_Create R_<Config_BSC>_Error_Monitoring_Start R_<Config_BSC>_Error_Monitoring_Stop R_<Config_BSC>_InitializeSDRAM
<Config_BSC>_user.c
R_<Config_BSC>_Create_UserInit r_<Config_BSC>_buserr_interrupt
<Config_BSC>.h
Clock Frequency
Accuracy Measurement
Circuit
<Config_CAC>.c
R_<Config_CAC>_Create R_<Config_CAC>_Start R_<Config_CAC>_Stop
<Config_CAC>_user.c
R_<Config_CAC>_Create_UserInit r_<Config_CAC>_mendf_interrupt r_<Config_CAC>_mendi_interrupt r_<Config_CAC>_ferrf_interrupt r_<Config_CAC>_ferri_interrupt r_<Config_CAC>_ovff_interrupt r_<Config_CAC>_ovfi_interrupt
<Config_CAC>.h
Comparator
<Config_CMPB0>.c
R_<Config_CMPB0>_Create R_<Config_CMPB0>_Start R_<Config_CMPB0>_Stop
<Config_CMPB0>user.c
R_<Config_CMPB0>_Create_UserInit r_<Config_CMPB0>_cmpbn_interrupt
<Config_CMPB0>.h
Compare Match Timer
<Config_CMT0>.c
R_<Config_CMT0>_Create R_<Config_CMT0>_Start R_<Config_CMT0>_Stop
<Config_CMT0>_user.c
R_<Config_CMT0>_Create_UserInit r_<Config_CMT0>_cmin_interrupt r_<Config_CMT0>_cmwin_interrupt r_<Config_CMT0>_icmin_interrupt r_<Config_CMT0>_ocmin_interrupt
<Config_CMT0>.h
Smart Configurator. 2. OUTPUT FILES
R20UT4360EJ0105 Rev.1.05 Page 9 of 533 Oct. 20, 2020
Table 2.3 Output File List (3/13)
Peripheral Function
File Name
API Function Name
Complementary PWM Mode Timer
<Config_MTU3_MTU4>.c
R_<Config_MTU3_MTU4>_Create R_<Config_MTU3_MTU4>_Start R_<Config_MTU3_MTU4>_Stop
<Config_MTU3_MTU4>_user.c
R_<Config_MTU3_MTU4>_Create_UserInit r_<Config_MTU3_MTU4>_tgimn_interrupt r_<Config_MTU3_MTU4>_cj_tgimj_interrupt r_<Config_MTU3_MTU4>_cj_tcivj_interrupt
<Config_MTU3_MTU4>.h
Continuous Scan Mode
S12AD
<Config_S12AD0>.c
R_<Config_S12AD0>_Create R_<Config_S12AD0>_Start R_<Config_S12AD0>_Stop R_<Config_S12AD0>_Get_ValueResult R_<Config_S12AD0>_Set_CompareValue R_<Config_S12AD0>_Set_CompareAValue R_<Config_S12AD0>_Set_CompareBValue
<Config_S12AD0>_user.c
R_<Config_S12AD0>_Create_UserInit r_<Config_S12AD0>_interrupt r_<Config_S12AD0>_compare_interrupt r_<Config_S12AD0>_compare_interruptA r_<Config_S12AD0>_compare_interruptB
<Config_S12AD0>.h
CRC Calculator
<Config_CRC>.c
R_<Config_CRC>_SetCRC8 R_<Config_CRC>_SetCRC16 R_<Config_CRC>_SetCCITT R_<Config_CRC>_SetCRC32 R_<Config_CRC>_SetCRC32C R_<Config_CRC>_Input_Data R_<Config_CRC>_Get_Result
<Config_CRC.h
D/A Converter
<Config_DA>.c
R_<Config_DA>_Create R_<Config_DA>n_Start R_<Config_DA>n_Stop R_<Config_DA>n_Set_ConversionValue R_<Config_DA>_Sync_Start R_<Config_DA>_Sync_Stop
<Config_DA>_user.c
R_<Config_DA>_Create_UserInit
<Config_DA>.h
Smart Configurator. 2. OUTPUT FILES
R20UT4360EJ0105 Rev.1.05 Page 10 of 533 Oct. 20, 2020
Table 2.4 Output File List (4/13)
Peripheral Function
File Name
API Function Name
Data Operation Circuit
<Config_DOC>.c
R_<Config_DOC>_Create R_<Config_DOC>_SetMode R_<Config_DOC>_WriteData R_<Config_DOC>_GetResult R_<Config_DOC>_ClearFlag
<Config_DOC>_user.c
R_<Config_DOC>_Create_UserInit r_<Config_DOC>_dopcf_interrupt r_<Config_DOC>_dopci_interrupt
<Config_DOC>.h
Data Transfer Controller
<Config_DTC>.c
R_<Config_DTC>_Create R_<Config_DTC>_Start R_<Config_DTC>_Stop
<Config_DTC>_user.c
R_<Config_DTC>_Create_UserInit
<Config_DTC>.h
Dead Time Compensaion Counter
<Config_MTU5>.c
R_<Config_MTU5>_Create R_<Config_MTU5>_Start R_<Config_MTU5>_Stop
<Config_MTU5>_user.c
R_<Config_MTU5>_Create_UserInit r_<Config_MTU5>_tgimn_interrupt
<Config_MTU5>.h
DMA Controller
<Config_DMAC0>.c
R_<Config_DMAC0>_Create R_<Config_DMAC0>_Start R_<Config_DMAC0>_Stop R_<Config_DMAC0>_Set_SoftwareTrigger R_<Config_DMAC0>_Clear_SoftwareTrigger
<Config_DMAC0>_user.c
R_<Config_DMAC0>_Create_UserInit r_<Config_DMAC0>_dmacni_interrupt r_dmacn_callback_transfer_end r_dmacn_callback_transfer_escape_end
<Config_DMAC0>.h
r_cg_dmac_user.c
r_dmac_dmac74i_interrupt r_dmacn_callback_transfer_end r_dmacn_callback_transfer_escape_end
r_cg_dmac.h
Event Link Controller
<Config_ELC>.c
R_<Config_ELC>_Create R_<Config_ELC>_Start R_<Config_ELC>_Stop R_<Config_ELC>_GenerateSoftwareEvent R_<Config_ELC>_Set_PortBuffern R_<Config_ELC>_Get_PortBuffern
<Config_ELC>_user.c
R_<Config_ELC>_Create_UserInit r_<Config_ELC>_elsrni_interrupt
<Config_ELC>.h
Smart Configurator. 2. OUTPUT FILES
R20UT4360EJ0105 Rev.1.05 Page 11 of 533 Oct. 20, 2020
Table 2.5 Output File List (5/13)
Peripheral Function
File Name
API Function Name
General PWM Timer
<Config_GPT0>.c
R_<Config_GPT0>_Create R_<Config_GPT0>_Start R_<Config_GPT0>_Stop R_<Config_GPT0>_HardwareStart R_<Config_GPT0>_HardwareStop R_<Config_GPT0>_ETGI_Start R_<Config_GPT0>_ETGI_Stop R_<Config_GPT0>_Software_Clear
<Config_GPT0>_user.c
R_<Config_GPT0>_Create_UserInit r_<Config_GPT0>_gtcimn_interrupt r_<Config_GPT0>_gtcivn_interrupt r_<Config_GPT0>_gtcinn_interrupt r_<Config_GPT0>_gdten_interrupt
<Config_GPT0>.h
r_cg_gpt_user.c
r_gpt_etgin_interrupt r_gpt_etgip_interrupt
r_cg_gpt.h
Group Scan Mode S12AD
<Config_S12AD0>.c
R_<Config_S12AD0>_Create R_<Config_S12AD0>_Start R_<Config_S12AD0>_Stop R_<Config_S12AD0>_Get_ValueResult R_<Config_S12AD0>_Set_CompareValue R_<Config_S12AD0>_Set_CompareAValue R_<Config_S12AD0>_Set_CompareBValue
<Config_S12AD0>_user.c
R_<Config_S12AD0>_Create_UserInit r_<Config_S12AD0>_interrupt r_<Config_S12AD0>_compare_interrupt r_<Config_S12AD0>_compare_interruptA r_<Config_S12AD0>_compare_interruptB r_<Config_S12AD0>_groupb_interrupt r_<Config_S12AD0>_groupc_interrupt
<Config_S12AD0>.h
Smart Configurator. 2. OUTPUT FILES
R20UT4360EJ0105 Rev.1.05 Page 12 of 533 Oct. 20, 2020
Table 2.6 Output File List (6/13)
Peripheral Function
File Name
API Function Name
I2C Master Mode
<Config_RIIC0>.c
R_<Config_RIIC0>_Create R_<Config_RIIC0>_Start R_<Config_RIIC0>_Stop R_<Config_RIIC0>_Master_Send R_<Config_RIIC0>_Master_Send_Without_Stop R_<Config_RIIC0>_Master_Receive R_<Config_RIIC0>_IIC_StartCondition R_<Config_RIIC0>_IIC_StopCondition
<Config_RIIC0>_user.c
R_<Config_RIIC0>_Create_UserInit r_<Config_RIIC0>_error_interrupt r_<Config_RIIC0>_receive_interrupt r_<Config_RIIC0>_transmit_interrupt r_<Config_RIIC0>_transmitend_interrupt r_<Config_RIIC0>_callback_receiveerror r_<Config_RIIC0>_callback_transmitend r_<Config_RIIC0>_callback_receiveend
<Config_RIIC0>.h
<Config_SCI0>.c
R_<Config_SCI0>_Create R_<Config_SCI0>_Start R_<Config_SCI0>_Stop R_<Config_SCI0>_IIC_Master_Send R_<Config_SCI0>_IIC_Master_Receive R_<Config_SCI0>_IIC_StartCondition R_<Config_SCI0>_IIC_StopCondition
<Config_SCI0>_user.c
R_<Config_SCI0>_Create_UserInit
r_<Config_SCI0>_receive_interrupt r_<Config_SCI0>_transmit_interrupt r_<Config_SCI0>_transmitend_interrupt r_<Config_SCI0>_callback_transmitend r_<Config_SCI0>_callback_receiveend
<Config_SCI0>.h
I2C Slave Mode
<Config_RIIC0>.c
R_<Config_RIIC0>_Create R_<Config_RIIC0>_Start R_<Config_RIIC0>_Stop R_<Config_RIIC0>_Slave_Send R_<Config_RIIC0>_Slave_Receive
<Config_RIIC0>_user.c
R_<Config_RIIC0>_Create_UserInit r_<Config_RIIC0>_error_interrupt r_<Config_RIIC0>_receive_interrupt r_<Config_RIIC0>_transmit_interrupt r_<Config_RIIC0>_transmitend_interrupt r_<Config_RIIC0>_callback_receiveerror r_<Config_RIIC0>_callback_transmitend r_<Config_RIIC0>_callback_receiveend
<Config_RIIC0>.h
Smart Configurator. 2. OUTPUT FILES
R20UT4360EJ0105 Rev.1.05 Page 13 of 533 Oct. 20, 2020
Table 2.7 Output File List (7/13)
Peripheral Function
File Name
API Function Name
Interrupt Controller
<Config_ICU>.c
R_<Config_ICU>_Create R_<Config_ICU>_IRQn_Start R_<Config_ICU>_IRQn_Stop R_<Config_ICU>_Software_Start R_<Config_ICU>_Software_Stop R_<Config_ICU>_SoftwareInterrupt_Generate R_<Config_ICU>_Software2_Start R_<Config_ICU>_Software2_Stop R_<Config_ICU>_SoftwareInterrupt2_Generate
<Config_ICU>_user.c
R_<Config_ICU>_Create_UserInit r_<Config_ICU>_irqn_interrupt r_<Config_ICU>_software_interrupt r_<Config_ICU>_software2_interrupt r_<Config_ICU>_nmi_interrupt
<Config_ICU>.h
Low Power Consumption
<Config_LPC>.c
R_<Config_LPC>_Create R_<Config_LPC>_AllModuleClockStop R_<Config_LPC>_Sleep R_<Config_LPC>_DeepSleep R_<Config_LPC>_SoftwareStandby R_<Config_LPC>_DeepSoftwareStandby R_<Config_LPC>_ChangeOperatingPowerControl R_<Config_LPC>_ChangeSleepModeReturnClock R_<Config_LPC>_SetVOLSR_PGAVLS
<Config_LPC>_user.c
R_<Config_LPC>_Create_UserInit
<Config_LPC>.h
Low Power Timer
<Config_LPT>.c
R_<Config_LPT>_Create R_<Config_LPT>_Start R_<Config_LPT>_Stop
<Config_LPT>_user.c
R_<Config_LPT>_Create_UserInit
<Config_LPT>.h
Normal Mode Timer
<Config_MTU0>.c
R_<Config_MTU0>_Create R_<Config_MTU0>_Start R_<Config_MTU0>_Stop
<Config_MTU0>_user.c
R_<Config_MTU0>_Create_UserInit r_<Config_MTU0>_tgimn_interrupt r_<Config_MTU0>_tginm_interrupt r_<Config_MTU0>_tcivn_interrupt r_<Config_MTU0>_tcinv_interrupt
<Config_MTU0>.h
Smart Configurator. 2. OUTPUT FILES
R20UT4360EJ0105 Rev.1.05 Page 14 of 533 Oct. 20, 2020
Table 2.8 Output File List (8/13)
Peripheral Function
File Name
API Function Name
Phase Counting Mode Timer
<Config_MTU1>.c
R_<Config_MTU1>_Create R_<Config_MTU1>_Start R_<Config_MTU1>_Stop
<Config_MTU1>_user.c
R_<Config_MTU1>_Create_UserInit r_<Config_MTU1>_tgimn_interrupt r_<Config_MTU1>_tginm_interrupt r_<Config_MTU1>_tcivn_interrupt r_<Config_MTU1>_tcinv_interrupt r_<Config_MTU1>_tciun_interrupt r_<Config_MTU1>_tcinu_interrupt
<Config_MTU1>.h
Port Output Enable
<Config_POE>.c
R_<Config_POE>_Create R_<Config_POE>_Start R_<Config_POE>_Stop R_<Config_POE>_Set_HiZ_MTUn R_<Config_POE>_Clear_HiZ_MTUn R_<Config_POE>_Set_HiZ_GPTn R_<Config_POE>_Clear_HiZ_GPTn
<Config_POE>_user.c
R_<Config_POE>_Create_UserInit r_<Config_POE>_oein_interrupt
<Config_POE>.h
I/O Port
<Config_PORT>.c
R_<Config_PORT>_Create
<Config_PORT>_user.c
R_<Config_PORT>_Create_UserInit
<Config_PORT>.h
Programmable Pulse Generator
<Config_PPG0>.c
R_<Config_PPG0>_Create
<Config_PPG0>_user.c
R_<Config_PPG0>_Create_UserInit
<Config_PPG0>.h
PWM Mode Timer
<Config_MTU0>.c
R_<Config_MTU0>_Create R_<Config_MTU0>_Start R_<Config_MTU0>_Stop
<Config_MTU0>_user.c
R_<Config_MTU0>_Create_UserInit r_<Config_MTU0>_tgimn_interrupt r_<Config_MTU0>_tginm_interrupt r_<Config_MTU0>_tcivn_interrupt r_<Config_MTU0>_tcinv_interrupt
<Config_MTU0>.h
Smart Configurator. 2. OUTPUT FILES
R20UT4360EJ0105 Rev.1.05 Page 15 of 533 Oct. 20, 2020
Table 2.9 Output File List (9/13)
Peripheral Function
File Name
API Function Name
Realtime Clock
<Config_RTC>.c
R_<Config_RTC>_Create R_<Config_RTC>_Start R_<Config_RTC>_Stop R_<Config_RTC>_Restart R_<Config_RTC>_Restart_BinaryCounter R_<Config_RTC>_Set_CalendarCounterValue R_<Config_RTC>_Get_CalendarCounterValue R_<Config_RTC>_Get_CalendarTimeCaptureValuen R_<Config_RTC>_Set_BinaryCounterValue R_<Config_RTC>_Get_BinaryCounterValue R_<Config_RTC>_Get_BinaryTimeCaptureValuen R_<Config_RTC>_Set_RTCOUTOn R_<Config_RTC>_Set_RTCOUTOff R_<Config_RTC>_Set_CalendarAlarm R_<Config_RTC>_Set_BinaryAlarm R_<Config_RTC>_Set_ConstPeriodInterruptOn R_<Config_RTC>_Set_ConstPeriodInterruptOff R_<Config_RTC>_Set_CarryInterruptOn R_<Config_RTC>_Set_CarryInterruptOff
<Config_RTC>_user.c
R_<Config_RTC>_Create_UserInit r_<Config_RTC>_alm_interrupt r_<Config_RTC>_prd_interrupt r_<Config_RTC>_cup_interrupt
<Config_RTC>.h
Remote Control Signal Receiver
<Config_REMC0>.c
R_<Config_REMC0>_Create R_<Config_REMC0>_Start R_<Config_REMC0>_Stop R_<Config_REMC0>_Read
<Config_REMC0>_user.c
R_<Config_REMC0>_Create_UserInit r_<Config_REMC0>_remcin_interrupt r_<Config_REMC0>_callback_comparematch r_<Config_REMC0>_callback_receiveerror r_<Config_REMC0>_callback_receiveend r_<Config_REMC0>_callback_bufferfull r_<Config_REMC0>_callback_header r_<Config_REMC0>_callback_data0 r_<Config_REMC0>_callback_data1 r_<Config_REMC0>_callback_specialdata
<Config_REMC0>.h
Smart Configurator. 2. OUTPUT FILES
R20UT4360EJ0105 Rev.1.05 Page 16 of 533 Oct. 20, 2020
Table 2.10 Output File List (10/13)
Peripheral Function
File Name
API Function Name
SCI/SCIF Asynchronous
Mode
<Config_SCI0>.c
R_<Config_SCI0>_Create R_<Config_SCI0>_Start R_<Config_SCI0>_Stop R_<Config_SCI0>_Serial_Send R_<Config_SCI0>_Serial_Receive R_<Config_SCI0>_Serial_Multiprocessor_Send R_<Config_SCI0>_Serial_Multiprocessor_Receive
<Config_SCI0>_user.c
R_<Config_SCI0>_Create_UserInit r_<Config_SCI0>_transmitend_interrupt r_<Config_SCI0>_transmit_interrupt r_<Config_SCI0>_receive_interrupt r_<Config_SCI0>_receiveerror_interrupt r_<Config_SCI0>_teif_interrupt r_<Config_SCI0>_txif_interrupt r_<Config_SCI0>_rxif_interrupt r_<Config_SCI0>_drif_interrupt r_<Config_SCI0>_erif_interrupt r_<Config_SCI0>_brif_interrupt r_<Config_SCI0>_callback_transmitend r_<Config_SCI0>_callback_receiveend r_<Config_SCI0>_callback_receiveerror r_<Config_SCI0>_callback_error
<Config_SCI0>.h
SCI/SCIF Clock Synchronous Mode
<Config_SCI0>.c
R_<Config_SCI0>_Create R_<Config_SCI0>_Start R_<Config_SCI0>_Stop R_<Config_SCI0>_Serial_Send R_<Config_SCI0>_Serial_Receive R_<Config_SCI0>_Serial_Send_Receive
<Config_SCI0>_user.c
R_<Config_SCI0>_Create_UserInit r_<Config_SCI0>_transmitend_interrupt r_<Config_SCI0>_transmit_interrupt r_<Config_SCI0>_receive_interrupt r_<Config_SCI0>_receiveerror_interrupt r_<Config_SCI0>_teif_interrupt r_<Config_SCI0>_txif_interrupt r_<Config_SCI0>_rxif_interrupt r_<Config_SCI0>_erif_interrupt r_<Config_SCI0>_brif_interrupt r_<Config_SCI0>_callback_transmitend r_<Config_SCI0>_callback_receiveend r_<Config_SCI0>_callback_receiveerror r_<Config_SCI0>_callback_error
<Config_SCI0>.h
Smart Configurator. 2. OUTPUT FILES
R20UT4360EJ0105 Rev.1.05 Page 17 of 533 Oct. 20, 2020
Table 2.11 Output File List (11/13)
Peripheral Function
File Name
API Function Name
Single Scan Mode S12AD
<Config_S12AD0>.c
R_<Config_S12AD0>_Create R_<Config_S12AD0>_Start R_<Config_S12AD0>_Stop R_<Config_S12AD0>_Get_ValueResult R_<Config_S12AD0>_Set_CompareValue R_<Config_S12AD0>_Set_CompareAValue R_<Config_S12AD0>_Set_CompareBValue
<Config_S12AD0>_user.c
R_<Config_S12AD0>_Create_UserInit r_<Config_S12AD0>_interrupt r_<Config_S12AD0>_compare_interrupt r_<Config_S12AD0>_compare_interruptA r_<Config_S12AD0>_compare_interruptB
<Config_S12AD0>.h
Smart Card Interface Mode
<Config_SCI0>.c
R_<Config_SCI0>_Create R_<Config_SCI0>_Start R_<Config_SCI0>_Stop R_<Config_SCI0>_SmartCard_Send R_<Config_SCI0>_SmartCard_Receive
<Config_SCI0>_user.c
R_<Config_SCI0>_Create_UserInit r_<Config_SCI0>_transmit_interrupt r_<Config_SCI0>_receive_interrupt r_<Config_SCI0>_receiveerror_interrupt r_<Config_SCI0>_callback_transmitend r_<Config_SCI0>_callback_receiveend r_<Config_SCI0>_callback_receiveerror
<Config_SCI0>.h
SPI Clock Synchronous Mode
<Config_RSPI0>.c
R_<Config_RSPI0>_Create R_<Config_RSPI0>_Start R_<Config_RSPI0>_Stop R_<Config_RSPI0>_Send R_<Config_RSPI0>_Send_Receive R_<Config_RSPI0>_SPI_Master_Send R_<Config_RSPI0>_SPI_Master_Send_Receive R_<Config_RSPI0>_SPI_Slave_Send R_<Config_RSPI0>_SPI_Slave_Send_Receive
<Config_RSPI0>_user.c
R_<Config_RSPI0>_Create_UserInit r_<Config_RSPI0>_receive_interrupt r_<Config_RSPI0>_transmit_interrupt r_<Config_RSPI0>_error_interrupt r_<Config_RSPI0>_idle_interrupt r_<Config_RSPI0>_transmitend_interrupt r_<Config_RSPI0>_receiveerror_interrupt r_<Config_RSPI0>_callback_receiveend r_<Config_RSPI0>_callback_transmitend r_<Config_RSPI0>_callback_error
<Config_RSPI0>.h
Smart Configurator. 2. OUTPUT FILES
R20UT4360EJ0105 Rev.1.05 Page 18 of 533 Oct. 20, 2020
Table 2.12 Output File List (12/13)
Peripheral Function
File Name
API Function Name
SPI Operation Mode
<Config_RSPI0>.c
R_<Config_RSPI0>_Create R_<Config_RSPI0>_Start R_<Config_RSPI0>_Stop R_<Config_RSPI0>_Send R_<Config_RSPI0>_Send_Receive
<Config_RSPI0>_user.c
R_<Config_RSPI0>_Create_UserInit r_<Config_RSPI0>_receive_interrupt r_<Config_RSPI0>_transmit_interrupt r_<Config_RSPI0>_error_interrupt r_<Config_RSPI0>_idle_interrupt r_<Config_RSPI0>_callback_receiveend r_<Config_RSPI0>_callback_transmitend r_<Config_RSPI0>_callback_error
<Config_RSPI0>.h
Voltage Detection Circuit
<Config_LVD1>.c
R_<Config_LVD1>_Create R_<Config_LVD1>_Start R_<Config_LVD1>_Stop
<Config_LVD1>_user.c
R_<Config_LVD1>_Create_UserInit r_<Config_LVD1>_lvdn_interrupt
<Config_LVD1>.h
Watchdog Timer
<Config_WDT>.c
R_<Config_WDT>_Create R_<Config_WDT>_Restart
<Config_WDT>_user.c
R_<Config_WDT>_Create_UserInit r_<Config_WDT>_wuni_interrupt r_<Config_WDT>_iwuni_interrupt r_<Config_WDT>_nmi_interrupt
<Config_WDT>.h
Continuous Scan
Mode DSAD
<Config_DSAD0>.c
R_<Ccnfig_DSAD0>_Create R_<Config_DSAD0>_Start R_<Config_DSAD0>_Stop R_<Config_DSAD0>_Set_SoftwareTrigger R_<Config_DSAD0>_Get_ValueResult
<Config_DSAD0>_user.c
R_<Config_DSAD0>_Create_UserInit
r_<Config_DSAD0>_adin_interrupt r_<Config_DSAD0>_scanendn_interrupt
<Config_DSAD0>.h
-
Single Scan Mode
DSAD
<Config_DSAD0>.c
R_<Ccnfig_DSAD0>_Create
R_<Config_DSAD0>_Start
R_<Config_DSAD0>_Stop
R_<Config_DSAD0>_Set_SoftwareTrigger
R_<Config_DSAD0>_Get_ValueResult
<Config_DSAD0>_user.c
R_<Config_DSAD0>_Create_UserInit
r_<Config_DSAD0>_adin_interrupt r_<Config_DSAD0>_scanendn_interrupt
<Config_DSAD0>.h
-
Smart Configurator. 2. OUTPUT FILES
R20UT4360EJ0105 Rev.1.05 Page 19 of 533 Oct. 20, 2020
Table 2.13 Output File List (13/13)
Peripheral Function
File Name
API Function Name
Delta-Sigma
Modulator Interface
<Config_DSMIF0>.c
R_<Config_DSMIF0>_Create
R_<Config_DSMIF0>_Start
R_<Config_DSMIF0>_Stop
<Config_DSMIF0>_user.c
R_<Config_DSMIF0>_Create_UserInit
r_<Config_DSMIF0>_ocdin_interrupt
r_<Config_DSMIF0>_scdin_interrupt
r_<Config_DSMIF0>_sumein_interrupt
<Config_DSMIF0>.h
Analog Front End
<Config_AFE>.c
R_<Config_AFE>_Create
<Config>AFE>_user.c
R_<Config_AFE>_Create_UserInit
<Config_AFE>.h
Motor (Complementary
PWM Mode Timer,
Single Scan Mode S12AD)
<Config_MTU3_MTU4>.c
R_<Config_MTU3_MTU4>_Create
R_<Config_MTU3_MTU4>_StartTimerCount
R_<Config_MTU3_MTU4>_StopTimerCount
R_<Config_MTU3_MTU4>_StartTimerCtrl
R_<Config_MTU3_MTU4>_StopTimerCtrl
R_<Config_MTU3_MTU4>_UpdDuty
R_<Config_MTU3_MTU4>_StartAD
R_<Config_MTU3_MTU4>_StopAD
R_<Config_MTU3_MTU4>_AdcGetConvVal
<Config_MTU3_MTU4>_user.c
R_<Config_MTU3_MTU4>_Create_UserInit
r_<Config_MTU3_MTU4>_CrestInterrupt
r_<Config_MTU3_MTU4>_ad_interrupt
<Config_MTU3_MTU4>.h

Smart Configurator. 3. INITIALIZATION

R20UT4360EJ0105 Rev.1.05 Page 20 of 533 Oct. 20, 2020
3.
INITIALIZATION
This chapter describes the flow of initialization by the API functions of the Code Generator.
PowerOn_Reset_PC
Sets interrupt table resister
Sets exception table resister
Sets single-precision floating-point status word
mcu_clock_setup
Initializes system clock
Initializes CLKOUT pin output
User’s pre process when worm start
Initializes C runtime environment
bsp_maapped_interrupt_open
Initializes mapped interrupt
bsp_ram_initialize
Initializes RAM
hardware_setup
Configures the ROM cache function
Configures the port and pin direction
Configures interrupts used
bsp_register_protect_open
Initializes variables needed for register
protection unctionality
bsp_interrupt_open
Initializes callback function array
init_iolib
Initializes C library
R_Systeminit
Initializes peripheral functions
bsp_non_existent_port_init Initializes non existent pins
bsp_adc_initial_configure
Configures the ADC initial settings
bsp_bsc_initial_configure
Configures the BUS initial settings
Sets processor status word
Enable the bus error interruopt
Main function
Process of blue box is FIT board support
package module.
Please refer to the application note (R01AN1685) for details.

Smart Configurator. 4. API FUNCTIONS

R20UT4360EJ0105 Rev.1.05 Page 21 of 533 Oct. 20, 2020
4.
API FUNCTIONS
This chapter describes the API functions output that are output by the Code Generator.

4.1 Overview

The following are the naming conventions for the API functions output by the Code Generator.
- Macro names These are in all-capital letters.
Note that if a name includes a number as a prefix, the relevant number is equal to the hexadecimal
value of the macro.
- Local variable names These are in low-case letters only.
- Global variable names
These are prefixed with “g”, and only the first letters of words that are elements of the names are
capitals.
- Names of pointers to global variables
These are prefixed with “gp”, and only the first letters of words that are elements of the names are
capitals.
- Names of elements in enumeration specifiers “enum” These are in all-capital letters.
Remarks In the generated code by the smart configurator, the for statement, the while statement,
the do-while statement (loop processing) are used in register setting reflected waiting process etc. If fail-safe processing for infinite loop is required, check the generated code and add processing.
Smart Configurator. 4. API FUNCTIONS
R20UT4360EJ0105 Rev.1.05 Page 22 of 533 Oct. 20, 2020

4.2 Function Reference

This section describes the API functions output by the Code Generator, using the following notation format.
Figure 4.1 Notation Format of API Functions
(1) Name
Indicates the name of the API function.
(2) Outline
Outlines the functions of the API function
(3) [Syntax]
Indicates the format to be used when describing an API function to be called in C language.
(4) [Argument(s)]
API function arguments are explained in the following format.
I/O
Argument
Descripton
(a)
(b)
(c)
(a) I/O Argument classification I Input argument O Output argument (b) Argument Argument data type (c) Description Description of argument
Smart Configurator. 4. API FUNCTIONS
R20UT4360EJ0105 Rev.1.05 Page 23 of 533 Oct. 20, 2020
(5) [Return value]
API function return value is explained in the following format.
Macro
Description
(a)
(b)
(a) Macro Macro of return value (b) Description Description of return value
Smart Configurator. 4. API FUNCTIONS
R20UT4360EJ0105 Rev.1.05 Page 24 of 533 Oct. 20, 2020

4.2.1 Common

The Code Generator outputs the following API functions that are for common use by all peripheral
modules.
Table 4.1 Common API Functions
API Function Name
Description
r_undefined_exception
Executes processing in response to undefined instruction exceptions.
PowerON_Reset
Executes processing in response to a reset having been applied.
hardware_setup
Executes initialization processing that is required before controlling various hardware facilities.
R_Systeminit
Executes initialization processing that is required before controlling various peripheral modules.
R_CGC_Create
Executes initialization processing that is required before controlling the clock generation circuit.
R_CGC_Create_UserInit
Executes user-specific initialization processing for the clock generation circuit.
R_Interrupt_Create
Applies the settings for group interrupts and fast interrupts that were specified on the [Interrupts] tabbed page.
R_Pins_Create
Applies the settings for the multi-function pin controller that were specified on the [Pins] tabbed page.
main
main function.
Smart Configurator. 4. API FUNCTIONS
R20UT4360EJ0105 Rev.1.05 Page 25 of 533 Oct. 20, 2020
r_undefined_exception
This API function executes processing in response to undefined instruction exceptions.
Remark: This API function is called as the interrupt handler for undefined instruction exceptions, which
occur when the attempted execution of an undefined instruction (an instruction that is not implemented) is detected.
[Syntax]
void r_undefined_exception ( void );
[Argument(s)]
None.
[Return value]
None.
Smart Configurator. 4. API FUNCTIONS
R20UT4360EJ0105 Rev.1.05 Page 26 of 533 Oct. 20, 2020
PowerON_Reset
This API function executes processing in response to a reset having been applied. Remark: This API function is called as the interrupt handler for internal resets generated by the
power-on reset circuit.
[Syntax]
void PowerON_Reset ( void );
[Argument(s)]
None.
[Return value]
None.
Smart Configurator. 4. API FUNCTIONS
R20UT4360EJ0105 Rev.1.05 Page 27 of 533 Oct. 20, 2020
hardware_setup
This API function executes initialization processing that is required before controlling various hardware
facilities.
Remark: This API function is called from PowerON_Reset as a callback routine.
[Syntax]
void hardware_setup ( void );
[Argument(s)]
None.
[Return value]
None.
Smart Configurator. 4. API FUNCTIONS
R20UT4360EJ0105 Rev.1.05 Page 28 of 533 Oct. 20, 2020
R_Systeminit
This API function executes initialization processing that is required before controlling various peripheral
modules.
Remark: This API function is called from hardware_setup as a callback routine.
[Syntax]
void R_Systeminit ( void );
[Argument(s)]
None.
[Return value]
None.
Smart Configurator. 4. API FUNCTIONS
R20UT4360EJ0105 Rev.1.05 Page 29 of 533 Oct. 20, 2020
R_CGC_Create
This API function executes initialization processing that is required before controlling the clock
generation circuit.
Remark: This API function is called from R_Systeminit before the main() function is executed.
[Syntax]
void R_CGC_Create ( void );
[Argument(s)]
None.
[Return value]
None.
Smart Configurator. 4. API FUNCTIONS
R20UT4360EJ0105 Rev.1.05 Page 30 of 533 Oct. 20, 2020
R_CGC_Create_UserInit
This API function executes user-specific initialization processing for the clock generation circuit. Remark: This API function is called from R_CGC_Create as a callback routine.
[Syntax]
void R_CGC_Create_UserInit ( void );
[Argument(s)]
None.
[Return value]
None.
Smart Configurator. 4. API FUNCTIONS
R20UT4360EJ0105 Rev.1.05 Page 31 of 533 Oct. 20, 2020
R_Interrupt_Create
This API function makes settings for group interrupts and fast interrupts. Remark: This API function is called fromR_Systeminit before the main() function is executed.
[Syntax]
void R_Interrupt_Create ( void );
[Argument(s)]
None.
[Return value]
None.
Loading...
+ 514 hidden pages