PSADC 配置
5 Dec 2024
Read time: 2 minute(s)
内核配置
- 配置 IIO
在 Luban 根目录下执行 make menuconfig,进入配置,按如下选择:
ArtInChip Luban SDK Configuration Linux kernel Advance setting Linux Kernel Tools <*>iio
- 配置 PSADC
在 Luban 根目录下执行 make kernel-menuconfig,进入 kernel 的功能配置,按如下选择:
Linux Device Drivers <*> Industrial I/O support Analog to digital converters <*> ArtInChip PSADC driver
DTS 参数配置
- D211 配置在 common/d211.dtsi 中的 PSADC 控制器定义:
psadc: psadc@18210000 { compatible = "artinchip,aic-psadc-v1.0"; reg = <0x0 0x18210000 0x0 0x1000>; interrupts-extended = <&plic0 28 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cmu CLK_PSADC>, <&cmu CLK_APB0>; clock-names = "psadc", "pclk"; resets = <&rst RESET_PSADC>; #io-channel-cells = <1>; status = "disabled"; };
- Board 配置xxx/board.dts 中的参数配置需要区分通道号,每个通道可以单独使能。使能的通道,需要指定该通道用到的 GPIO 配置,如下面的
psadc5_pins
:&psadc { status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&psadc5_pins>; psadc0 { status = "disabled"; }; psadc1 { status = "disabled"; }; psadc2 { status = "disabled"; }; psadc3 { status = "disabled"; }; psadc4 { status = "disabled"; }; psadc5 { status = "disabled"; }; psadc6 { status = "okay"; }; psadc7 { status = "disabled"; }; psadc8 { status = "disabled"; }; psadc9 { status = "disabled"; }; psadc10 { status = "disabled"; }; psadc11 { status = "disabled"; }; };