2022-03-11 09:17:46 +08:00
|
|
|
|
# RA系列使用 FSP 配置外设驱动
|
2021-10-11 21:14:00 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|
## 1. 准备工作
|
|
|
|
|
|
|
|
|
|
### 1.1 在 MDK 中添加用于启动FSP的自定义命令
|
2021-11-03 20:40:06 +08:00
|
|
|
|
|
2021-10-11 21:14:00 +08:00
|
|
|
|
1. 打开 MDK,选择 “Tools -> Customize Tools Menu…”
|
|
|
|
|
2. 点击 “new” 图标,添加一条自定义命令: RA Smart Configurator
|
2022-01-04 19:27:04 +08:00
|
|
|
|
3. Command 输入工具的安装路径, 点击“**…**”找到安装路径下的“rasc.exe”文件并选中 (rasc 安装目录下)
|
2021-10-11 21:14:00 +08:00
|
|
|
|
4. Initial Folder 输入参数: $P
|
|
|
|
|
5. Arguments 输入参数: --device $D --compiler ARMv6 configuration.xml
|
2022-01-04 19:27:04 +08:00
|
|
|
|
6. 点击 OK 保存命令
|
2021-10-11 21:14:00 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-11 21:14:00 +08:00
|
|
|
|
|
2022-01-04 19:27:04 +08:00
|
|
|
|
7. 点击添加的命令 “Tools -> RA smart Configurator”,**打开配置工具**:RA Smart Config
|
2021-10-11 21:14:00 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-11 21:14:00 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|
PS:以上相关操作也可以在 FSP 的说明文档中找到。
|
2021-11-03 20:40:06 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|
FSP 文档:https://www2.renesas.cn/jp/zh/software-tool/flexible-software-package-fsp#document
|
2021-11-03 20:40:06 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|
### 1.2 注意事项
|
2021-11-03 20:40:06 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|
#### 1.2.1 FSP 版本选择
|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|
RA系列已更新 **FSP 3.5.0** 版本的支持,请使用 **FSP 3.5.0** 版本进行配置修改,**旧版本可能存在兼容性问题**。
|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
|
|
|
|
**使用 RASC 前请务必检查 FSP version 、Board、Device 配置项是否正确。**
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|
#### 1.2.2 更新工程配置
|
2021-11-03 20:40:06 +08:00
|
|
|
|
|
|
|
|
|
使用 FSP 配置完成后如果有新的文件添加进工程中,不会马上添加进去。需要先编译一次,如果弹出如下提醒,选择 “是” 然后再次编译即可。
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-11-03 20:40:06 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|
## 2. 使用 FSP 添加并配置外设
|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|
**PS:文档中的外设添加步骤均为单独配置的说明,排版顺序不代表外设添加顺序,如遇到引脚冲突请查阅开发板及芯片手册的相关章节。**
|
2021-11-03 20:40:06 +08:00
|
|
|
|
|
2021-11-04 20:31:55 +08:00
|
|
|
|
### UART
|
2021-10-11 21:14:00 +08:00
|
|
|
|
|
2021-10-22 15:12:56 +08:00
|
|
|
|
如何添加一个 UART 端口外设配置?
|
|
|
|
|
|
|
|
|
|
1. 选择 Stacks 配置页,点击 New Stack 找到 UART。
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-11 21:14:00 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|
2. 配置 UART 参数,因为需要适配 RT-Thread 驱动中使用的命名,所以需要修改命名,设置**name** 、**channel** 、**callback** 为一致的标号。
|
|
|
|
|

