Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/ALL_BSP_COMPILE.json
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@
"renesas/ra6m3-hmi-board",
"renesas/ra6e2-ek",
"renesas/ra6e2-fpb",
"renesas/ra6w1-ek",
"renesas/ra4e2-eco",
"renesas/ra4m1-ek",
"renesas/ra4m2-eco",
Expand Down
6 changes: 6 additions & 0 deletions bsp/renesas/.clang-format-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@
/**/ra/
/**/ra_cfg/
/**/ra_gen/
/**/rafw_cfg/
/**/rafw_gen/
/libraries/bsp-template/
/**/RTE/

# RA8P1 Titan generated and migrated sources
/ra8p1-titan-board/*/board/bsp_linker_info.h
/ra8p1-titan-board/m85/board/ports/

# RA6W1 generated and migrated sources
/ra6w1-ek/board/bsp_linker_info.h
/ra6w1-ek/board/ports/
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,12 @@ extern "C"
#endif
#endif /* SOC_SERIES_R7FA2A1 */

#if defined(SOC_FAMILY_RENESAS_RA_WIRELESS)
#if defined(SOC_SERIES_R7SA6W1)
#include "raw/ra6w1/uart_config.h"
#endif /* SOC_SERIES_R7SA6W1 */
#endif /* SOC_FAMILY_RENESAS_RA_WIRELESS */

#ifdef __cplusplus
}
#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright (c) 2006-2026, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2026-07-29 rcitach first version
*/

#ifndef __RAW61_UART_CONFIG_H__
#define __RAW61_UART_CONFIG_H__

#include <rtthread.h>
#include "hal_data.h"

#ifdef __cplusplus
extern "C" {
#endif

#if defined(BSP_USING_UART0)
#ifndef UART0_CONFIG
#define UART0_CONFIG \
{ \
.name = "uart0", \
.p_api_ctrl = &g_uart1_ctrl, \
.p_cfg = &g_uart1_cfg, \
}
#endif /* UART0_CONFIG */
#endif /* BSP_USING_UART0 */

#if defined(BSP_USING_UART1)
#ifndef UART1_CONFIG
#define UART1_CONFIG \
{ \
.name = "uart1", \
.p_api_ctrl = &g_uart2_ctrl, \
.p_cfg = &g_uart2_cfg, \
}
#endif /* UART1_CONFIG */
#endif /* BSP_USING_UART1 */

#ifdef BSP_USING_UART2
#ifndef UART2_CONFIG
#define UART2_CONFIG \
{ \
.name = "uart2", \
.p_api_ctrl = &g_uart3_ctrl, \
.p_cfg = &g_uart3_cfg, \
}
#endif /* UART2_CONFIG */
#endif /* BSP_USING_UART2 */

#ifdef __cplusplus
}
#endif

#endif /* __RAW61_UART_CONFIG_H__ */

48 changes: 33 additions & 15 deletions bsp/renesas/libraries/HAL_Drivers/drivers/drv_usart_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@
#ifdef RT_USING_SERIAL_V2

//#define DRV_DEBUG
#define DBG_TAG "drv.usart"
#define DBG_TAG "drv.usart"
#ifdef DRV_DEBUG
#define DBG_LVL DBG_LOG
#define DBG_LVL DBG_LOG
#else
#define DBG_LVL DBG_INFO
#define DBG_LVL DBG_INFO
#endif /* DRV_DEBUG */
#include <rtdbg.h>

