Hi all!
First time poster but avid consumer of Jared’s videos.
I’m new to Zephyr, nRF SDK and embedded in general.

I’m building a project that requires multiple ePaper screens (6 in total). I managed to get my whole setup working with 1 screen, but when i add a second one, it doesn’t show any image.

I suspect that my device tree has something wrong with it:

Here is my spi node.

&spi0 {
    compatible = "nordic,nrf-spim";
    status = "okay";
    sck-pin = < 17 >;
    mosi-pin = < 19 >;
    miso-pin = < 20 >;
    cs-gpios = <&gpio0 03 GPIO_ACTIVE_LOW>,
              <&gpio0 04 GPIO_ACTIVE_LOW>;

    epd1: ssd16xxfb@0 {
        compatible = "solomon,ssd16xxfb";
        label = "ssd16xx01";
        spi-max-frequency = <4000000>;
        reg = <0>;
        width = <200>;
        height = <200>;
        pp-width-bits = <8>;
        pp-height-bits = <16>;
        dc-gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
        reset-gpios = <&gpio1 22 GPIO_ACTIVE_LOW>;
        busy-gpios = <&gpio1 21 GPIO_ACTIVE_HIGH>;
        gdv = [00];
        sdv = [41 a8 32];
        vcom = <0x00>;
        border-waveform = <0x05>;
        tssv = <0x80>;
    };

    epd2: ssd16xxfb@1 {
        compatible = "solomon,ssd16xxfb";
        label = "ssd16xx02";
        spi-max-frequency = <4000000>;
        reg = <1>;
        width = <200>;
        height = <200>;
        pp-width-bits = <8>;
        pp-height-bits = <16>;
        dc-gpios = <&gpio1 06 GPIO_ACTIVE_LOW>;
        reset-gpios = <&gpio1 05 GPIO_ACTIVE_LOW>;
        busy-gpios = <&gpio1 04 GPIO_ACTIVE_HIGH>;
        gdv = [00];
        sdv = [41 a8 32];
        vcom = <0x00>;
        border-waveform = <0x05>;
        tssv = <0x80>;
    };
};

Is there something in here that is incorrect?

Thanks for your help all!

