Description
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