Renesas RA2A1 Application Note

Application Note
R01AN5795EJ0100 Rev.1.00 Page 1 of 24 Mar.31.21
RA2A1 Group
Introduction
The control program operates on RA2A1 on the EK-RA2A1 evaluation board, communicates commands with the AFE development support tool ‘QE for AFE’, and can set registers for analog IP and obtain the A/D conversion values as shown below.
24-Bit Sigma-Delta A/D Converter (SDADC24) 16-Bit A/D Converter (ADC16) 12-Bit D/A Converter (DAC12) 8-Bit D/A Converter (DAC8) Operational Amplifier (OPAMP)
Target Device
RA2A1 (R7FA2A1AB3CFM)
Board to Be Operated
EK-RA2A1 Evaluation Kit for RA2A1 Microcontroller Group Available Communication I/F:
USB PCDC Communication SCI UART Communication: A separate USB-UART adapter is required.
RA2A1 Group Board Control Program for QE for AFE
R01AN5795EJ0100 Rev.1.00 Page 2 of 24 Mar.31.21
Contents
1. Overview ................................................................................................................................. 3
1.1 System Overview ..................................................................................................................................... 3
1.2 Operation Confirmation Environment ...................................................................................................... 4
1.3 File Configurations................................................................................................................................... 5
1.4 Peripherals to Use ................................................................................................................................... 6
1.5 Pin Settings ............................................................................................................................................. 7
1.5.1 Pin List ................................................................................................................................................... 7
1.5.2 ADC16 Precautions When Using .......................................................................................................... 8
1.5.3 How LED1 Work .................................................................................................................................... 8
1.6 Communication Specifications ................................................................................................................ 9
1.6.1 Serial Communication Settings ............................................................................................................. 9
1.6.2 Connecting USB-UART adapter during UART communication ............................................................ 9
1.7 About Project Source Changes ............................................................................................................... 9
1.8 Related Documentation ........................................................................................................................... 9
2. How to Write FW ................................................................................................................... 10
2.1 Write Using e2 studio Integrated Development Environment (IDE) ...................................................... 10
2.1.1 Import Procedure ................................................................................................................................. 10
2.1.2 Notes on Building Project for USB PCDC Communication ................................................................. 10
2.1.3 Notes on Building Project for SCI UART Communication ................................................................... 11
2.2 Writing using Renesas Flash Programmer ........................................................................................... 12
3. Run Project ............................................................................................................................ 15
3.1 Connecting to PC .................................................................................................................................. 15
3.1.1 USB PCDC Communication ................................................................................................................ 15
3.1.2 USB PCDC Communication ................................................................................................................ 15
3.2 Launch QE for AFE ............................................................................................................................... 16
3.2.1 Preparation .......................................................................................................................................... 16
3.2.2 Launching QE for AFE and Connecting to Target Board .................................................................... 16
3.2.3 Operation Confirmation ....................................................................................................................... 16
3.3 Sample Configuration File ..................................................................................................................... 17
3.3.1 Configuration Overview of Sample Configuration File ........................................................................ 18
3.3.2 Setting Procedure after Import ............................................................................................................ 19
3.3.2.1 Project for USB PCDC Communication ............................................................................................ 19
3.3.2.2 Project for SCI UART Communication .............................................................................................. 20
3.4 QE for AFE Tuning Execution ............................................................................................................... 21
3.4.1 Writing Setting Value ........................................................................................................................... 21
3.4.2 Tuning Operation ................................................................................................................................. 22
Revision History ............................................................................................................................ 24
RA2A1 Group Board Control Program for QE for AFE
R01AN5795EJ0100 Rev.1.00 Page 3 of 24 Mar.31.21

1. Overview

1.1 System Overview

This control program (hereinafter abbreviated as ‘FW’) operates on RA2A1 on the EK-RA2A1 board. You can communicate using ‘QE for AFE’ via USB PCDC or SCI UART and control the following according
to the command request from QE for AFE:
Register Settings for 24-Bit Sigma-Delta A/D Converter (SDADC24) Register Settings for 16-Bit A/D Converter (ADC16) Register Settings for 12-Bit D/A Converter (DAC12) Register Settings for 8-Bit D/A Converter (DAC8) Operation Amplifier (OPAMP) Register Settings Start/Stop 24-Bit Sigma-Delta A/D Conversion or 16-Bit A/D Conversion and send their A/D value
Figure 1-1 Connection Example for USB PCDC Communication
Figure 1-2 Connection Example for SCI UART Communication
QE for AFE
DEBUG
USB
UART
-USB
QE for AFE
DEBUG
USB
RA2A1 Group Board Control Program for QE for AFE
R01AN5795EJ0100 Rev.1.00 Page 4 of 24 Mar.31.21

1.2 Operation Confirmation Environment

