zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.79k stars 6.58k forks source link

ls0xx: Sharp memory Display cannot run samples/drivers/display #80463

Open ric96 opened 5 days ago

ric96 commented 5 days ago

I am trying to run the Adafruit Sharp memory display 2.7 inch on a STM32H7B0 board but cannot run the display driver sample.

here's the dt snippet I used:

&spi2 {
    pinctrl-0 = <&spi2_sck_pb10 &spi2_miso_pc2_c &spi2_mosi_pc1>;
    cs-gpios = <&gpioc 0 GPIO_ACTIVE_HIGH>;
    pinctrl-names = "default";
    status = "okay";

    ls0xx_ls027b7dh01: ls0xx@0 {
        compatible = "sharp,ls0xx";
        spi-max-frequency = <2000000>;
        reg = <0>;
        width = <400>;
        height = <240>;
        extcomin-gpios = <&gpioc 3 GPIO_ACTIVE_HIGH>;
        extcomin-frequency = <60>; /* required if extcomin-gpios is defined */
        disp-en-gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>;
    };

};

And here's the error log from console:

[00:00:00.241,000] <inf> ls0xx: Configuring DISP pin to OUTPUT_HIGH
[00:00:00.241,000] <inf> ls0xx: Configuring EXTCOMIN pin
[00:00:00.241,000] <inf> usb_dc_stm32: PWR not active yet
*** Booting Zephyr OS build v3.7.0-5324-gae361a9853c0 ***
[00:00:00.351,000] <inf> sample: Display sample for ls0xx@0
[00:00:00.503,000] <err> ls0xx: Width not a multiple of 400
[00:00:00.503,000] <err> ls0xx: Width not a multiple of 400
[00:00:00.503,000] <err> ls0xx: Width not a multiple of 400
[00:00:00.504,000] <err> ls0xx: Width not a multiple of 400
[00:00:00.604,000] <err> ls0xx: Width not a multiple of 400
[00:00:00.704,000] <err> ls0xx: Width not a multiple of 400

From what I can tell from basic printf, the demo sends a fraction of the width, in this case its 100px. While that works fine with displays like the st7735r_160x80, its failing for ls0xx_ls027b7dh01.

mmahadevan108 commented 1 day ago

@erwango , can you help take a look as this is being tried on an ST board.

jhedberg commented 1 day ago

Looks like the error is coming from the driver's ls0xx_write() function: https://github.com/zephyrproject-rtos/zephyr/blob/022c8ee1afbc6373265ef9c0a198defa3e862247/drivers/display/ls0xx.c#L182-L185

The sample in question simply feeds the driver back what it reports through get_capabilities(): https://github.com/zephyrproject-rtos/zephyr/blob/022c8ee1afbc6373265ef9c0a198defa3e862247/samples/drivers/display/src/main.c#L203 and: https://github.com/zephyrproject-rtos/zephyr/blob/022c8ee1afbc6373265ef9c0a198defa3e862247/samples/drivers/display/src/main.c#L297-L310

The sample isn't checking for the return value of display_get_capabilities(), so it's possible that it's failing, e.g. because there's something wrong with your board configuration or snippet.