Edit online

测试指南

23 Dec 2024
Read time: 2 minute(s)
测试环境
  • 硬件:开发板
  • 软件:
    • PC 端的串口终端软件,用于 PC 和开发板进行串口通信
    • test_psadc 测试程序

test_psadc 测试

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

    Drivers options  --->
        Drivers examples  --->
            [*] Enable PSADC driver test command
    
  2. test_psadc 测试:根据不同的开发环境,在打开 PSADC 的编译后,板子上可直接运行相应的 psadc 命令:
    • RTOS 开发环境:
      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
    • Baremetal 开发环境
      test_psadc help
      Compile time: May 29 2024 13:23:14
      Usage: test_psadc [options]
      test_psadc read                       : Get the adc value
      test_psadc modify <standard voltage>  : Modify standard voltage, default is 3
      test_psadc status                     : Check the psadc status
      test_psadc help                       : Get this help
      示例:
      test_psadc read
  3. ADC 读取测试:ADC 数据的读取可以使用 shell 命令 test_psadc ,每次可读取某一个通道中的当前数据。
    • RTOS 开发环境
      test_psadc -s
      In PSADC V1.01
      enabled 3 channels: [5] [6] [7]
      • 未设置 adc 基准参考电压时,采用 adc 基准参考电压为 3V 进行计算
        test_psadc -t 3
      • 未设置采样次数时,默认采样 10 次:
        test_psadc -n 2
      • test_psadc -r
        Start samplng 2 samples for 3 channels
        Sample time: 11 us
        [1] PSADC:  4095 976 833  # ADC 值依次是所设置通道(从小到大排序[5][6][7]通道)的采样值
        voltage:  3. 0v 0.71v 0.61v # 同理,该电压值依次是[5][6][7]通道的电压
        Sample time: 10 us
        [2] PSADC:  4095 907 750
        voltage:  3. 0v 0.66v 0.54v
        Sample time: 10 us
    • Baremetal 开发环境
      test_psadc status
      In PSADC V1.01
      enabled 3 channels: [5] [6] [7]

      未设置 adc 基准参考电压时,采用 adc 基准参考电压为 3V 进行计算:

      test_psadc modify 3
      test_psadc read
      Start samplng for 3 channels
      Sample time: 11 us
      [1] PSADC:  4095 976 833  # ADC 值依次是所设置通道(从小到大排序[5][6][7]通道)的采样值
      voltage:  3. 0v 0.71v 0.61v # 同理,该电压值依次是[5][6][7]通道的电压
      Sample time: 10 us
      [2] PSADC:  4095 907 750
      voltage:  3. 0v 0.66v 0.54v
      Sample time: 10 us