This FW is checked under the operating conditions shown in Table 1-1.
Table 1-1 Operating Confirmation Conditions
Items
Descriptions
MCU (When using USB PCDC)
Clock-related Registers SCKDIVCR = 0x10000101 SCKSCR = 0x00 (HOCO) SDADCCKCR = 0x81
R7FA2A1AB3CFM (Renesas RA2A1 MCU Group) Supply voltage: 3.3V HOCO :48MHz ICLK: 24MHz PCLKB: 24MHz PCLKD: 24MHz (used for ADC16) FCLK: 24MHz SDADCCLK: HOCO 48MHz UCLK: 48MHz
MCU (When using SCI UART)
Clock-related Registers SCKDIVCR = 0x11000101 SCKSCR = 0x00 (HOCO) SDADCCKCR = 0x81
R7FA2A1AB3CFM (Renesas RA2A1 MCU Group) Supply voltage: 3.3V HOCO: 64MHz ICLK: 32MHz PCLKB: 32MHz PCLKD: 32MHz (used for ADC16) FCLK: 32MHz SDADCCLK: HOCO 64MHz
IDE
Renesas e2 studio V2021-01 (21.1.0)
FSP
Use v1.20 (not included in the IDE above)
Tool Chain
GNU ARM Embedded 9.2.1.20191025
Emulator
SEGGER J-Link®
USB-UART Adapter
PmodTM USBUART
RA2A1 Group Board Control Program for QE for AFE
R01AN5795EJ0100 Rev.1.00 Page 5 of 24 Mar.31.21

1.3 File Configurations

The following is a list of file configurations. The description of some folders and files is omitted.
r01an5795xx0100-ra2a1-serial
├─ek_ra2a1 │ ├─QE_for_AFE_uart e2 studio project for QE_for_AFE_uart (SCI UART Communication) │ │ ├─.settings │ │ ├─ra │ │ ├─ra_cfg │ │ ├─ra_gen │ │ ├─script │ │ └─src │ │ ├─hal_entry.c │ │ ├─hal_entry.h │ │ ├─r_common_config.h │ │ ├─r_common_func.c │ │ ├─r_common_func_if.h │ │ ├─r_communication_control_api.c │ │ ├─r_communication_control_api_if.h │ │ ├─r_interrupt_callback.c │ │ ├─r_interrupt_callback_if.h │ │ ├─r_reg_chk.c │ │ ├─r_reg_chk_if.h │ │ ├─r_ring_buffer_control_api.c │ │ ├─r_ring_buffer_control_api_if.h │ │ └─r_usb_pcdc_descriptor.c │ └─QE_for_AFE_usb e2 studio project for QE_for_AFE_uart (USB PCDC Communication) │ ├─.settings │ ├─ra │ ├─ra_cfg │ ├─ra_gen │ ├─script │ └─src │ ├─hal_entry.c │ ├─hal_entry.h │ ├─r_common_config.h │ ├─r_common_func.c │ ├─r_common_func_if.h │ ├─r_communication_control_api.c │ ├─r_communication_control_api_if.h │ ├─r_interrupt_callback.c │ ├─r_interrupt_callback_if.h │ ├─r_reg_chk.c │ ├─r_reg_chk_if.h │ ├─r_ring_buffer_control_api.c │ ├─r_ring_buffer_control_api_if.h │ └─r_usb_pcdc_descriptor.c ├─Hex │ ├─QE_for_AFE_uart.hex Hex file for USB PCDC Communication (QE_for_AFE_uart) │ └─QE_for_AFE_usb.hex Hex file for SCI UART Communication (QE_for_AFE_usb) ├─qe4qfe_setting │ └─qe4afe_sample.2a1 Samle congiguration file for QE_for_AFE ├─r01an5795ej0100-ra2a1-serial.pdf └─r01an5795jj0100-ra2a1-serial.pdf
Figure 1-3 File Configurations
RA2A1 Group Board Control Program for QE for AFE
R01AN5795EJ0100 Rev.1.00 Page 6 of 24 Mar.31.21

1.4 Peripherals to Use

The following shows the list of peripherals used in this FW, and the settings for each peripheral function are shown below.
Table 1-2 Peripheral Features List
Project
Intended Use
SDADC24
A/D measurement
ADC16
A/D measurement
DAC12
D/A output (output function from pin is not supported)
DAC8
D/A output (output function from pins is not supported)
OPAMP
Amplification of analog input voltage
USB FS [Note 1]
Communication: Used of PCDC
SCI0 [Note 1]
Communication: Used of UART communication: Use the PMOD B connector
DTC
Used for SCI0 UART communication
AGT0/1
Reservations (currently unused)
Note 1: Select either USB PCDC or SCI0 UART as communication I/F.
RA2A1 Group Board Control Program for QE for AFE
R01AN5795EJ0100 Rev.1.00 Page 7 of 24 Mar.31.21

