I have problem with i2c that can't read the cst816s, its always return log message `<err> cst816s: failed reading chip id` and `<err> cst816s: Could not read x data` when touched. i'm using the nRF52832. is there any configuration i need to do?
the board device tree:
/dts-v1/; #include <nordic/nrf52832_qfaa.dtsi> ... &flash0 { partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; boot_partition: partition@0 { label = "mcuboot"; reg = <0x00000000 DT_SIZE_K(48)>; }; slot0_partition: partition@c000 { label = "image-0"; reg = <0x0000c000 DT_SIZE_K(220)>; }; slot1_partition: partition@43000 { label = "image-1"; reg = <0x00043000 DT_SIZE_K(220)>; }; storage_partition: partition@7a000 { label = "storage"; reg = <0x0007a000 DT_SIZE_K(24)>; }; }; }; &gpio0 { status = "okay"; }; &gpiote { status = "okay"; }; &rtc2 { status = "okay"; }; &uart0 { status = "okay"; pinctrl-0 = <&uart0_default>; pinctrl-1 = <&uart0_sleep>; pinctrl-names = "default", "sleep"; current-speed = <115200>; }; &i2c1 { status = "okay"; pinctrl-0 = <&i2c1_default>; pinctrl-1 = <&i2c1_sleep>; pinctrl-names = "default", "sleep"; };
the pinctrl file:
&pinctrl { uart0_default: uart0_default { group1 { psels = <NRF_PSEL(UART_TX, 0, 24)>, <NRF_PSEL(UART_RX, 0, 23)>; }; }; uart0_sleep: uart0_sleep { group1 { psels = <NRF_PSEL(UART_TX, 0, 24)>, <NRF_PSEL(UART_RX, 0, 23)>; low-power-enable; }; }; spi0_default: spi0_default { group1 { psels = <NRF_PSEL(SPIM_MOSI, 0, 29)>, <NRF_PSEL(SPIM_SCK, 0, 28)>; }; }; spi0_sleep: spi0_sleep { group1 { psels = <NRF_PSEL(SPIM_MOSI, 0, 29)>, <NRF_PSEL(SPIM_SCK, 0, 28)>; low-power-enable; }; }; i2c1_sleep: i2c1_sleep { group1 { psels = <NRF_PSEL(TWIM_SDA, 0, 9)>, <NRF_PSEL(TWIM_SCL, 0, 10)>; low-power-enable; }; }; i2c1_default: i2c1_default { group1 { psels = <NRF_PSEL(TWIM_SDA, 0, 9)>, <NRF_PSEL(TWIM_SCL, 0, 10)>; }; }; };
the overlay file:
/ { chosen { zephyr,display = &display; zephyr,keyboard-scan = &touch_screen; }; aliases { input = &touch_screen; }; leds { compatible = "gpio-leds"; lcd_backlight: lcd_backlight { gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; label = "LCD Backlight"; }; }; lvgl_pointer_input:lvgl_pointer { compatible = "zephyr,lvgl-pointer-input"; input = <&touch_screen>; }; }; &spi0 { compatible = "nordic,nrf-spim"; status = "okay"; pinctrl-0 = <&spi0_default>; pinctrl-1 = <&spi0_sleep>; pinctrl-names = "default", "sleep"; cs-gpios = <&gpio0 30 GPIO_ACTIVE_LOW>; display: st7789v@0 { label = "ST7789 Display"; compatible = "sitronix,st7789v"; spi-max-frequency = <20000000>; reg = <0>; cmd-data-gpios = < &gpio0 27 GPIO_ACTIVE_LOW>; reset-gpios = < &gpio0 31 GPIO_ACTIVE_LOW>; width = <240>; height = <240>; x-offset = <0>; y-offset = <0>; vcom = <0x19>; gctrl = <0x35>; vrhs = <0x12>; vdvs = <0x20>; mdac = <0x00>; gamma = <0x01>; colmod = <0x05>; lcm = <0x2c>; porch-param = [0c 0c 00 33 33]; cmd2en-param = [5a 69 02 01]; pwctrl1-param = [a4 a1]; pvgam-param = [D0 04 0D 11 13 2B 3F 54 4C 18 0D 0B 1F 23]; nvgam-param = [D0 04 0C 11 13 2C 3F 44 51 2F 1F 1F 20 23]; ram-param = [00 F0]; rgb-param = [CD 08 14]; }; }; &i2c1 { clock-frequency = <I2C_BITRATE_FAST>; touch_screen: cst186s@15 { label = "CST816S Touch Screen"; status = "okay"; compatible = "hynitron,cst816s"; reg = <0x15>; irq-gpios = <&gpio0 26 GPIO_ACTIVE_LOW>; rst-gpios = <&gpio0 21 GPIO_ACTIVE_LOW>; }; };