Edit online

测试指南

测试环境
  • 硬件:开发板
  • 软件:
    • PC 端的串口终端软件,用于 PC 和开发板进行串口通信
    • test_psadc 测试程序

test_psadc 测试

  1. 在 Luban-Lite 根目录下执行 scons --menuconfig,进入 menuconfig 的功能配置界面,按如下选择:

    Drivers options  --->
        Drivers examples  --->
            [*] Enable PSADC driver test command
    
  2. 在打开 psadc 的编译后,板子上可直接运行 psadc 命令:

    aic /> test_psadc -h
    Compile time: Jul 26202308:20:53
    Usage: test_psadc [options]:
         -c, --channel        Select one channel in[0, 11], default is 0
         -t, --voltage        Input standard voltage, default is 3
         -h, --help
    
    Example: test_psadc -c 4 -t 3

ADC 读取测试

ADC 数据的读取可以使用 shell 命令 test_psadc ,每次可读取某一个通道中的当前数据。

aic /> test_psadc -c 4
PSADC ch4: 2432
PSADC ch4-voltage: 1.78 # 未设置标准电压时,采用默认电压 3V 进行计算
aic /> test_psadc -c 0[W] hal_psadc_ch_is_valid()320 Ch0 is unavailable! # PSADC0 通道没有打开
aic /> test_psadc -c 4 -t 6
PSADC ch4: 2432
PSADC ch4-voltage: 3.56
aic /> test_psadc -t 6
Please select a channel first # 设置标准电压前,需通过-c 选择通道