调试指南
pin 调试命令
Luban-Lite 把通用 GPIO 功能注册成了标准的 rt-thread pin driver,所以我们可以通过 msh 命令行下的
pin
命令来调试:
aic /> pin pin [option] num: get pin number from hardware pin num can be PE02, PE2, PE.02, PE.2, pe02, pe2, pe.02, pe.2 e.g. MSH >pin num PA.16 // 获取 gpio id 编号 mode: set pin mode to output/input/input_pullup/input_pulldown/output_od e.g. MSH >pin mode PA.16 output // 设置 gpio 工作模式 read: read pin level of hardware pin e.g. MSH >pin read PA.16 // 读取 gpio pin 管脚电平状态 write: write pin level(high/low or on/off) to hardware pin e.g. MSH >pin write PA.16 high // 设置 gpio pin 管脚电平状态 help: this help list
读写寄存器
对于没有封装专有调试命令的功能,最直接的方式就是使用 msh 命令行下的 p
和 m
来读写寄存器,对照芯片手册来核对配置:
aic /> p 0x18700000 // 读 gpio 寄存器 18700000: 0000010000000100000002000000010118700010: 0000000000000000000000000000000018700020: 0000000000000000000000000000000018700030: 00000000000000000000000000000000 aic /> m 0x18700004 0x101 // 写 gpio 寄存器 value on 18700004 change from 0x100 to 0x101.