|
2021-10-22 15:12:56 +08:00
|
|
|
|
|
2021-11-04 20:31:55 +08:00
|
|
|
|
### GPIO 中断
|
2021-10-22 15:12:56 +08:00
|
|
|
|
|
|
|
|
|
如何添加一个 IO 中断?
|
|
|
|
|
|
2021-11-03 20:40:06 +08:00
|
|
|
|
1. 选择引脚编号,进入配置,比如选择 P105 做为中断引脚。可先找到引脚查看可配置成的 IRQx 通道号。
|
2021-10-22 15:12:56 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-22 15:12:56 +08:00
|
|
|
|
|
2021-11-03 20:40:06 +08:00
|
|
|
|
2. 打开 ICU 中断通道 IRQ00
|
2021-10-22 15:12:56 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-22 15:12:56 +08:00
|
|
|
|
|
2022-07-07 17:12:56 +08:00
|
|
|
|
3. 创建 stack 并进入配置。因为需要适配 RT-Thread 驱动中使用的命名,所以需要修改命名,设置 **name** 、**channel** 为一致的标号,**callback**统一命名为`irq_callback`。选择你希望的触发方式,最后保存配置,生成配置代码。
|
2021-10-22 15:12:56 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-11-03 20:40:06 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-11-03 20:40:06 +08:00
|
|
|
|
|
|
|
|
|
4. 测试中断是否成功开启
|
2021-10-22 15:12:56 +08:00
|
|
|
|
|
|
|
|
|
```c
|
2021-11-04 14:02:05 +08:00
|
|
|
|
#define IRQ_TEST_PIN "p105"
|
2021-10-22 15:12:56 +08:00
|
|
|
|
void irq_callback_test(void *args)
|
|
|
|
|
{
|
2021-11-04 14:02:05 +08:00
|
|
|
|
rt_kprintf("\n IRQ00 triggered \n");
|
2021-10-22 15:12:56 +08:00
|
|
|
|
}
|
2023-09-06 15:06:36 +08:00
|
|
|
|
|
2021-10-22 15:12:56 +08:00
|
|
|
|
void icu_sample(void)
|
|
|
|
|
{
|
2021-11-04 14:02:05 +08:00
|
|
|
|
/* init */
|
2021-11-03 20:40:06 +08:00
|
|
|
|
rt_uint32_t pin = rt_pin_get(IRQ_TEST_PIN);
|
2021-10-22 15:12:56 +08:00
|
|
|
|
rt_kprintf("\n pin number : 0x%04X \n", pin);
|
|
|
|
|
rt_err_t err = rt_pin_attach_irq(pin, PIN_IRQ_MODE_RISING, irq_callback_test, RT_NULL);
|
|
|
|
|
if(RT_EOK != err)
|
|
|
|
|
{
|
|
|
|
|
rt_kprintf("\n attach irq failed. \n");
|
|
|
|
|
}
|
|
|
|
|
err = rt_pin_irq_enable(pin, PIN_IRQ_ENABLE);
|
|
|
|
|
if(RT_EOK != err)
|
|
|
|
|
{
|
|
|
|
|
rt_kprintf("\n enable irq failed. \n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
MSH_CMD_EXPORT(icu_sample, icu sample);
|
|
|
|
|
```
|
|
|
|
|
|
2021-11-04 20:31:55 +08:00
|
|
|
|
### WDT
|
2021-10-22 15:12:56 +08:00
|
|
|
|
|
2021-11-03 20:40:06 +08:00
|
|
|
|
1. 创建 WDT
|
2021-10-22 15:12:56 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-22 15:12:56 +08:00
|
|
|
|
|
2021-11-03 20:40:06 +08:00
|
|
|
|
2. 配置 WDT,需要注意在 RT-Thread 中只使用了一个 WDT 设备,所以没有对其进行编号,如果是新创建的 WDT 设备需要注意 name 字段,在驱动中默认使用的是`g_wdt` 。
|
2021-10-22 15:12:56 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-22 15:12:56 +08:00
|
|
|
|
|
2021-11-03 20:40:06 +08:00
|
|
|
|
3. 如何在 ENV 中打开 WDT 以及[WDT 接口使用说明](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/programming-manual/device/watchdog/watchdog)
|
2021-10-27 18:51:05 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-22 15:12:56 +08:00
|
|
|
|
|
2021-11-04 20:31:55 +08:00
|
|
|
|
### RTC
|
2021-10-22 15:12:56 +08:00
|
|
|
|
|
|
|
|
|
1. 添加 RTC 设备
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-22 15:12:56 +08:00
|
|
|
|
|
2021-11-03 20:40:06 +08:00
|
|
|
|
2. 配置 RTC,需要注意在 RT-Thread 中只是用了一个 RTC 设备,所以没有对其进行编号,如果是新创建的 RTC 设备需要注意 name 字段,在驱动中默认使用的是`g_rtc` 。修改 Callback 为 rtc_callback
|
2021-10-22 15:12:56 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-22 15:12:56 +08:00
|
|
|
|
|
2021-11-04 20:31:55 +08:00
|
|
|
|
3. 如何在 ENV 中打开 RTC 以及[ RTC 接口使用说明](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/programming-manual/device/rtc/rtc)
|
2021-10-27 18:51:05 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-27 18:51:05 +08:00
|
|
|
|
|
2021-11-04 20:31:55 +08:00
|
|
|
|
### Flash
|
2021-10-27 18:51:05 +08:00
|
|
|
|
|
|
|
|
|
1. 创建 Flash
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-27 18:51:05 +08:00
|
|
|
|
|
2021-11-03 20:40:06 +08:00
|
|
|
|
2. 配置 Flash,需要注意在 RT-Thread 中只使用了一个 flash 设备,所以没有对其进行编号,如果是新创建的 flash 设备需要注意 name 字段,在驱动中默认使用的是`g_flash` 。
|
2021-10-27 18:51:05 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-27 18:51:05 +08:00
|
|
|
|
|
|
|
|
|
3. 如何在 ENV 中打开 Flash
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-27 18:51:05 +08:00
|
|
|
|
|
2021-11-04 20:31:55 +08:00
|
|
|
|
### SPI
|
2021-10-27 18:51:05 +08:00
|
|
|
|
|
|
|
|
|
1. 添加一个 SPI 外设端口
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-27 18:51:05 +08:00
|
|
|
|
|
|
|
|
|
2. 配置 channel、name、Clock Phase、Clock Polarity、Callback、 SPI Mode 等参数,波特率在代码中可通过 API 修改,这里可以设置一个默认值。
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-27 18:51:05 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|
3. 在 Pins 中打开 SPI1 ,配置端口引脚。**注意:请勿在此处配置 SSLx 片选引脚,片选引脚的控制在驱动程序中由软件控制。**
|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4. 如何在 ENV 中打开 SPI 以及 [SPI 接口使用说明](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/programming-manual/device/spi/spi)
|
2021-10-27 18:51:05 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-27 18:51:05 +08:00
|
|
|
|
|
2021-11-04 20:31:55 +08:00
|
|
|
|
### ADC/DAC
|
2021-10-27 18:51:05 +08:00
|
|
|
|
|
|
|
|
|
创建 ADC/DAC
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-27 18:51:05 +08:00
|
|
|
|
|
2021-11-03 20:40:06 +08:00
|
|
|
|
- **ADC**
|
2021-10-27 18:51:05 +08:00
|
|
|
|
|
|
|
|
|
1. 配置 name、unit、mode,选择扫描的通道编号
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-27 18:51:05 +08:00
|
|
|
|
|
|
|
|
|
2. 配置扫描通道对应的引脚
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-27 18:51:05 +08:00
|
|
|
|
|
2021-11-03 20:40:06 +08:00
|
|
|
|
3. 在 menuconfig 中打开对应的通道
|
|
|
|
|
|
|
|
|
|
- **DAC**
|
2021-10-27 18:51:05 +08:00
|
|
|
|
|
|
|
|
|
1. 需要先关闭 P014 的默认 mode
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-27 18:51:05 +08:00
|
|
|
|
|
|
|
|
|
2. 开启 DAC0 通道
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-27 18:51:05 +08:00
|
|
|
|
|
|
|
|
|
3. 修改通道号为 0,与 DAC0 对应
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-29 15:26:59 +08:00
|
|
|
|
|
2021-11-03 20:40:06 +08:00
|
|
|
|
4. 在 menuconfig 中打开对应的通道
|
2021-10-29 15:26:59 +08:00
|
|
|
|
|
2023-09-06 15:06:36 +08:00
|
|
|
|
### Timer(GPT)
|
|
|
|
|
|
|
|
|
|
GPT 定时器在该芯片中可作为通用定时器,可以用于计时功能。
|
|
|
|
|
|
|
|
|
|
1、添加 GPT 设备
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
2、对 GPT 较为关键的配置如图所示,具体解释如下:
|
|
|
|
|
|
|
|
|
|
1. 设置开启的定时器名称,比如 timer0/1...
|
|
|
|
|
2. 设置定时器通道,需要和定时器名称后缀名相同,比如 0/1...
|
|
|
|
|
3. 设置定时器中断回调函数,比如 timer0—>**timer0_callback**,timer1—>**timer1_callback**
|
|
|
|
|
4. 设置定时器中断优先级
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
3、在 env 中配置 timer 外设:
|
|
|
|
|
|
|
|
|
|
* 使能 timer 外设
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
* 选择需要打开的某个定时器
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
* 最后使用 scons --target=mdk5 等方式生成工程
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|
### PWM(GPT)
|
2021-10-29 15:26:59 +08:00
|
|
|
|
|
|
|
|
|
GPT 定时器在该芯片中可作为通用定时器,也可以用于产生 PWM 信号。在将其用于产生 PWM 信号时,GPT 定时器提供了 gpt0 - gpt9 总共 10 个通道,每个通道可以设定两个输出端口。当前版本的 PWM 驱动将每个通道都看做一个单独的 PWM 设备,每个设备都只有一个通道。用户可以选择开启一个通道的任意一个输出端口,或将两个端口均开启,但在同时开启两个端口的情况下,它们输出的波形将完全一致。
|
|
|
|
|
|
|
|
|
|
1. 添加 GPT 设备
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
|
|
|
|
|
2021-10-29 15:26:59 +08:00
|
|
|
|
2. 配置通道
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-29 15:26:59 +08:00
|
|
|
|
|
|
|
|
|
对 GPT 较为关键的配置如图所示,具体解释如下:
|
|
|
|
|
|
2021-11-03 20:40:06 +08:00
|
|
|
|
1. 将``Common`` ->``Pin Output Support`` 设置为 Enable ,以开启 PWM 波形的输出。
|
|
|
|
|
2. 指定 GPT 通道,并根据通道数指定 GPT 的名称,例如此处指定 GPT 通道 3 ,所以 GPT 的名称必须为``g_timer3``。并且将定时器模式设置为 PWM ,并指定每个 PWM 周期的计数值。
|
2021-10-29 15:26:59 +08:00
|
|
|
|
3. 设定 PWM 通道默认输出的占空比,这里为 50% 。
|
|
|
|
|
4. 设定 GPT 通道下两个输出端口的使能状态。
|
|
|
|
|
5. 此处设置 GPT 通道下两个输出端口各自对应的引脚。
|
|
|
|
|
3. 配置输出引脚
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-10-29 15:26:59 +08:00
|
|
|
|
|
2021-11-03 20:40:06 +08:00
|
|
|
|
在完成上一步对 GPT 定时器的设置后,根据图示找到对应 GPT 通道输出引脚设置的界面(这里是 GPT3),将图中标号 **1** 处设置为 ``GTIOCA or GTIOCB`` ,并根据需要在图中标号 **2** 处设置 GPT 通道下两个输出端口各自对应的输出引脚。
|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
|
|
|
|
4. 在 menuconfig 中打开对应的通道,[RT-Thread 的 pwm 框架介绍](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/programming-manual/device/pwm/pwm)
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
|
|
|
|
### CAN
|
|
|
|
|
|
|
|
|
|
1. 添加CAN
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
|
|
|
|
2. 配置Callback为 `can0_callback` 或 `can1_callback`
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
|
|
|
|
3. 配置其他选项,并生成代码。
|
|
|
|
|
|
|
|
|
|
4. 使用ENV使能CAN。[CAN设备使用说明](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/programming-manual/device/can/can)
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
|
|
|
|
|
|
|
|
|
### SDHI
|
|
|
|
|
|
|
|
|
|
1. 添加sdhi驱动
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
1. 添加DMAC
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
2. 设置DMAC中断
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
3. 设置SDHI中断和引脚
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
4. 在ENV中打开SDHI
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
5. 在ENV中配置DFS,添加文件系统,如FatFS
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
6. 在命令行中,使用 `mkfs sd0 -t elm` 格式化sd卡
|
|
|
|
|
|
|
|
|
|
7. 在命令行中,使用 `mount sd0 / elm` 将sd0挂载到 `/`
|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|
8. 参考RT-Thread DFS使用手册[虚拟文件系统 (rt-thread.org)](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/programming-manual/filesystem/filesystem)
|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|
### WiFi 模块: [RW007 ](https://github.com/RT-Thread-packages/rw007)
|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|
1. 软件包配置中找到 RW007,并修改为下图配置。
|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
|
|
|
|
2. menuconfig 中打开驱动的 RW007 配置,默认使用了 SPI1 端口。所以需要打开 SPI1 总线。
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
|
|
|
|
3. 在设备驱动框架中打开 [WLAN 框架](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/programming-manual/device/wlan/wlan),
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
|
|
|
|
在网络配置中打开 NETDEV 组件:
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
|
|
|
|
在 kernel 中打开 mempool 配置:
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
|
|
|
|
4. FSP 中打开添加 SPI 外设端口,[如何添加SPI](#SPI)。下图以 SPI1 端口为例的配置如下:
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
|
|
|
|
5. RW007 有一个从机控制的 INT 引脚,需要占用一个 IRQ 通道,下图以 P506 为例的配置如下:
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
|
|
|
|
6. RW007 的 RESET 控制引脚修改默认配置,这里在 RASC 中 mode 设为关闭,交由 RW007 中进行控制。
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
|
|
|
|
7. 配置完成,检查 MDK 工程中是否加入了必要的文件
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
|
|
|
|
8. 编译下载,验证结果。
|
|
|
|
|
|
|
|
|
|
系统启动会自动获取 RW007 的信息,输入`wifi scan` 命令扫描环境中的 WiFi 信号。[更多 WiFi 命令](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/programming-manual/device/wlan/wlan?id=finsh-%e5%91%bd%e4%bb%a4)
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
|
|
|
|
使用 `WiFi join` 命令连接 WiFi 热点 :
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|
2021-11-04 20:31:55 +08:00
|
|
|
|
|
|
|
|
|
使用 `ping rt-thread.com` 测试网络连接:
|
|
|
|
|
|
2022-03-11 09:17:46 +08:00
|
|
|
|

|