Idriss

    ijuhoor there are a few things I can think of you can look into:

    1. Is the driver configured for multiple devices? Some drivers in Zephyr don’t allow more than one instance.
    2. I’d be curious to see what the working overlay looks like.
    3. One thing that its left out here is how you’re referencing the device in your code. Are you referencing them by the label or something else? (This applies to when you’re running DEVICE_DT_GET)
    23 days later

    Hey Jared, Sorry for the delay!

    You made great points, I had a look:

    1. It seems that the driver is ok but i’m not 100% sure. It seems that the driver
      ssd16xx.c
      takes the device/display as parameter to draw, etc. But i’m a newbie in Zephyr so I might be wrong.

    2. Here is the working overlay:

      &spi0 {
          compatible = "nordic,nrf-spim";
          status = "okay";
          sck-pin = < 17 >;
          mosi-pin = < 19 >;
          miso-pin = < 20 >;
          cs-gpios = <&gpio0 03 GPIO_ACTIVE_LOW>;
      
          epd1: ssd16xxfb@0 {
              compatible = "solomon,ssd16xxfb";
              label = "ssd16xx01";
              spi-max-frequency = <4000000>;
              reg = <0>;
              width = <200>;
              height = <200>;
              pp-width-bits = <8>;
              pp-height-bits = <16>;
              dc-gpios = <&gpio1 06 GPIO_ACTIVE_LOW>;
              reset-gpios = <&gpio1 05 GPIO_ACTIVE_LOW>;
              busy-gpios = <&gpio1 04 GPIO_ACTIVE_HIGH>;
              gdv = [00];
              sdv = [41 a8 32];
              vcom = <0x00>;
              border-waveform = <0x05>;
              tssv = <0x80>;
          };
      };
    3. And I’m referencing it this way:

      const struct device *epd01_device = DEVICE_DT_GET(DT_NODELABEL(epd1));
      [...]
      
      if (!device_is_ready(epd01_device)) {
          printf("No device \"%s\" found.\n", epd01_device->name);
          return false;
      }
      ```

      ijuhoor Looks like that driver does support multiple instances. Do you get any error messages? May be useful to post the logs.

      Additionally, you need to make sure you’re invoking the display driver correctly. I’ve used LVGL at a higher level which required some tweaking in order to work. For example this was for configuring a single color OLED display:

      CONFIG_LVGL=y
      CONFIG_LV_MEM_CUSTOM=y
      CONFIG_LV_USE_LABEL=y
      CONFIG_LV_USE_CANVAS=y
      CONFIG_LV_USE_LOG=y
      # CONFIG_LV_LOG_LEVEL_INFO=y
      
      CONFIG_LV_DPI_DEF=148
      CONFIG_LV_Z_BITS_PER_PIXEL=1
      CONFIG_LV_COLOR_DEPTH_1=y
      CONFIG_LV_FONT_DEFAULT_UNSCII_8=y
      
      CONFIG_LV_Z_MEM_POOL_NUMBER_BLOCKS=8

      I’ve tried to setup 2 screens to see which error message I am getting. I think it’s an issue with the device tree:
      When I have 2 screens, I get:

      eCube/src/screen_mgr.c:14: undefined reference to `__device_dts_ord_65'

      Line 14 is where I access the second screen:

      l14: const struct device *epd02_device = DEVICE_DT_GET(DT_NODELABEL(epd2));

      My dts looks like this:

      
      &spi0 {
          compatible = "nordic,nrf-spim";
          status = "okay";
          sck-pin = < 17 >;
          mosi-pin = < 19 >;
          miso-pin = < 20 >;
          cs-gpios = <&gpio0 03 GPIO_ACTIVE_LOW>,
                     <&gpio0 04 GPIO_ACTIVE_LOW>;
      
          epd1: ssd16xxfb@0 {
              compatible = "solomon,ssd16xxfb";
              label = "ssd16xx01";
              spi-max-frequency = <4000000>;
              reg = <0>;
              width = <200>;
              height = <200>;
              pp-width-bits = <8>;
              pp-height-bits = <16>;
              dc-gpios = <&gpio1 06 GPIO_ACTIVE_LOW>;
              reset-gpios = <&gpio1 05 GPIO_ACTIVE_LOW>;
              busy-gpios = <&gpio1 04 GPIO_ACTIVE_HIGH>;
              gdv = [00];
              sdv = [41 a8 32];
              vcom = <0x00>;
              border-waveform = <0x05>;
              tssv = <0x80>;
          };
      
          epd2: ssd16xxfb@1 {
              compatible = "solomon,ssd16xxfb";
              label = "ssd16xx02";
              spi-max-frequency = <4000000>;
              reg = <1>;
              width = <200>;
              height = <200>;
              pp-width-bits = <8>;
              pp-height-bits = <16>;
              dc-gpios = <&gpio1 03 GPIO_ACTIVE_LOW>;
              reset-gpios = <&gpio1 02 GPIO_ACTIVE_LOW>;
              busy-gpios = <&gpio1 01 GPIO_ACTIVE_HIGH>;
              gdv = [00];
              sdv = [41 a8 32];
              vcom = <0x00>;
              border-waveform = <0x05>;
              tssv = <0x80>;
          };
      };

      Where I think it might be a device tree issue is when I leave the node epd2 in the dts file, but comment out l14
      (This way there is only one screen in the code but 2 nodes in the device tree).
      In this case I get a runtime error, device_is_ready(epd01_device) is false. It is true when i remove the epd2 node.

      I had a look in the generated device tree, and this is what i see in the spi0 node:

      spi0: spi@40003000 {
      			compatible = "nordic,nrf-spim";
      			#address-cells = < 0x1 >;
      			#size-cells = < 0x0 >;
      			reg = < 0x40003000 0x1000 >;
      			interrupts = < 0x3 0x1 >;
      			status = "okay";
      			label = "SPI_0";
      			sck-pin = < 0x11 >;
      			mosi-pin = < 0x13 >;
      			miso-pin = < 0x14 >;
      			cs-gpios = < &gpio0 0x3 0x1 >, < &gpio0 0x4 0x1 >;
      			epd1: ssd16xxfb@0 {
      				compatible = "solomon,ssd16xxfb";
      				label = "ssd16xx01";
      				spi-max-frequency = < 0x3d0900 >;
      				reg = < 0x0 >;
      				width = < 0xc8 >;
      				height = < 0xc8 >;
      				pp-width-bits = < 0x8 >;
      				pp-height-bits = < 0x10 >;
      				dc-gpios = < &gpio1 0x6 0x1 >;
      				reset-gpios = < &gpio1 0x5 0x1 >;
      				busy-gpios = < &gpio1 0x4 0x0 >;
      				gdv = [ 00 ];
      				sdv = [ 41 A8 32 ];
      				vcom = < 0x0 >;
      				border-waveform = < 0x5 >;
      				tssv = < 0x80 >;
      			};
      			epd2: ssd16xxfb@1 {
      				compatible = "solomon,ssd16xxfb";
      				label = "ssd16xx02";
      				spi-max-frequency = < 0x3d0900 >;
      				reg = < 0x1 >;
      				width = < 0xc8 >;
      				height = < 0xc8 >;
      				pp-width-bits = < 0x8 >;
      				pp-height-bits = < 0x10 >;
      				dc-gpios = < &gpio1 0x3 0x1 >;
      				reset-gpios = < &gpio1 0x2 0x1 >;
      				busy-gpios = < &gpio1 0x1 0x0 >;
      				gdv = [ 00 ];
      				sdv = [ 41 A8 32 ];
      				vcom = < 0x0 >;
      				border-waveform = < 0x5 >;
      				tssv = < 0x80 >;
      			};
      		};

      Maybe it’s not the right way to have 2 slave devices on one SPI node?

      (another possibility: The error looks very similar when I forgot to add CONFIG_SSD16XX=y and CONFIG_DISPLAY=y to the prj.conf with the initial screen).

      Forgot to mention: I’m going to try LVGL to see if it works. I have it setup correctly in another project, but no in this one.

      Maybe it’s not the right way to have 2 slave devices on one SPI node?

      Hmm seems ok. I’ve shared the SPI bus on other projects before. The biggest thing was making sure both CS pins were set properly which seems like it is here.

      Does having status = "okay"; for each display address the issue?

      11 days later
      Terms and Conditions | Privacy Policy