1# Peripheral Driver Addition Guide of RA Series 2 3## 1. Introduction 4 5This document is intended for developers who need to add more peripheral drivers to their existing RA series BSPs. By reading this article, developers can add their own drivers to existing BSPs according to their actual situation. 6 7## 2. Prerequisites 8 9- Proficiency in using ENV tools, reference: [RT-Thread env tools user manual](https://www.rt-thread.org/document/site/#/development-tools/env/env) 10- Familiar with [Kconfig](https://www.rt-thread.org/document/site/#/development-tools/kconfig/kconfig) programmer 11- Familiar with [FSP](https://www2.renesas.cn/jp/zh/software-tool/flexible-software-package-fsp) tool 12- Understanding RT-Thread [Device Driver Framework](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/programming-manual/device/device) 13 14## 3. How to add more peripheral driver options 15 16This section uses the example of adding on-chip peripheral drivers to explain how to add more drivers available to BSPs. If the on-chip peripherals you want to use are not available in the 'On-chip peripheral configuration menu', you need to add them yourself. Below we will demonstrate how to add a UART9 port for ra6m4-cpk. 17 18Adding peripheral support for UART requires the following steps: 19 20### 3.1 Modify the Kconfig file 21 22Open the board\kconfig file in the BSP and add the UART9 configuration. 23 24 25 26 27 28After the modification is complete, open the ENV tool in the BSP directory and enter the 'menuconfig' command on the command line to see if the UART9 configuration has been added. 29 30 31 32### 3.2 Modify the uart_config.h file 33 34Once the configuration of Kconfig is added, you also need to add the corresponding configuration in the configuration file and driver file. 35 36Open the file `libraries\HAL_Drivers\config\ra6m4\uart_config.h` to add the UART9 configuration. 37 38 39 40### 3.3 Modify the drv_usart_v2.h file 41 42Open `librariesHAL_Driversdrv_usart_v2.c' and add the following code: 43 44 45 46 47 48### 3.4 Test validation 49 501. Open UART9 in menuconfig and save the configuration, regenerating the MDK project using the 'scons --target=mdk5' command. 512. Open the FSP Configuration Tool from the project project and add the UART9 port 52 53 54 55 56 573. Configure the CORRESPONDING IO pin of UART9, save and exit. 58 59 60 614. Compile, debug download, enter list_device command to see that the uart9 device has been registered to the kernel, indicating that the device was added successfully, and then you can use the UART9 port to communicate. 62 63 64 65 66 67This tutorial translated by [Josh Zou](https://github.com/Firmament-Autopilot)