1# Renesas RSK-RZN2L Development Board BSP Documentation
2
3**English** | [**中文**](./README_zh.md)
4
5## Introduction
6
7This document provides the BSP (Board Support Package) for the Renesas RSK-RZN2L development board. By following the Quick Start Guide, developers can quickly get started with the BSP and run RT-Thread on the development board.
8
9The main contents include:
10
11- Development Board Introduction
12- BSP Quick Start Guide
13
14## Development Board Introduction
15
16The RSK-RZN2L MCU evaluation board is based on Renesas RZ/N2L and is designed for developing embedded system applications with flexible software package configuration and IDE support.
17
18The front appearance of the development board is shown below:
19
20![image-20240914173709363](figures/image-20240914173709363.png)
21
22The commonly used **onboard resources** for this development board are as follows:
23
24- MPU: R9A07G084M04GBG, maximum operating frequency of 400MHz, Arm® Cortex®-R52 with on-chip FPU (Floating Point Unit) and NEON™, 1.5 MB on-chip SRAM, Ethernet MAC, EtherCAT, USB 2.0 High-Speed, CAN/CANFD, various communication interfaces such as xSPI and ΔΣ interfaces, and security functions.
25- Debug Interface: Onboard J-Link interface
26- Expansion Interface: Two PMOD connectors
27
28**More detailed information and tools**
29
30## Peripheral Support
31
32The current peripheral support in this BSP is as follows:
33
34| **On-chip Peripheral** | **Support Status** | **Remarks** |
35| :----------------- | :----------------- | :------------- |
36| UART               | Supported          | UART0 is the default log output port |
37| GPIO               | Supported          |                |
38| HWIMER             | Supported          |                |
39| IIC                | Supported          |                |
40| WDT                | Supported          |                |
41| RTC                | Supported          |                |
42| ADC                | Supported          |                |
43| DAC                | Supported          |                |
44| SPI                | Supported          |                |
45| FLASH              | Supported          |                |
46| PWM                | Supported          |                |
47| CAN                | Supported          |                |
48| ETH                | Supported          |                |
49| More updates...    |                    |                |
50
51## Instructions
52
53The instructions are divided into the following two sections:
54
55- Quick Start
56
57  This section is for beginners who are new to RT-Thread. By following simple steps, you can run the RT-Thread OS on this development board and observe the experimental results.
58
59- Advanced Usage
60
61  This section is for developers who want to use more resources on the development board with RT-Thread. Using the ENV tool to configure the BSP, you can enable more onboard resources and achieve more advanced features.
62
63### Quick Start
64
65Currently, this BSP only provides an IAR project. Below is an example of how to get the system running using the [IAR Embedded Workbench for Arm](https://www.iar.com/products/architectures/arm/iar-embedded-workbench-for-arm/) development environment.
66
67**Hardware Connection**
68
69Connect the development board to the PC using a USB data cable, and use the J-Link interface to download and debug programs.
70
71**Compilation and Download**
72
73- Go to the BSP directory, open ENV, and use the command `scons --target=iar` to generate the IAR project.
74- Compile: Double-click the `project.eww` file to open the IAR project and compile the program.
75- Debug: Click `Project->Download and Debug` in the IAR toolbar to download and start debugging.
76
77**View Running Results**
78
79After successfully downloading the program, the system will run automatically and print system information.
80
81Connect the corresponding serial port of the development board to the PC. Open the corresponding serial port in a terminal tool (115200-8-1-N). After resetting the device, you can see the RT-Thread output. Enter the `help` command to view the supported commands in the system.
82
83```bash
84 \ | /
85- RT -     Thread Operating System
86 / | \     5.1.0 build Mar 14 2024 18:26:01
87 2006 - 2024 Copyright by RT-Thread team
88
89Hello RT-Thread!
90==================================================
91This is a iar project which mode is xspi0 execution!
92==================================================
93msh >help
94RT-Thread shell commands:
95clear            - clear the terminal screen
96version          - show RT-Thread version information
97list             - list objects
98backtrace        - print backtrace of a thread
99help             - RT-Thread shell help
100ps               - List threads in the system
101free             - Show the memory usage in the system
102pin              - pin [option]
103
104msh >
105```
106
107**Application Entry Function**
108
109The application layer's entry function is in `src\hal_entry.c` in the `void hal_entry(void)` function. User source files can be placed directly in the `src` directory.
110
111```c
112#define LED_PIN    BSP_IO_PORT_18_PIN_2 /* Onboard LED pins */
113
114void hal_entry(void)
115{
116    rt_kprintf("\nHello RT-Thread!\n");
117    rt_kprintf("==================================================\n");
118    rt_kprintf("This is a iar project which mode is xspi0 execution!\n");
119    rt_kprintf("==================================================\n");
120
121    while (1)
122    {
123        rt_pin_write(LED_PIN, PIN_HIGH);
124        rt_thread_mdelay(500);
125        rt_pin_write(LED_PIN, PIN_LOW);
126        rt_thread_mdelay(500);
127    }
128}
129```
130
131### Advanced Usage
132
133**Resources and Documentation**
134
135- [Development Board Official Homepage](https://www.renesas.cn/zh/products/microcontrollers-microprocessors/rz-mpus/rzn2l-integrated-tsn-compliant-3-port-gigabit-ethernet-switch-enables-various-industrial-applications)
136- [Development Board Data Sheet](https://www.renesas.cn/zh/document/dst/rzn2l-group-datasheet?r=1622651)
137- [Development Board Hardware Manual](https://www.renesas.cn/zh/document/mah/rzn2l-group-users-manual-hardware?r=1622651)
138- [RZ/N2L MCU Quick Start Guide](https://www.renesas.cn/zh/document/apn/rzt2-rzn2-device-setup-guide-flash-boot-application-note?r=1622651)
139- [RZ/N2L Easy Download Guide](https://www.renesas.cn/zh/document/gde/rzn2l-easy-download-guide?r=1622651)
140- [Renesas RZ/N2L Group](https://www.renesas.cn/zh/document/fly/renesas-rzn2l-group?r=1622651)
141
142**FSP Configuration**
143
144If you need to modify Renesas BSP peripheral configurations or add new peripheral ports, you will need to use the Renesas [FSP](https://www2.renesas.cn/jp/zh/software-tool/flexible-software-package-fsp#document) configuration tool. Please follow the steps below. If you encounter any issues during the configuration, feel free to ask on the [RT-Thread Community Forum](https://club.rt-thread.org/).
145
1461. [Download the Flexible Software Package (FSP) | Renesas](https://github.com/renesas/rzn-fsp/releases/download/v2.0.0/setup_rznfsp_v2_0_0_rzsc_v2024-01.1.exe), please use version FSP 2.0.0.
1472. Refer to the document [How to Import Board Support Package](https://www2.renesas.cn/document/ppt/1527171?language=zh&r=1527191) to add the **"RSK-RZN2L Board Support Package"** to FSP.
1483. Refer to the document: [RA Series Using FSP to Configure Peripheral Drivers](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/tutorial/make-bsp/renesas-ra/RA系列使用FSP配置外设驱动?id=ra系列使用-fsp-配置外设驱动).
149
150**ENV Configuration**
151
152- How to use the ENV tool: [RT-Thread ENV Tool User Manual](https://www.rt-thread.org/document/site/#/development-tools/env/env)
153
154By default, this BSP only enables UART0. To use more advanced features like components, software packages, etc., you need to configure the BSP using the ENV tool.
155
156Steps:
1571. Open the env tool in the BSP directory.
1582. Enter the `menuconfig` command to configure the project. After configuration, save and exit.
1593. Enter the `pkgs --update` command to update the software packages.
1604. Enter the `scons --target=iar` command to regenerate the project.
161
162## Contact Information
163
164If you have any thoughts or suggestions during usage, feel free to contact us via the [RT-Thread Community Forum](https://club.rt-thread.org/).
165
166## Contribute Code
167
168If you are interested in the RSK-RZN2L and have some exciting projects to share with the community, we welcome your code contributions. You can refer to [How to Contribute Code to RT-Thread](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/development-guide/github/github).