1.5 Pin Settings

1.5.1 Pin List

The following is a list of pins used in this FW.
Table 1-3 Pins used List
No
Pin
Configuration Function
Content
1
P400
CMPIN0
Used as an analog pin [Note 2]
2
P401
P401
RTS Pin Assignment for SCI0 UART (L Fixed)
3
P402
P402
- 4 P403
P403
- 5 VCL
VCL
- 6 P215
XCIN
- 7 P214
XCOUT
- 8 VSS
VSS
- 9 P213
XTAL
-
10
P212
EXTAL
-
11
VCC
XCOUT
-
12
P411
P411
TXD0 pin for SCI0 UART
13
P410
P410
14
P409
P409
-
15
P408
CMPIN1
Used as an analog pin [Note 2]
16
P407
USB_VBUS
USB FS VBUS
17
VSS_USB
VSS_USB
-
18
P915
USB_DM
D- I/O pin for on-chip USB transceiver
19
P914
USB_DP
D+ I/O pin for on-chip USB transceiver
20
VCC_USB
VCC_USB
-
21
VCC_USB_LDO
VCC_USB_LDO
-
22
P206
P206
-
23
P205
P205
For LED1 control
24
P204
P204
RXD0 pin for SCI0 UART
25
Nothing
Nothing
-
26
P201
MD - 27
P200
P200
-
28
P304
P304
-
29
P303
P303
-
30
P302
P302
-
31
P301
P301
-
32
P300
SWCLK
-
33
P108
SWDIO
-
34
P110
CMPREF1
Reference voltage input pin [Note 2]
35
P111
P111
-
36
P112
P112
-
37
ADREG
ADREG
-
38
SBIAS/VREFI
SBIAS/VREF1
-
39
AVCC1
AVCC1
-
40
AVSS1
AVSS1
-
41
P107
ANSD3N/AN023
Used as an analog pin
42
P106
ANDS3P/AN022
Used as an analog pin
43
P105
ANSD2N/AN021
Used as an analog pin
44
P104
ANDS2P/AN020
Used as an analog pin
RA2A1 Group Board Control Program for QE for AFE
R01AN5795EJ0100 Rev.1.00 Page 8 of 24 Mar.31.21
45
P103
ANSD1N/AN019
Used as an analog pin
46
P102
ANDS1P/AN018
Used as an analog pin
47
P101
ANSD0N/AN017/IVREF2
Used as an analog pin
48
P100
ANDS0P/AN016/IVCMP2
Used as an analog pin
49
P500
AN000/IVCMP0/AMP0+/DA12_0
Used as an analog pin [Note 1]
50
P501
AN001/IVREF0/AMP0-
Used as an analog pin
51
P502
AN002/AMP0O
Used as an analog pin
52
P015
AN003/AMP1O
Used as an analog pin
53
P014
AN004/IVREF1/AMP1-
Used as an analog pin
54
P013
AN005/IVCMP1/AMP1+/DA8_0
Used as an analog pin [Note 1]
55
P012
AN008/AMP2O
Used as an analog pin
56
AVCC0
AVCC0
-
57
AVSS0
AVSS0
58
VREFL0
VREFL0
ADC16 reference power supply (Low potential reference voltage)
59
VREFH0
VREFH0
ADC16 reference power supply (High potential reference voltage)
60
P003
AN006/AMP2-
Used as an analog pin
61
P002
AN007/AMP2+/DA8_1
Used as an analog pin [Note 1]
62
P001
P001
-
63
P000
P000
-
64
P109
CMPREF0
Reference voltage input pin [Note 2]
Note 1: It cannot be used as a D/A output pin. Note 2: It is for ACMPHS/ACMPLP and cannot be used.

1.5.2 ADC16 Precautions When Using

The reference power supply pin (VREFH0) or internal reference voltage for the ADC16 (VREFADC) is selectable as the high potential reference voltage. The low potential reference voltage is the reference power supply ground pin (VRVEFL0).
On the EK-RA2A1 board, the VREFH0 and VREFL0 are open. Therefore, the VREFL0 must be set when using ADC16.
When connecting to AVSS0, connect to J2 34 pin (VREFL0) and J2 36 pin (AVSS0) on EK-RA2A1 board.
Because they are pins next to each other, it can be easily connected using a jumper as shown below.
Figure 1-4 Connecting J2 34-pin (VREFL0) and J2 36-pin (AVSS0) on Board Using ADC16

1.5.3 How LED1 Work

The LED1 on the EK-RA2A1 board lights up during A/D conversion operation on the SDADC24 or ADC16. By opening the copper jumper E3 on the EK-RA2A1 board, LED lighting can be suppressed. For more
information, refer to 5.4.4 LEDsin the EK-RA2A1 v1 User Manual (R20UT4580EU0101).
Loading...
+ 18 hidden pages