What do you want to achieve?
Hello, I am using the nRF54L15 board (Zephyr OS), and trying to connect to the Adafruit SHARP 400x240 monochrome LCD display. I actually have no problem linking the display to LVGL, that seems to be fine. What I have found that the problem is, is that the screen is completely blank when I try to send anything.
I have found when debugging that this is not an issue between LVGL and the LCD, but instead the data buffer which contains the pixel map is actually just empty. 0x00 across the board. My question is, what is the function in which the pixel buffer is actually generated, so I can see where the problem lies.
Otherwise, is there a config setting (or lack thereof) that is screwing me over?
Thanks.
Code to reproduce
The code is taken from a sample as well, so my confusion is greater.
/*
* Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/display.h>
#include <zephyr/drivers/gpio.h>
#include <lvgl.h>
#include <stdio.h>
#include <string.h>
#include <zephyr/kernel.h>
#include <lvgl_input_device.h>
#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(app);
static uint32_t count;
#ifdef CONFIG_RESET_COUNTER_SW0
static struct gpio_dt_spec button_gpio = GPIO_DT_SPEC_GET_OR(
DT_ALIAS(sw0), gpios, {0});
static struct gpio_callback button_callback;
static void button_isr_callback(const struct device *port,
struct gpio_callback *cb,
uint32_t pins)
{
ARG_UNUSED(port);
ARG_UNUSED(cb);
ARG_UNUSED(pins);
count = 0;
}
#endif /* CONFIG_RESET_COUNTER_SW0 */
#ifdef CONFIG_LV_Z_ENCODER_INPUT
static const struct device *lvgl_encoder =
DEVICE_DT_GET(DT_COMPAT_GET_ANY_STATUS_OKAY(zephyr_lvgl_encoder_input));
#endif /* CONFIG_LV_Z_ENCODER_INPUT */
#ifdef CONFIG_LV_Z_KEYPAD_INPUT
static const struct device *lvgl_keypad =
DEVICE_DT_GET(DT_COMPAT_GET_ANY_STATUS_OKAY(zephyr_lvgl_keypad_input));
#endif /* CONFIG_LV_Z_KEYPAD_INPUT */
static void lv_btn_click_callback(lv_event_t *e)
{
ARG_UNUSED(e);
count = 0;
}
int main(void)
{
char count_str[11] = {0};
const struct device *display_dev;
lv_obj_t *hello_world_label;
lv_obj_t *count_label;
display_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_display));
if (!device_is_ready(display_dev)) {
LOG_ERR("Device not ready, aborting test");
return 0;
}
#ifdef CONFIG_RESET_COUNTER_SW0
if (gpio_is_ready_dt(&button_gpio)) {
int err;
err = gpio_pin_configure_dt(&button_gpio, GPIO_INPUT);
if (err) {
LOG_ERR("failed to configure button gpio: %d", err);
return 0;
}
gpio_init_callback(&button_callback, button_isr_callback,
BIT(button_gpio.pin));
err = gpio_add_callback(button_gpio.port, &button_callback);
if (err) {
LOG_ERR("failed to add button callback: %d", err);
return 0;
}
err = gpio_pin_interrupt_configure_dt(&button_gpio,
GPIO_INT_EDGE_TO_ACTIVE);
if (err) {
LOG_ERR("failed to enable button callback: %d", err);
return 0;
}
}
#endif /* CONFIG_RESET_COUNTER_SW0 */
#ifdef CONFIG_LV_Z_ENCODER_INPUT
lv_obj_t *arc;
lv_group_t *arc_group;
arc = lv_arc_create(lv_screen_active());
lv_obj_align(arc, LV_ALIGN_CENTER, 0, -15);
lv_obj_set_size(arc, 150, 150);
arc_group = lv_group_create();
lv_group_add_obj(arc_group, arc);
lv_indev_set_group(lvgl_input_get_indev(lvgl_encoder), arc_group);
#endif /* CONFIG_LV_Z_ENCODER_INPUT */
#ifdef CONFIG_LV_Z_KEYPAD_INPUT
lv_obj_t *btn_matrix;
lv_group_t *btn_matrix_group;
static const char *const btnm_map[] = {"1", "2", "3", "4", ""};
btn_matrix = lv_buttonmatrix_create(lv_screen_active());
lv_obj_align(btn_matrix, LV_ALIGN_CENTER, 0, 70);
lv_buttonmatrix_set_map(btn_matrix, (const char **)btnm_map);
lv_obj_set_size(btn_matrix, 100, 50);
btn_matrix_group = lv_group_create();
lv_group_add_obj(btn_matrix_group, btn_matrix);
lv_indev_set_group(lvgl_input_get_indev(lvgl_keypad), btn_matrix_group);
#endif /* CONFIG_LV_Z_KEYPAD_INPUT */
if (IS_ENABLED(CONFIG_LV_Z_POINTER_INPUT)) {
lv_obj_t *hello_world_button;
hello_world_button = lv_button_create(lv_screen_active());
lv_obj_align(hello_world_button, LV_ALIGN_CENTER, 0, -15);
lv_obj_add_event_cb(hello_world_button, lv_btn_click_callback, LV_EVENT_CLICKED,
NULL);
hello_world_label = lv_label_create(hello_world_button);
} else {
hello_world_label = lv_label_create(lv_screen_active());
}
lv_label_set_text(hello_world_label, "Hello world!");
lv_obj_align(hello_world_label, LV_ALIGN_CENTER, 0, 0);
count_label = lv_label_create(lv_screen_active());
lv_obj_align(count_label, LV_ALIGN_BOTTOM_MID, 0, 0);
lv_timer_handler();
display_blanking_off(display_dev);
while (1) {
if ((count % 100) == 0U) {
sprintf(count_str, "%d", count/100U);
lv_label_set_text(count_label, count_str);
}
lv_timer_handler();
++count;
k_sleep(K_MSEC(10));
}
}
prj.conf
/*
* Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/display.h>
#include <zephyr/drivers/gpio.h>
#include <lvgl.h>
#include <stdio.h>
#include <string.h>
#include <zephyr/kernel.h>
#include <lvgl_input_device.h>
#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(app);
static uint32_t count;
#ifdef CONFIG_RESET_COUNTER_SW0
static struct gpio_dt_spec button_gpio = GPIO_DT_SPEC_GET_OR(
DT_ALIAS(sw0), gpios, {0});
static struct gpio_callback button_callback;
static void button_isr_callback(const struct device *port,
struct gpio_callback *cb,
uint32_t pins)
{
ARG_UNUSED(port);
ARG_UNUSED(cb);
ARG_UNUSED(pins);
count = 0;
}
#endif /* CONFIG_RESET_COUNTER_SW0 */
#ifdef CONFIG_LV_Z_ENCODER_INPUT
static const struct device *lvgl_encoder =
DEVICE_DT_GET(DT_COMPAT_GET_ANY_STATUS_OKAY(zephyr_lvgl_encoder_input));
#endif /* CONFIG_LV_Z_ENCODER_INPUT */
#ifdef CONFIG_LV_Z_KEYPAD_INPUT
static const struct device *lvgl_keypad =
DEVICE_DT_GET(DT_COMPAT_GET_ANY_STATUS_OKAY(zephyr_lvgl_keypad_input));
#endif /* CONFIG_LV_Z_KEYPAD_INPUT */
static void lv_btn_click_callback(lv_event_t *e)
{
ARG_UNUSED(e);
count = 0;
}
int main(void)
{
char count_str[11] = {0};
const struct device *display_dev;
lv_obj_t *hello_world_label;
lv_obj_t *count_label;
display_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_display));
if (!device_is_ready(display_dev)) {
LOG_ERR("Device not ready, aborting test");
return 0;
}
#ifdef CONFIG_RESET_COUNTER_SW0
if (gpio_is_ready_dt(&button_gpio)) {
int err;
err = gpio_pin_configure_dt(&button_gpio, GPIO_INPUT);
if (err) {
LOG_ERR("failed to configure button gpio: %d", err);
return 0;
}
gpio_init_callback(&button_callback, button_isr_callback,
BIT(button_gpio.pin));
err = gpio_add_callback(button_gpio.port, &button_callback);
if (err) {
LOG_ERR("failed to add button callback: %d", err);
return 0;
}
err = gpio_pin_interrupt_configure_dt(&button_gpio,
GPIO_INT_EDGE_TO_ACTIVE);
if (err) {
LOG_ERR("failed to enable button callback: %d", err);
return 0;
}
}
#endif /* CONFIG_RESET_COUNTER_SW0 */
#ifdef CONFIG_LV_Z_ENCODER_INPUT
lv_obj_t *arc;
lv_group_t *arc_group;
arc = lv_arc_create(lv_screen_active());
lv_obj_align(arc, LV_ALIGN_CENTER, 0, -15);
lv_obj_set_size(arc, 150, 150);
arc_group = lv_group_create();
lv_group_add_obj(arc_group, arc);
lv_indev_set_group(lvgl_input_get_indev(lvgl_encoder), arc_group);
#endif /* CONFIG_LV_Z_ENCODER_INPUT */
#ifdef CONFIG_LV_Z_KEYPAD_INPUT
lv_obj_t *btn_matrix;
lv_group_t *btn_matrix_group;
static const char *const btnm_map[] = {"1", "2", "3", "4", ""};
btn_matrix = lv_buttonmatrix_create(lv_screen_active());
lv_obj_align(btn_matrix, LV_ALIGN_CENTER, 0, 70);
lv_buttonmatrix_set_map(btn_matrix, (const char **)btnm_map);
lv_obj_set_size(btn_matrix, 100, 50);
btn_matrix_group = lv_group_create();
lv_group_add_obj(btn_matrix_group, btn_matrix);
lv_indev_set_group(lvgl_input_get_indev(lvgl_keypad), btn_matrix_group);
#endif /* CONFIG_LV_Z_KEYPAD_INPUT */
if (IS_ENABLED(CONFIG_LV_Z_POINTER_INPUT)) {
lv_obj_t *hello_world_button;
hello_world_button = lv_button_create(lv_screen_active());
lv_obj_align(hello_world_button, LV_ALIGN_CENTER, 0, -15);
lv_obj_add_event_cb(hello_world_button, lv_btn_click_callback, LV_EVENT_CLICKED,
NULL);
hello_world_label = lv_label_create(hello_world_button);
} else {
hello_world_label = lv_label_create(lv_screen_active());
}
lv_label_set_text(hello_world_label, "Hello world!");
lv_obj_align(hello_world_label, LV_ALIGN_CENTER, 0, 0);
count_label = lv_label_create(lv_screen_active());
lv_obj_align(count_label, LV_ALIGN_BOTTOM_MID, 0, 0);
lv_timer_handler();
display_blanking_off(display_dev);
while (1) {
if ((count % 100) == 0U) {
sprintf(count_str, "%d", count/100U);
lv_label_set_text(count_label, count_str);
}
lv_timer_handler();
++count;
k_sleep(K_MSEC(10));
}
}
- MCU/MPU/Board: nRF54L15
- LVGL version: 9.3 i believe