Zephyr ssd16xx driver and epaper refresh

Hi

I use in my project Zephyr ssd16xx driver with Waveshare epaper and LVGL and everything seems to be OK, but there is a strange behavior, when the e-paper works longer period (I saw that first, if I forgot my work in progress project running on my desk over night).

If the image is refreshed, then it is OK on the e-paper, but it starts to fade out after refresh. I take some pictures:

This is somewhat OK image, it has a little gray noise and perfect would it be with no noise (when the display stands off a while and then if I try again, then there is no noise on background)

This is after some sec:

I don't know if that is driver side or LVGL side problem. I use CAF for that project and epaper has its own module, where I refresh the data with timer.

My LVGL config is here:

# Enable SPI
CONFIG_SPI=y

#Enable display and LVGL
CONFIG_DISPLAY=y
CONFIG_SSD16XX=y

CONFIG_LVGL=y

CONFIG_LVGL_DISPLAY_DEV_NAME="SSD16XX"
CONFIG_LVGL_HOR_RES_MAX=250
CONFIG_LVGL_VER_RES_MAX=122

CONFIG_LVGL_VDB_SIZE=100
CONFIG_LVGL_BITS_PER_PIXEL=1
CONFIG_LVGL_COLOR_DEPTH_1=y
CONFIG_LVGL_ANTIALIAS=y

CONFIG_LVGL_USE_LABEL=y
CONFIG_LVGL_USE_CONT=y

CONFIG_LVGL_FONT_MONTSERRAT_12=y
CONFIG_LVGL_FONT_MONTSERRAT_20=y
CONFIG_LVGL_FONT_MONTSERRAT_30=y
CONFIG_LVGL_FONT_MONTSERRAT_38=y
CONFIG_LVGL_FONT_MONTSERRAT_48=y
CONFIG_LVGL_LOG_LEVEL_ERR=y

project overlay:

