Skip to content

Commit

Permalink
[bsp][Renesas]Modify some drivers and configuration files (#7590)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rbb666 authored Jun 2, 2023
1 parent 22fb715 commit b3ea130
Show file tree
Hide file tree
Showing 51 changed files with 1,981 additions and 127 deletions.
3 changes: 2 additions & 1 deletion bsp/renesas/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ RA 系列 BSP 目前支持情况如下表所示:
| [ra6m4-cpk](ra6m4-cpk) | Renesas 官方 CPK-RA6M4 开发板 |
| [ra6m4-iot](ra6m4-iot) | Renesas 官方 IOT-RA6M4 开发板 |
| [ra6m3-ek](ra6m3-ek) | Renesas 官方 RA6M3-EK 开发板 |
| **RA2 系列** | |
| [ra6m3-hmi-board](ra6m3-hmi-board) | Renesas 联合 RT-Thread RA6M3-HMI-Board 开发板 |
| **RA2 系列** | |
| [ra2l1-cpk](ra2l1-cpk) | Renesas 官方 CPK-RA2L1 开发板 |

可以通过阅读相应 BSP 下的 README 来快速上手,如果想要使用 BSP 更多功能可参考 docs 文件夹下提供的说明文档,如下表所示:
Expand Down
2 changes: 1 addition & 1 deletion bsp/renesas/libraries/HAL_Drivers/drv_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#ifdef RT_USING_SERIAL_V2
#include <drv_usart_v2.h>
#else
#error "Serial-v1 has been obsoleted, and please select serial-v2 as the default option"
#error "Serial-v1 has been obsoleted, and please select serial-v2 as the default option"
#endif
#endif

Expand Down
22 changes: 6 additions & 16 deletions bsp/renesas/libraries/HAL_Drivers/drv_eth.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -52,9 +52,6 @@ struct rt_ra6m3_eth
#ifndef PHY_USING_INTERRUPT_MODE
rt_timer_t poll_link_timer;
#endif

/* interface address info, hw address */
rt_uint8_t dev_addr[MAX_ADDR_LEN];
};

static rt_uint8_t *Rx_Buff, *Tx_Buff;
Expand Down Expand Up @@ -89,7 +86,7 @@ static void dump_hex(const rt_uint8_t *ptr, rt_size_t buflen)

