Baud Rate Configuration for SCI3 and RLIN3 Communication Modules
R2026bThis topic describes how baud rate is configured for the SCI3 and RLIN3 communication modules used by the Complex Device Driver (CDD) on Renesas RH850 microcontrollers. Baud rate configuration affects UART communication used for external mode and other serial communication workflows.
The current CDD for U2A and U2B devices supports configuration of:
SCI130
RLIN3
Use this topic to understand:
which peripheral is available on your target device
how baud rate is calculated for SCI3 and RLIN3
where the baud rate settings are defined in the generated CDD code
Use this information to understand which peripheral is available on your target device and how the configured register values determine the communication baud rate.
Serial Communication Peripheral Availability
RLIN3 is the peripheral used for UART communication on U2B devices and U2A6 device series.
SCI3 is available only on U2A16 and U2A8 device series.
| Peripheral | U2A16 | U2A8 | U2A6 | U2B6 | U2B10 |
|---|---|---|---|---|---|
| SCI3 | 3 | 0 | 0 | 0 | 0 |
| RLIN3 | 24 (max), 12 (min) | 24 (max), 12 (min) | 12 (max), 8 (min) | 7 | 7 |
On the U2A starter kit, the SCI30 module connects to the on-board USB/UART debugger. Therefore, the initial support uses SCI30 as the peripheral for serial communication. However, the U2A motor control kit uses the RLIN33 module.
The current CDD for U2A and U2B supports configuration of the SCI30 module and the RLIN33 module.
Baud Rate Calculation in SCI3
In the SCI3 module, baud rate is determined by the values configured in the
SCI3nBRR and SCI3nMDDR registers.
The baud rate depends on:
the peripheral clock
the clock selection value, α
the
SCI3nBRRvaluethe
SCI3nMDDRvaluethe
ABCSandBGDMsettings inSCI3nSEMR
The clock source for the SCI3 module is CLK_HSB.
SCI3 Baud Rate Formula
The baud rate formula depends on the communication mode and the
ABCS and BGDM settings.
For asynchronous mode:
ABCS= 0,BGDM= 0B = PCLK × 10^6 / (64 × 2^(2α - 1) × (256/MDDR) × (N + 1))
ABCS= 0,BGDM= 1 orABCS= 1,BGDM= 0B = PCLK × 10^6 / (32 × 2^(2α - 1) × (256/MDDR) × (N + 1))
ABCS= 1,BGDM= 1B = PCLK × 106 / (16 × 2(2α − 1) × (256/MDDR) × (N + 1))
For clock synchronous mode:
B = PCLK × 10^6 / (16 × 2^(2α - 1) × (256/MDDR) × (N + 1))
Where:
Bis the bit rate in bpsPCLKis the operating frequency in MHzNis the baud rate generator setting value inSCI3nBRR(0 ≤ N ≤ 255)MDDRis the modulation duty value inSCI3nMDDR(128 ≤ MDDR ≤ 255)αis the clock selection value determined bySCI3nSMR
SCI3 Clock Selection Value
The value of α is determined by the CKS1 and
CKS0 bits in the SCI3nSMR register.
| CKS1 | CKS0 | α |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 2 |
| 1 | 1 | 3 |
The clock source for the SCI3 module is CLK_HSB.
Note
N is the bit rate register setting value of baud rate generator (N ≥ 1).
Refer to the hardware user manual Table 25.17 for the relationship between Setting
N in SCI3nBRM and Bit Rate B.
SCI3 Baud Rate Initialization Sequence
The baud rate setting must follow this initialization sequence. After reset,
TE = RE = MDDRS = 0.
Clear the TE and RE bits in
SCI3nSCR. Also clear the TIE, TEIE, MPIE, and RIE bits to0. When clock output is selected in asynchronous mode, the clock is output immediately afterSCI3nSCRsettings are made.Set the CKE1 and CKE0 bits in
SCI3nSCR(TE and RE bits must remain 0).Set the transfer format in:
SCI3nSMRSCI3nSCMR
Clear the MDDRS bit in
SCI3nSEMR, and set the ABCS bit based on the bit rate configuration forSCI3nBRR.Set a value in
SCI3nBRR.Set the BRME and MDDRS bits in
SCI3nSEMRto1, and set a bit rate error correction value inSCI3nMDCR.Set a value in
SCI3nMDDR.Set the TE or RE bit in
SCI3nSCRto1to enable transmission or reception.To enable both transmission and reception, set TE and RE simultaneously using one instruction.
Baud Rate for SCI30 Module in CDD
For the SCI30 module, the initialization routine is present in:
Config_SCI30.c
The two register settings that determine the baud rate are:
SCI30.BRR.UINT8SCI30.MDDR.UINT8
These register values are set from macro definitions in:
Config_SCI30.h
The generated code uses these definitions:
#define _SCI30_MODULATION_DUTY (0xB1U) #define _SCI30_BIT_RATE (0x0EU)
These values currently result in a baud rate of 460800 bps.
If you want to use a different baud rate, update these register values in your application code or override the generated initialization. Moving the baud rate configuration to application-level initialization makes the baud rate editable without manually changing generated code each time.
Baud Rate Calculation in RLIN3
In the RLIN3 module, baud rate depends on two registers:
RLN3nLWBRRLN3nLBRP01
The peripheral clock for RLIN3 comes from CLK_RLIN3, which is
configured in the MCU module in the CDF file.
Use this formula to calculate the baud rate:
Baud Rate = CLK_RLIN3 / clock_prescaler / no_of_samples / (L + 1)
Where:
clock_prescaleris determined byRLN3nLWBR.LPRSLis the value inRLN3nLBRP01(UART Baud Rate Prescaler 01)no_of_samplesis determined byRLN3nLWBR.NSPB
RLN3nLWBR Register Settings
The RLN3nLWBR register controls the sampling count and
prescaler clock selection.
NSPB[3:0] — Bit Sampling Count Select
| Setting | Sampling Count |
|---|---|
| 0000 | 16 |
| 0011 | 4 |
| 0101 | 6 |
| 0110 | 7 |
| 0111 | 8 |
| 1000 | 9 |
| 1001 | 10 |
| 1010 | 11 |
| 1011 | 12 |
| 1100 | 13 |
| 1101 | 14 |
| 1110 | 15 |
| 1100 | 16 |
LPRS[2:0] — Prescaler Clock Select
| Setting | Prescaler |
|---|---|
| 000 | 1/1 |
| 001 | 1/2 |
| 010 | 1/4 |
| 011 | 1/8 |
| 100 | 1/16 |
| 101 | 1/32 |
| 110 | 1/64 |
| 111 | 1/128 |
Baud Rate for RLIN33 Module in CDD
For the RLIN33 module, the default CLK_RLIN3 clock configured
in the CDF file is 10 MHz.
The baud rate is configured in the generated initialization routine for UART3, where these settings determine the final baud rate:
RLIN33.LWBR.UINT8RLIN33.LBRP01.UINT16
The generated code uses the baud rate prescaler macro:
#define _UART3_BAUD_RATE_PRESCALER (0x0000U)
and configures the UART settings in the initialization routine.
Based on the generated settings shown in the CDD:
CLK_RLIN3= 10 MHzsampling count = 7
prescaler = 1
L = 0
So the baud rate is:
Baud Rate = 10,000,000 / 1 / 7 / (0 + 1)
= 1,428,571 bpsTherefore, the current generated configuration for RLIN33 results in a baud rate of approximately 1.43 Mbps.
If you want to use a different baud rate, update the RLIN3 prescaler and sampling configuration in the initialization code or override the generated settings at the application level.