/ {
    chosen {
        zephyr,display = &ssd16xx;
    };
    
&spi1 {
	status = "okay";
	sck-pin = <8>;
	mosi-pin = <6>;
	miso-pin = <15>;
	cs-gpios = <&gpio0 27 GPIO_ACTIVE_LOW>;
		ssd16xx: ssd16xxfb@0 {
			compatible = "solomon,ssd16xxfb";
			label = "SSD16XX";
			spi-max-frequency = <4000000>;
			reg = <0>;
			width = <250>;
			height = <122>;
			pp-width-bits = <8>;
			pp-height-bits = <16>;
			dc-gpios = <&gpio0 26 GPIO_ACTIVE_LOW>;	
			reset-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
			busy-gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
			supply-gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>;
			gdv = [03];
			sdv = [40 a8 32];
			vcom = <0x55>;
			border-waveform = <0x03>;
			softstart = [D7 D6 9D];
			lut-initial = [
				80 60 40 00 00 00 00
				10 60 20 00 00 00 00
				80 60 40 00 00 00 00
				10 60 20 00 00 00 00
				00 00 00 00 00 00 00
				03 03 00 00 02
				09 09 00 00 02
				03 03 00 00 02
				00 00 00 00 00
				00 00 00 00 00
				00 00 00 00 00
				00 00 00 00 00
			];
	
			lut-default = [
				00 00 00 00 00 00 00
				80 00 00 00 00 00 00
				40 00 00 00 00 00 00
				80 00 00 00 00 00 00
				00 00 00 00 00 00 00
				0A 00 00 00 04
				00 00 00 00 00
				00 00 00 00 00
				00 00 00 00 00
				00 00 00 00 00
				00 00 00 00 00
				00 00 00 00 00
			];
		};
};

epaper module is inspired from LVGL example.

  • Hi, 

    I would recommend that you check with the E-paper manufacture to see if this is a known issue that can happen just in case. 

    As for the driver it is maintained by Zephyr so i would recommend that you ask in the Zephyr forum/discord.

    Sorry for not being of much help, maybe other community members here can provide more assistance. 

    Regards,
    Jonathan

  • That's very cool that you able to incopperate ssd16xx into the design. I'm wondering if you could share this sample code setup? Thanks.

  • I used some examples from Zephyr LVGL library. With new Zephyr versions is the grayish color problem also gone.

    SSD1680 and newer chips have waveform table included into the chips ROM and you don't have to write the code to overlay anymore. But I got partial refresh not working anymore -- maybe its better that way -- screen is cleared after every refresh.

    Main 

    #include <zephyr/types.h>
    #include <stdio.h>
    #include <string.h>
    #include <math.h>
    
    #include <soc.h>
    #include <zephyr/device.h>
    #include <zephyr/sys/atomic.h>
    
    #include <zephyr/drivers/display.h>
    #include <zephyr/drivers/gpio.h>
    #include <lvgl.h>
    
    #include <zephyr/logging/log.h>
    
    LOG_MODULE_REGISTER(epaper);
    
    static lv_obj_t *info_value;
    static lv_obj_t *info_label;
    
    static lv_obj_t *info_scr = NULL;
    
    static lv_style_t big_font, small_font;
    
    static const struct device *display_dev;
    
    void main()	{
    	
    	info_scr = lv_obj_create(NULL);
    
    	//Initialize display device
    	display_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_display));
    	if (!device_is_ready(display_dev)) {
    		LOG_ERR("E-paper initialize error");
    		return;
    	}
    
    	//Initialize fonts
    	lv_style_t* big_font_pointer = &big_font;
        lv_style_t* small_font_pointer = &small_font;
    
    	lv_style_init(big_font_pointer);
    	lv_style_init(small_font_pointer);
    
    	lv_style_set_text_font(big_font_pointer, &lv_font_montserrat_48);
    	lv_style_set_text_font(small_font_pointer, &lv_font_montserrat_20);
    
    	//Main label for informative text	
    	info_value = lv_label_create(info_scr);
    	lv_obj_add_style(info_value, big_font_pointer, LV_PART_MAIN);
    	lv_obj_align(info_value, LV_ALIGN_LEFT_MID, 0, 0);
    
    	//Sublabel for informative text
    	info_label = lv_label_create(info_scr);
    	lv_obj_add_style(info_label, small_font_pointer, LV_PART_MAIN);
    	lv_obj_align(info_label, LV_ALIGN_LEFT_MID, 0, 30);
    
    	//Text	
    	lv_label_set_text(info_value, "some text");
    	//Subtext
    	lv_label_set_text(info_label, "some subtext");
    
    	lv_scr_load(info_scr);
    
    	lv_task_handler();
    }
    	

    Overlay:

    / {
        chosen {
            zephyr,display = &ssd16xx;
        };
    };
    
    &spi1 {
    
        status = "okay";
        compatible = "nordic,nrf-spim";
        cs-gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
        pinctrl-0 = <&spi1_default>;
        pinctrl-1 = <&spi1_sleep>;
    
        ssd16xx: ssd16xx@0 {
            compatible = "solomon,ssd16xxfb";
            spi-max-frequency = <4000000>;
            reg = <0>;
            width = <250>;
            height = <122>;
            pp-width-bits = <8>;
            pp-height-bits = <16>;
            dc-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
            reset-gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
            busy-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
            supply-gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
            zephyr,pm-device-runtime-auto;
        };
    };

    prj.conf

    CONFIG_LV_Z_MEM_POOL_NUMBER_BLOCKS=8
    CONFIG_MAIN_STACK_SIZE=2048
    
    CONFIG_DISPLAY=y
    CONFIG_DISPLAY_LOG_LEVEL_ERR=y
    
    CONFIG_USE_SEGGER_RTT=y
    
    CONFIG_LOG=y
    CONFIG_LOG_BACKEND_RTT=y
    
    # Enable SPI
    CONFIG_SPI=y
    CONFIG_SPI_NRFX=y
    
    CONFIG_DISPLAY=y
    CONFIG_SSD16XX=y
    
    CONFIG_LVGL=y
    
    CONFIG_LV_COLOR_DEPTH_1=y
    
    CONFIG_LV_USE_LABEL=y
    CONFIG_LV_USE_WIN=y=y
    CONFIG_LV_USE_IMG=y
    
    CONFIG_LV_TXT_ENC_UTF8=y
    CONFIG_LV_FONT_MONTSERRAT_12=y
    CONFIG_LV_FONT_MONTSERRAT_20=y
    CONFIG_LV_FONT_MONTSERRAT_30=y
    CONFIG_LV_FONT_MONTSERRAT_38=y
    CONFIG_LV_FONT_MONTSERRAT_48=y
    CONFIG_LV_USE_FONT_SUBPX=y
    

    That should work and maybe you get the idea from it.

    Tiit

Related