Skip to content

Input: Issue with multiple inputs are enabled #90779

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
AnkyXCoder opened this issue May 29, 2025 · 3 comments
Open

Input: Issue with multiple inputs are enabled #90779

AnkyXCoder opened this issue May 29, 2025 · 3 comments
Assignees
Labels
area: LVGL Light and Versatile Graphics Library Support bug The issue is a bug, or the PR is fixing a bug platform: ESP32 Espressif ESP32 priority: low Low impact/importance bug

Comments

@AnkyXCoder
Copy link

AnkyXCoder commented May 29, 2025

Describe the bug

Problem:
Observation 1:
When using multiple input devices a.) a touch controller - LVGL Pointer and b.) an encoder - LVGL Encoder are enabled with LVGL on ESP32-S3-DevKitC-1, device is not booting up or gets stuck on the boot-up.
Observation 2:
When only one of the inputs is enabled at a time, either only LVGL Pointer or LVGL Encoder is enabled, the device works as expected.
Observation 3:
When Input Touch Controller's Interrupt configuration (for example CONFIG_INPUT_CST816S_INTERRUPT=y, CONFIG_INPUT_FT5336_INTERRUPT=y) is enabled.
On input to Touch Panel, an interrupt should be generated. But it is not generating and hence, the work is not getting submitted to process the event.
Observation 4:
When only LVGL Pointer is enabled and Interrupt Configuration is disabled (for example CONFIG_INPUT_CST816S_INTERRUPT=n, CONFIG_INPUT_FT5336_INTERRUPT=n), then with the changes and configuration mentioned below, the Keypad and Encoder Demo works as expected.

Steps to reproduce

Necessary changes added:
Updated modules/lib/gui/lvgl/demos/keypad_encoder/lv_demo_keypad_encoder.c to accept Touch Inputs by adding LV_INDEV_TYPE_POINTER to group.
Selected LV_Z_DEMO_KEYPAD_AND_ENCODER as default values for LV_Z_DEMO choice in samples/modules/lvgl/demos/Kconfig.
Added/Updated board specific overlay file:

/dts-v1/;
#include <espressif/esp32s3/esp32s3_r2.dtsi>
#include "esp32s3_touch_lcd-pinctrl.dtsi"
#include <zephyr/dt-bindings/display/panel.h>
#include <zephyr/dt-bindings/input/input-event-codes.h>
#include <zephyr/dt-bindings/pwm/pwm.h>
/ {
	model = "Espressif ESP32S3-DevkitC PROCPU";
	compatible = "espressif,esp32s3";
	aliases {
		i2c-1 = &i2c1;
		pwm-0 = &ledc0;
		pwm-lcd0 = &pwm_lcd0;
		sw0 = &button0;
		uart-0 = &uart0;
		watchdog0 = &wdt0;
	};
	chosen {
		zephyr,sram = &sram0;
		zephyr,console = &uart0;
		zephyr,shell-uart = &uart0;
		zephyr,flash = &flash0;
		zephyr,code-partition = &slot0_partition;
		zephyr,display = &gc9a01;
		zephyr,bt-hci = &esp32_bt_hci;
		zephyr,touch = &cst816s;
	};
	/* Buttons */
	buttons {
		compatible = "gpio-keys";
		button0: button_0 {
			gpios = <&gpio0 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
			label = "BOOT Button";
			zephyr,code = <INPUT_KEY_0>;
		};
	};
	/* Touch Controller */
	lvgl_pointer {
		compatible = "zephyr,lvgl-pointer-input";
		input = <&cst816s>;
        status = "okay";
	};
	/* Encoder Controller */
	lvgl_encoder {
		compatible = "zephyr,lvgl-encoder-input";
		status = "disabled";
        rotation-input-code = <INPUT_REL_Y>;
        button-input-code = <INPUT_KEY_1>;
        gpio_encoder {
            compatible = "gpio-qdec";
            status = "disabled";
            gpios = <&gpio0 35 (GPIO_PULL_UP | GPIO_ACTIVE_HIGH)>,
                    <&gpio0 36 (GPIO_PULL_UP | GPIO_ACTIVE_HIGH)>;
          steps-per-period = <20>;
          zephyr,axis = <INPUT_REL_WHEEL>;
          sample-time-us = <5000>;
          idle-timeout-ms = <100>;
        };
	};
	/* PWM */
	pwmleds {
		compatible = "pwm-leds";
		pwm_lcd0: pwm_lcd0 {
			pwms = <&ledc0 2 PWM_HZ(250) PWM_POLARITY_NORMAL>;
		};
	};
	/* MIPI DBI */
	mipi_dbi {
		compatible = "zephyr,mipi-dbi-spi";
		spi-dev = <&spi2>;
		dc-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
		reset-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
		write-only;
		#address-cells = <1>;
		#size-cells = <0>;
		gc9a01: gc9a01@0 {
			status = "okay";
			compatible = "galaxycore,gc9x01x";
			reg = <0>;
			mipi-max-frequency = <100000000>;
			pixel-format = <PANEL_PIXEL_FORMAT_RGB_565>;
			display-inversion;
			width = <240>;
			height = <240>;
		};
	};
};
&pinctrl {
	i2c1_default: i2c1_default {
		group1 {
			pinmux = <I2C1_SDA_GPIO6>, <I2C1_SCL_GPIO7>;
			bias-pull-up;
			drive-open-drain;
			output-high;
		};
	};
	ledc0_default: ledc0_default {
		group1 {
			pinmux = <LEDC_CH2_GPIO4>;
			output-enable;
		};
	};
	spim2_default: spim2_default {
		group1 {
			pinmux = <SPIM2_MISO_GPIO12>, <SPIM2_SCLK_GPIO10>, <SPIM2_CSEL_GPIO9>;
		};
		group2 {
			pinmux = <SPIM2_MOSI_GPIO11>;
			output-low;
		};
	};
};
&i2c1 {
	status ="okay";
	clock-frequency = <I2C_BITRATE_STANDARD>;
	pinctrl-0 = <&i2c1_default>;
	pinctrl-names = "default";
	/* Hynitron CST816S Capacitive Touch Controller */
	cst816s: cst816s@15 {
		status = "okay";
		compatible = "hynitron,cst816s";
		reg = <0x15>;
		irq-gpios = <&gpio0 5 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
		rst-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
	};
};
&ledc0 {
	status = "okay";
	pinctrl-0 = <&ledc0_default>;
	pinctrl-names = "default";
	#address-cells = <1>;
	#size-cells = <0>;
	channel2@2 {
		reg = <0x2>;
		timer = <2>;
	};
};
&spi2 {
	status = "okay";
	#address-cells = <1>;
	#size-cells = <0>;
	pinctrl-0 = <&spim2_default>;
	pinctrl-names = "default";
	cs-gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;
};

