milkv-duo设备上NS2009 驱动配置
NS2009设备中断使用的是GPIOE(GPIO4)的第26脚。这里需要修改Uboot启动配置为GPIO
修改/home/watrt/duo-buildroot-sdk/build/boards/cv180x/cv1800b_milkv_duo_sd/u-boot/cvi_board_init.c文件添加引脚配置
int cvi_board_init(void) { // sensor mclk reset PINMUX_CONFIG(PAD_MIPIRX0P, CAM_MCLK0); // Camera MCLK0 PINMUX_CONFIG(PAD_MIPIRX1N, XGPIOC_8); // Camera Reset // all default gpio PINMUX_CONFIG(SD0_PWR_EN, XGPIOA_14); // Duo Pin 19 PINMUX_CONFIG(SPK_EN, XGPIOA_15); // Duo Pin 20 PINMUX_CONFIG(SPINOR_MISO, XGPIOA_23); // Duo Pin 21 PINMUX_CONFIG(SPINOR_CS_X, XGPIOA_24); // Duo Pin 22 PINMUX_CONFIG(SPINOR_SCK, XGPIOA_22); // Duo Pin 24 PINMUX_CONFIG(SPINOR_MOSI, XGPIOA_25); // Duo Pin 25 PINMUX_CONFIG(SPINOR_WP_X, XGPIOA_27); // Duo Pin 26 这里上NS2009的中断脚 PINMUX_CONFIG(SPINOR_HOLD_X, XGPIOA_26); // Duo Pin 27 PINMUX_CONFIG(PWR_SEQ2, PWR_GPIO_4); // Duo Pin 29 // ADC pins set to gpio PINMUX_CONFIG(ADC1, XGPIOB_3); // ADC1 PINMUX_CONFIG(USB_VBUS_DET, XGPIOB_6); // ADC2 // I2C0 PINMUX_CONFIG(IIC0_SCL, IIC0_SCL); PINMUX_CONFIG(IIC0_SDA, IIC0_SDA); // I2C1 PINMUX_CONFIG(PAD_MIPIRX1P, IIC1_SDA); PINMUX_CONFIG(PAD_MIPIRX0N, IIC1_SCL); // PWM PINMUX_CONFIG(SD1_D2, PWM_5); PINMUX_CONFIG(SD1_D1, PWM_6); // UART 4 PINMUX_CONFIG(SD1_GPIO1, UART4_TX); PINMUX_CONFIG(SD1_GPIO0, UART4_RX); // SPI PINMUX_CONFIG(SD1_CLK, SPI2_SCK); PINMUX_CONFIG(SD1_CMD, SPI2_SDO); PINMUX_CONFIG(SD1_D0, SPI2_SDI); PINMUX_CONFIG(SD1_D3, SPI2_CS_X); pinmux_config(PINMUX_SPI2); return 0; }
添加设备树/home/watrt/duo-buildroot-sdk/build/boards/cv180x/cv1800b_milkv_duo_sd/dts_riscv/cv1800b_milkv_duo_sd.dts:
&i2c0 { status = "okay"; ns2009: ns2009@48 { //compatible = "nsiway,ns2009"; compatible = "ti,tsc2007"; ti,x-plate-ohms = <180>; interrupt-parent = <&porte>; interrupts = <26 IRQ_TYPE_EDGE_FALLING>; gpios = <&porte 26 GPIO_ACTIVE_HIGH>; reg = <0x48>; }; };
中断设备修改/home/watrt/duo-buildroot-sdk/build/boards/default/dts/cv180x_riscv/cv180x_base_riscv.dtsi:
gpio4: gpio@05021000 { porte: gpio-controller@4 { interrupt-controller; interrupts = <70 IRQ_TYPE_LEVEL_HIGH>; interrupt-parent = <&plic0>; #interrupt-cells = <2>; }; };
修改设备树cv180x_base_riscv.dtsi文件添加:
#interrupt-cells = <2>; 这里如果不添加设备的中断会失败
然后在buildroot添加tslib库的支持
Target packages ---> Libraries ---> Hardware handling ---> [*] tslib
启动后运行:
export TSLIB_TSDEVICE=/dev/input/event0 export TSLIB_CALIBFILE=/etc/pointercal export TSLIB_CONFFILE=/etc/ts.conf export TSLIB_PLUGINDIR=/usr/lib/ts export TSLIB_CONSOLEDEVICE=none export TSLIB_FBDEVICE=/dev/fb0
校准触摸屏
ts_calibrate