static struct ra_uart_config uart_config[] =
{
static struct ra_uart_config uart_config[] = {
#ifdef BSP_USING_UART0
UART0_CONFIG,
#endif
Expand Down Expand Up @@ -109,7 +108,7 @@ enum
#endif
};

static struct ra_uart uart_obj[sizeof(uart_config) / sizeof(uart_config[0])] = {0};
static struct ra_uart uart_obj[sizeof(uart_config) / sizeof(uart_config[0])] = { 0 };

static void ra_uart_get_config(void)
{
Expand Down Expand Up @@ -213,6 +212,16 @@ static rt_err_t ra_uart_configure(struct rt_serial_device *serial, struct serial

#if defined(SOC_SERIES_R7FA8M85) || defined(SOC_SERIES_R7KA8P1)
err = R_SCI_B_UART_Open(uart->config->p_api_ctrl, uart->config->p_cfg);
#elif defined(SOC_SERIES_R7SA6W1)
uart_w_extended_cfg_t *p_extend = (uart_w_extended_cfg_t *)uart->config->p_cfg->p_extend;
RT_ASSERT(p_extend != RT_NULL);
RT_ASSERT(p_extend->p_baud_setting != RT_NULL);

err = R_UART_W_BaudCalculate(cfg->baud_rate, p_extend->p_baud_setting);
if (FSP_SUCCESS == err)
{
err = R_UART_W_Open(uart->config->p_api_ctrl, uart->config->p_cfg);
}
#else
err = R_SCI_UART_Open(uart->config->p_api_ctrl, uart->config->p_cfg);
#endif
Expand All @@ -237,18 +246,28 @@ static int ra_uart_putc(struct rt_serial_device *serial, char c)
uart = rt_container_of(serial, struct ra_uart, serial);
RT_ASSERT(uart != RT_NULL);

#if defined(SOC_SERIES_R7FA8M85) || defined(SOC_SERIES_R7KA8P1)
#if defined(SOC_SERIES_R7SA6W1)
uart_w_instance_ctrl_t *p_ctrl = (uart_w_instance_ctrl_t *)uart->config->p_api_ctrl;

p_ctrl->p_reg->UART_DR_REG = c;

while (p_ctrl->p_reg->UART_FR_REG_b.BUSY);
#elif defined(SOC_SERIES_R7FA8M85) || defined(SOC_SERIES_R7KA8P1)
sci_b_uart_instance_ctrl_t *p_ctrl = (sci_b_uart_instance_ctrl_t *)uart->config->p_api_ctrl;

p_ctrl->p_reg->TDR = c;

while ((p_ctrl->p_reg->CSR_b.TEND) == 0);
#else
sci_uart_instance_ctrl_t *p_ctrl = (sci_uart_instance_ctrl_t *)uart->config->p_api_ctrl;
#endif

p_ctrl->p_reg->TDR = c;

#if defined(SOC_SERIES_R7FA8M85) || defined(SOC_SERIES_R9A07G0) || defined(SOC_SERIES_R7KA8P1)
#if defined(SOC_SERIES_R9A07G0)
while ((p_ctrl->p_reg->CSR_b.TEND) == 0);
#else
while ((p_ctrl->p_reg->SSR_b.TEND) == 0);
#endif
#endif

return RT_EOK;
Expand All @@ -259,10 +278,10 @@ static int ra_uart_getc(struct rt_serial_device *serial)
return RT_EOK;
}

static rt_ssize_t ra_uart_transmit(struct rt_serial_device *serial,
rt_uint8_t *buf,
rt_size_t size,
rt_uint32_t tx_flag)
static rt_ssize_t ra_uart_transmit(struct rt_serial_device *serial,
rt_uint8_t *buf,
rt_size_t size,
rt_uint32_t tx_flag)
{
struct ra_uart *uart;

Expand Down Expand Up @@ -467,8 +486,7 @@ void user_uart9_callback(uart_callback_args_t *p_args)
}
#endif

static const struct rt_uart_ops ra_uart_ops =
{
static const struct rt_uart_ops ra_uart_ops = {
.configure = ra_uart_configure,
.control = ra_uart_control,
.putc = ra_uart_putc,
Expand Down
10 changes: 10 additions & 0 deletions bsp/renesas/libraries/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ config SOC_FAMILY_RENESAS_RA
bool
default n

config SOC_FAMILY_RENESAS_RA_WIRELESS
bool
default n

config SOC_FAMILY_RENESAS_RZ
bool
default n
Expand Down Expand Up @@ -91,6 +95,12 @@ config SOC_SERIES_R7FA6E2
select SOC_FAMILY_RENESAS_RA
default n

config SOC_SERIES_R7SA6W1
bool
select ARCH_ARM_CORTEX_M33
select SOC_FAMILY_RENESAS_RA_WIRELESS
default n

config SOC_SERIES_R7FA2A1
bool
select ARCH_ARM_CORTEX_M23
Expand Down
Loading
Loading