Following is the prj.conf:


CONFIG_GPIO=y
CONFIG_I2C=y
CONFIG_SPI=y
CONFIG_PWM=y
CONFIG_TEST_RANDOM_GENERATOR=y

CONFIG_MAIN_STACK_SIZE=8192
CONFIG_HEAP_MEM_POOL_SIZE=10240

CONFIG_LOG=y
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_SHELL=y

CONFIG_LVGL=y
CONFIG_LV_Z_MEM_POOL_SIZE=49152

CONFIG_DISPLAY=y
CONFIG_INPUT=y
CONFIG_INPUT_CST816S=y
CONFIG_INPUT_CST816S_INTERRUPT=y

CONFIG_REGULATOR=y
CONFIG_ENTROPY_GENERATOR=y
CONFIG_KERNEL_MEM_POOL=y

CONFIG_LV_COLOR_16_SWAP=y

CONFIG_LV_USE_FONT_COMPRESSED=y
CONFIG_LV_FONT_MONTSERRAT_12=y
CONFIG_LV_FONT_MONTSERRAT_14=y
CONFIG_LV_FONT_MONTSERRAT_16=y

CONFIG_LV_USE_THEME_DEFAULT=y

Build and Flash sample application.

Impact

Major – Severely degrades functionality; workaround is difficult or unavailable.

Environment

  • OS: Linux
  • Zephyr Version: 4.1.0
  • Zephyr SDK: 0.17.0

Additional Context

No response

@AnkyXCoder AnkyXCoder added the bug The issue is a bug, or the PR is fixing a bug label May 29, 2025
Copy link

Hi @AnkyXCoder! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙

@faxe1008 faxe1008 added the area: LVGL Light and Versatile Graphics Library Support label May 29, 2025
@faxe1008 faxe1008 added the platform: ESP32 Espressif ESP32 label May 29, 2025
@faxe1008
Copy link
Collaborator

faxe1008 commented May 30, 2025

Observation 1:
When using multiple input devices a.) a touch controller - LVGL Pointer and b.) an encoder - LVGL Encoder are enabled with LVGL on ESP32-S3-DevKitC-1, device is not booting up or gets stuck on the boot-up.

Can you attach a debugger and check for hard faults?

Observation 3:
When Input Touch Controller's Interrupt configuration (for example CONFIG_INPUT_CST816S_INTERRUPT=y, CONFIG_INPUT_FT5336_INTERRUPT=y) is enabled.
On input to Touch Panel, an interrupt should be generated. But it is not generating and hence, the work is not getting submitted to process the event.

That is confusing to me. The input drivers usually support interrupt mode or polling. If you disable interrupt mode or not hook up the interrupt pin, of course there will not be any interrupts. From the viewpoint of LVGL it does not matter from which mode the events are emitted. You can add CONFIG_INPUT_EVENT_DUMP to add logging of any raised events.

I just tested the demo on the native sim and a mimxrt1060 with a gt911 touch driver, and it works as expected.

EDIT:// Maybe there are exotic quirks with the way you assigned your pins?

@AnkyXCoder
Copy link
Author

Can you attach a debugger and check for hard faults?

I don't have a debugger but as per the logs, the device gets stuck on the boot-up only and there are no log prints or shell showing up.

That is confusing to me. The input drivers usually support interrupt mode or polling. If you disable interrupt mode or not hook up the interrupt pin, of course there will not be any interrupts. From the viewpoint of LVGL it does not matter from which mode the events are emitted. You can add CONFIG_INPUT_EVENT_DUMP to add logging of any raised events.

As mentioned in the observations and attached overlay file, all the pins for Touch Controller are properly configured and not conflicting with other peripherals. Also, to mention that, when LVGL Encoder node is disabled, then the same code and sample works with the Touch Controller Interrupt configuration enabled.

@danieldegrasse danieldegrasse added the priority: low Low impact/importance bug label Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: LVGL Light and Versatile Graphics Library Support bug The issue is a bug, or the PR is fixing a bug platform: ESP32 Espressif ESP32 priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

3 participants