Skip to content

Commit 5222385

Browse files
miyazakhdanielinux
authored andcommitted
adjust UART settings and update readme
1 parent fcf72e0 commit 5222385

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

IDE/Renesas/e2studio/RA6M4/Readme.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,29 @@ Key BSP settings configured above (`wolfBoot/ra_cfg/fsp_cfg/bsp/bsp_cfg.h`):
158158

159159
wolfBoot initialises the FACI HP directly; **no FSP flash stack (`g_flash0`) is required**.
160160

161-
To enable debug output over UART (SCI7, P613=TXD7, J23 connector), edit `wolfBoot/user_settings.h`:
161+
#### 2-3) Enable Debug UART Output (optional)
162+
163+
Defining `DEBUG_UART` enables `wolfBoot_printf()` output over SCI7.
164+
Edit `wolfBoot/user_settings.h` and uncomment both lines:
165+
162166
```c
163167
#define DEBUG_UART
164168
#define PRINTF_ENABLED
165169
```
166170

171+
**UART channel and pin assignment (EK-RA6M4):**
172+
173+
| Signal | Port pin | Board connector | Note |
174+
|:--|:--|:--|:--|
175+
| TXD7 | P613 | J23 Pin2 (silk: TX►0) | Connect to RXD of USB-UART adapter |
176+
| RXD7 | P614 | J23 Pin1 (silk: RX◄0) | Connect to TXD of USB-UART adapter |
177+
| GND || J24 Pin7 | Common ground |
178+
179+
**Terminal settings:** 115200 bps, 8N1, no flow control.
180+
181+
> **Note**: SCI7 on RA6M4 uses **PCLKA (100 MHz)**, not PCLKB (50 MHz).
182+
> The BRR value in `hal/renesas-ra.h` is calculated accordingly (`RA_PCLKA_SCI = 100000000U`).
183+
167184
#### 2-2) Modify wolfBoot hal_entry.c
168185

169186
`wolfBoot/src/hal_entry.c` is **not stored in the repository** (Renesas copyright, FSP-generated).

IDE/Renesas/e2studio/RA6M4/wolfBoot/user_settings.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,5 +317,4 @@
317317

318318
#define NVM_FLASH_WRITEONCE
319319
/*#define DEBUG_UART*/
320-
/*#define PRINTF_ENABLED*/
321320
#endif /* !H_USER_SETTINGS_ */

hal/renesas-ra.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,20 @@
125125
#define PFS_PMR (1u << 16)
126126
#define PFS_PDR (1u << 2)
127127
#define PFS_PODR (1u << 0)
128-
#define PFS_PSEL_SCI7 (0x05u << 24) /* PSEL=0x05: SCI1/3/5/7/9 odd channels */
128+
#define PFS_PSEL_SCI7 (0x05u << 24) /* PSEL=0x05: SCI1/3/5/7/9 odd channels */
129129
#define R_PMISC_PWPR REG8(0x40080D03UL)
130130
#define PWPR_PFSWE (1u << 6)
131131
#define PWPR_B0WI (1u << 7)
132132
#ifndef DEBUG_BAUD_RATE
133133
#define DEBUG_BAUD_RATE 115200U
134134
#endif
135-
#ifndef RA_PCLKB
136-
#define RA_PCLKB 50000000U
135+
/* SCI7 on RA6M4 is clocked by PCLKA (not PCLKB).
136+
* Default EK-RA6M4 FSP config: PLL=200MHz, PCLKA Div/2 = 100MHz. */
137+
#ifndef RA_PCLKA_SCI
138+
#define RA_PCLKA_SCI 100000000U /* PCLKA = 100MHz */
137139
#endif
138-
#define SCI_BRR_VAL (RA_PCLKB / (8U * DEBUG_BAUD_RATE) - 1U)
140+
/* BRR: BGDM=1, ABCS=1 -> divisor=8. 100MHz/(8*115200)-1 = 107 -> 115741bps */
141+
#define SCI_BRR_VAL (RA_PCLKA_SCI / (8U * DEBUG_BAUD_RATE) - 1U)
139142
/* --- Flash error codes (used by flash_check_error) --- */
140143
typedef enum {
141144
FLASH_OK = 0,

0 commit comments

Comments
 (0)