ART-Pi RT-Thread Smart的RW007移植与使用
最近参加了 RT-Thread的活动,收到了官方寄过ART-Pi RT-Thread Smart开发板。因此特地开一栏来写一下测评心得。
测评环境:Ubuntu 20.04
sdk:ART-Pi-smart
测评第一期:RT-Thread Smart的RW007移植与使用
环境搭建:
1、在gitee下载sdk
git clone git@gitee.com:rtthread/ART-Pi-smart.git # 下载sdk
sudo apt-get install scons # 安装编译工具
2、进入ART-Pi-smart文件夹并且下载编译工具
cd ART-Pi-smart/tools
python3 get_toolchain.py #等待工具下载完成
cd .. #返回上一层文件
source smart-env.sh # 将工具链配置到bash环境
RW007移植
1、进入ART-Pi-smart/kernel/bsp/imx6ull-artpi-smart 目录并且打开配置界面
cd ART-Pi-smart/kernel/bsp/imx6ull-artpi-smart
scons --menuconfig
2、进行配置
第一步
RT-Thread Components --->
Device Drivers --->
-*-Using SPI Bus/Device device drivers
[ ] Enable QSPI mode
[ ] Using SD/TF card driver with spi
[ ] Using Serial Flash Universal Driver
[ ] Using ENC28J60 SPI Ethernet network interface
[*] Using RW009/007 SPI Wi-Fi wireless interface
选中 Using RW009/007 SPI Wi-Fi wireless interface
第二步
RT-Thread online packages --->
IoT - internet of things --->
Wi-Fi --->
[*] rw007: SPI WIFI rw007 driver --->
--- rw007: SPI WIFI rw007 driver
version (latest) ---> #版本选择 latest
example driver port (not use example driver, porting by myself) --->
#驱动接口选择 not use example driver, porting by myself ,官方这边已经提供了接口
(30000000) SPI Max Hz
第三步
Platform Driver Configuration --->
Select SPI Driver --->
[*] Enable SPI
[ ] Enable SPI1
[*] Enable SPI2
[ ] Enable SPI3
[ ] Enable SPI4
选中 Enable SPI2
完成以上三步,退出保存
3、下载rw007软件包
source ~/.env/env.sh #这一步是必须的,用于设置env环境
pkgs --update
4、编译
scons -c #清理
scons #编译
固件下载
1、启动开发板,在uboot倒计时,按下任意键打断倒计时,输入如下命令
dhcp 0x80001000 电脑端ip地址:rtthread.bin;dcache flush;go 0x80001000
2、下载成功之后就会出现如下信息
=> dhcp 0x80001000 xxxxxx:rtthread.bin;dcache flush;go 0x80001000
ethernet@02188000 Waiting for PHY auto negotiation to complete... done
BOOTP broadcast 1
DHCP client bound to address xxxxxxx (6 ms)
Using ethernet@02188000 device
TFTP from server xxxxx; our IP address is xxxxx
Filename 'rtthread.bin'.
Load address: 0x80001000
Loading: #################################################################
###############
1.4 MiB/s
done
Bytes transferred = 1160912 (11b6d0 hex)
## Starting application at 0x80001000 ...
\ | /
- RT - Thread Smart Operating System
/ | \ 5.0.0 build May 24 2022
2006 - 2020 Copyright by rt-thread team
lwIP-2.1.2 initialized!
[14] D/drv.enet: UNIQUE_ID is 5d4fbd0a291d41d7
[18] D/drv.enet: UNIQUE_ID change to 32 bits 34327b33
[24] E/drv.enet: emac device init success
[29] I/I2C: I2C bus [i2c3] registered
[33] I/I2C: I2C bus [i2c4] registered
[82] I/SDIO: SD card capacity 30868480 KB.
found part[0], begin: 4194304, size: 29.445GB
[97] E/drv.enet: PHY Link down, please check the cable connection and link partner setting.
[146] I/SDIO: emmc card capacity 3817472 KB.
[163] I/touch: rt_touch init success
[167] I/gt911: touch device gt911 init success
[172] I/sal.skt: Socket Abstraction Layer initialize success.
emmc file system initialization done!
sd0 file system initialization done!
open em failed!
/sd/wifi.sh wi-fi configuration file not exist in sd card!
[4197] E/[RW007]: The wifi Stage 1 status 0 0 0 1
[4204] I/WLAN.dev: wlan init success
[4209] I/WLAN.lwip: eth device init ok name:w0
[4214] I/WLAN.dev: wlan init success
[4219] I/WLAN.lwip: eth device init ok name:w1
rw007 sn: [rw00700000000fc584a2c4f65]
rw007 ver: [RW007_2.1.0-a7a0d089-57]
hello rt-smart
msh />[5073] D/drv.enet: enet1 link up
#输入wifi,出现以下参数,表示移植成功
msh />wifi
wifi
wifi help
wifi scan [SSID]
wifi join [SSID] [PASSWORD]
wifi ap SSID [PASSWORD]
wifi disc
wifi ap_stop
wifi status
wifi smartconfig
msh />
至此移植完毕
途中可能会出现 spi_wifi_int_cmd 错误,只需找到 kernel/components/spi下的spi_wifi_rw009.c和spi_wifi_rw009.h两个文件,将该两个文件内容注释即可