extern void phy_reset(void);
/* EMAC initialization function */
static rt_err_t rt_ra6m3_eth_init(rt_device_t dev)
static rt_err_t rt_ra6m3_eth_init(void)
{
fsp_err_t res;

Expand Down Expand Up @@ -133,7 +130,7 @@ static rt_err_t rt_ra6m3_eth_control(rt_device_t dev, int cmd, void *args)
/* get mac address */
if (args)
{
SMEMCPY(args, ra6m3_eth_device.dev_addr, 6);
SMEMCPY(args, g_ether0_ctrl.p_ether_cfg->p_mac_address, 6);
}
else
{
Expand Down Expand Up @@ -385,16 +382,7 @@ static int rt_hw_ra6m3_eth_init(void)
goto __exit;
}

/* OUI 00-80-E1 STMICROELECTRONICS. */
ra6m3_eth_device.dev_addr[0] = 0x00;
ra6m3_eth_device.dev_addr[1] = 0x80;
ra6m3_eth_device.dev_addr[2] = 0xE1;
/* generate MAC addr from 96bit unique ID (only for test). */
ra6m3_eth_device.dev_addr[3] = (10 + 4);
ra6m3_eth_device.dev_addr[4] = (10 + 2);
ra6m3_eth_device.dev_addr[5] = (10 + 0);

ra6m3_eth_device.parent.parent.init = rt_ra6m3_eth_init;
ra6m3_eth_device.parent.parent.init = NULL;
ra6m3_eth_device.parent.parent.open = rt_ra6m3_eth_open;
ra6m3_eth_device.parent.parent.close = rt_ra6m3_eth_close;
ra6m3_eth_device.parent.parent.read = rt_ra6m3_eth_read;
Expand All @@ -405,6 +393,8 @@ static int rt_hw_ra6m3_eth_init(void)
ra6m3_eth_device.parent.eth_rx = rt_ra6m3_eth_rx;
ra6m3_eth_device.parent.eth_tx = rt_ra6m3_eth_tx;

rt_ra6m3_eth_init();

/* register eth device */
state = eth_device_init(&(ra6m3_eth_device.parent), "e0");
if (RT_EOK == state)
Expand Down
16 changes: 14 additions & 2 deletions bsp/renesas/libraries/HAL_Drivers/drv_lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct drv_lcd_device
struct drv_lcd_device _lcd;

uint16_t screen_rotation;
uint16_t *lcd_current_working_buffer = (uint16_t *)&fb_background[0];
uint16_t *lcd_current_working_buffer = (uint16_t *) &fb_background[0];

// jpeg and lvgl can only select one
__WEAK void _ra_port_display_callback(display_callback_args_t *p_args)
Expand All @@ -44,6 +44,18 @@ __WEAK void _ra_port_display_callback(display_callback_args_t *p_args)

void turn_on_lcd_backlight(void)
{
#ifdef BSP_USING_PWM5
#define LCD_PWM_DEV_NAME "pwm5"
#define LCD_PWM_DEV_CHANNEL 0

struct rt_device_pwm *pwm_dev;

/* turn on the LCD backlight */
pwm_dev = (struct rt_device_pwm *)rt_device_find(LCD_PWM_DEV_NAME);
/* pwm frequency:100K = 10000ns */
rt_pwm_set(pwm_dev, LCD_PWM_DEV_CHANNEL, 10000, 7000);
rt_pwm_enable(pwm_dev, LCD_PWM_DEV_CHANNEL);
#endif
rt_pin_mode(LCD_BL_PIN, PIN_MODE_OUTPUT); /* LCD_BL */
rt_pin_write(LCD_BL_PIN, PIN_HIGH);
}
Expand Down Expand Up @@ -107,7 +119,7 @@ void ra_bsp_lcd_swap_buffer(void)
void bsp_lcd_draw_pixel(uint32_t x, uint32_t y, uint16_t color)
{
// Verify pixel is within LCD range
if ((x < LCD_WIDTH) && (y < LCD_HEIGHT))
if ((x <= LCD_WIDTH) && (y <= LCD_HEIGHT))
{
switch (screen_rotation)
{
Expand Down
7 changes: 6 additions & 1 deletion bsp/renesas/libraries/HAL_Drivers/drv_sdhi.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ struct rt_mmcsd_host *sdio_host_create(struct ra_sdhi *sdhi_des)
ra_sdhi_enable_sdio_irq(host, 1);

/* ready to change */
mmcsd_change(host);
// mmcsd_change(host);

return host;
}
Expand All @@ -508,3 +508,8 @@ int rt_hw_sdhi_init(void)
return 0;
}
INIT_DEVICE_EXPORT(rt_hw_sdhi_init);

void sdcard_change(void)
{
mmcsd_change(host);
}
2 changes: 2 additions & 0 deletions bsp/renesas/libraries/HAL_Drivers/drv_sdhi.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,6 @@ struct ra_sdhi
sdmmc_device_t *media_device;
};

extern void sdcard_change(void);

#endif
24 changes: 13 additions & 11 deletions bsp/renesas/ra6m3-hmi-board/.cproject

Large diffs are not rendered by default.

18 changes: 6 additions & 12 deletions bsp/renesas/ra6m3-hmi-board/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,21 +138,11 @@ void hal_entry(void)
- [瑞萨RA MCU 基础知识](https://www2.renesas.cn/cn/zh/document/gde/1520091)
- [RA6 MCU 快速设计指南](https://www2.renesas.cn/cn/zh/document/apn/ra6-quick-design-guide)
**FSP 配置**
需要修改瑞萨的 BSP 外设配置或添加新的外设端口,需要用到瑞萨的 [FSP](https://www2.renesas.cn/jp/zh/software-tool/flexible-software-package-fsp#document) 配置工具。请务必按照如下步骤完成配置。配置中有任何问题可到[RT-Thread 社区论坛](https://club.rt-thread.org/)中提问。
1. [下载灵活配置软件包 (FSP) | Renesas](https://www.renesas.com/cn/zh/software-tool/flexible-software-package-fsp),请使用 FSP 3.5.0 版本
2. 下载安装完成后,需要添加 EK-RA6M3 开发板的官方板级支持包
> 打开[ EK-RA6M3 开发板详情页](https://www.renesas.cn/cn/zh/products/microcontrollers-microprocessors/ra-cortex-m-mcus/ek-ra6m3-evaluation-kit-ra6m3-mcu-group#document),在 **“下载”** 列表中找到 **” EK-RA6M3板级支持包“** ,点击链接即可下载
3. 如何将 **”EK-RA6M3板级支持包“**添加到 FSP 中,请参考文档[如何导入板级支持包](https://www2.renesas.cn/document/ppt/1527171?language=zh&r=1527191)
4. 请查看文档:[使用 FSP 配置外设驱动](../docs/RA系列使用FSP配置外设驱动.md),在 MDK 中通过添加自定义命名来打开当前工程的 FSP 配置。
**ENV 配置**
- 如何使用 ENV 工具:[RT-Thread env 工具用户手册](https://www.rt-thread.org/document/site/#/development-tools/env/env)
此 BSP 默认只开启了 UART7 的功能,如果需使用更多高级功能例如组件、软件包等,需要利用 ENV 工具进行配置。
此 BSP 默认只开启了 UART9 的功能,如果需使用更多高级功能例如组件、软件包等,需要利用 ENV 工具进行配置。
步骤如下:
1. 在 bsp 下打开 env 工具。
Expand All @@ -164,6 +154,10 @@ void hal_entry(void)
在使用过程中若您有任何的想法和建议,建议您通过以下方式来联系到我们 [RT-Thread 社区论坛](https://club.rt-thread.org/)
## SDK 仓库
这是 HMI-Board 的 SDK 仓库地址:[sdk-bsp-ra6m3-hmi-board](https://github.com/RT-Thread-Studio/sdk-bsp-ra6m3-hmi-board),该仓库包括了外设驱动以及丰富的示例工程,如果像体验官网/社区提供的开源示例请转移到该仓库进行开发。RT-Thread 主仓库只维护最新的驱动相关代码。
## 贡献代码
如果您对 EK-RA6M3 感兴趣,并且有一些好玩的项目愿意与大家分享的话欢迎给我们贡献代码,您可以参考 [如何向 RT-Thread 代码贡献](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/development-guide/github/github)。
如果您对 RA6M3-HMI-Board 感兴趣,并且有一些好玩的项目愿意与大家分享的话欢迎给我们贡献代码,您可以参考 [如何向 RT-Thread 代码贡献](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/development-guide/github/github)。
Loading

0 comments on commit b3ea130

Please sign in to comment.