I have an ILI9340 connected to an nRF53 and want to use LVGL in Zephyr (NCS 2.6.1), but I got no label, etc. showing up. Instead, the display is showing a white screen.
I´m wondering about what can be wrong here. It´s similar to the examples so it should work. Can someone help me with this issue?
Thanks!
#include <zephyr/dt-bindings/display/ili9xxx.h>
/ {
chosen {
zephyr,display = &display;
};
};
&pinctrl {
spi4_default: spi4_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 5)>,
<NRF_PSEL(SPIM_MOSI, 0, 4)>;
};
};
spi4_sleep: spi4_sleep {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 5)>,
<NRF_PSEL(SPIM_MOSI, 0, 4)>;
low-power-enable;
};
};
};
&spi4 {
status = "okay";
compatible = "nordic,nrf-spim";
pinctrl-0 = <&spi4_default>;
pinctrl-1 = <&spi4_sleep>;
pinctrl-names = "default", "sleep";
cs-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
display: ili9340@0 {
compatible = "ilitek,ili9340";
spi-max-frequency = <1000000>;
reg = <0>;
width = <240>;
height = <320>;
reset-gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
cmd-data-gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
};
};
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/logging/log.h>
#include <zephyr/drivers/display.h>
#include <lvgl.h>
#include <stdio.h>
#include <string.h>
LOG_MODULE_REGISTER(app);
static lv_obj_t *root_screen;
static lv_obj_t *hello_world_label;
static const struct device *display_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_display));
int main(void)
{
if(!device_is_ready(display_dev)) {
LOG_ERR("Display not ready!");
return -1;
}
display_blanking_off(display_dev);
root_screen = lv_scr_act();
hello_world_label = lv_btn_create(root_screen);
lv_label_set_text(hello_world_label, "Hello world!");
lv_obj_align(hello_world_label, LV_ALIGN_CENTER, 0, 0);
while(1) {
LOG_ERR("Done");
k_msleep(100);
}
}
CONFIG_HEAP_MEM_POOL_SIZE=32000 CONFIG_MAIN_STACK_SIZE=2048 CONFIG_SPI=y CONFIG_DISPLAY=y CONFIG_DISPLAY_LOG_LEVEL_ERR=y CONFIG_LOG=y CONFIG_DEBUG_OPTIMIZATIONS=y CONFIG_USE_SEGGER_RTT=y CONFIG_LOG_BACKEND_RTT=y CONFIG_LOG_BACKEND_RTT_MODE_BLOCK=y CONFIG_LOG_BUFFER_SIZE=4096 CONFIG_LOG_BACKEND_RTT_OUTPUT_BUFFER_SIZE=128 CONFIG_LOG_BLOCK_IN_THREAD=y CONFIG_LVGL=y CONFIG_LV_USE_LOG=y CONFIG_LV_Z_FLUSH_THREAD=y CONFIG_LV_Z_FLUSH_THREAD_PRIO=0 CONFIG_LV_Z_MEM_POOL_SIZE=128000