notro / panel-mipi-dbi

13 stars 1 forks source link

The screen is still black after the driver is finished #10

Open EthiceDD opened 6 months ago

EthiceDD commented 6 months ago

Error code:

[    3.622226] sun6i-spi 1c69000.spi: chipselect 0 already in use
[    3.622264] spi_master spi0: spi_device register error /soc/spi@1c69000/panel@0
[    3.622325] spi_master spi0: Failed to create SPI device for /soc/spi@1c69000/panel@0

panel-mipi-dbi-spi.dts:

/dts-v1/;
/plugin/;

 / {
      compatible = "allwinner,sun8i-h2+";

         fragment@0 {
                 target = <&spi1>; // spi总线
                 __overlay__ {
                        /* needed to avoid dtc warning */
                         #address-cells = <1>;
                         #size-cells = <0>;

                         status = "okay";

                         panel: panel@0 {
                                 compatible = "panel-mipi-dbi-spi";
                                 reg = <0>;
                                 spi-max-frequency = <32000000>;

                                 width-mm = <20>;
                                 height-mm = <20>;

                                 reset-gpios = <&pio 0 199 0>; // reset引脚
                                 dc-gpios = <&pio 0 198 0>; // dc引脚
                                 write-only;

                                 timing: panel-timing {
                                         hactive = <160>; // 横向分辨率
                                         vactive = <128>; // 纵向分辨率
                                         hback-porch = <0>;
                                         vback-porch = <0>;

                                         clock-frequency = <0>;
                                         hfront-porch = <0>;
                                         hsync-len = <0>;
                                         vfront-porch = <0>;
                                         vsync-len = <0>;
                                 };
                         };
                 };
         };
 };

Why I can't create SPI device???

notro commented 6 months ago

[ 3.622226] sun6i-spi 1c69000.spi: chipselect 0 already in use

There seems to be a SPI device already using CS0.

Verify by looking in /sys/bus/spi/devices.

EthiceDD commented 6 months ago

hey guys,I've fixed this issue, it seems to be caused by the fact that I was using a linux 5.18 image before updating linux and the previous version didn't have the panel-mipi-dbi driver, which is why I changed the spi bus but it didn't say that the driver was successful.

EthiceDD commented 6 months ago

But even if I succeed in driving, my display still keeps black screen and unresponsive, I use ILI9341 driver, linux 6.6.16, I used con2fbmap 1 1 to map the terminal to the display but it still goes black, what's going on??

EthiceDD commented 6 months ago

Here are the tips for driving success:

[   11.712255] panel-mipi-dbi-spi spi0.0: supply power not found, using dummy regulator
[   11.728154] panel-mipi-dbi-spi spi0.0: supply io not found, using dummy regulator
[   11.776493] [drm] Initialized panel-mipi-dbi 1.0.0 20220103 for spi0.0 on minor 1
[   11.779282] panel-mipi-dbi-spi spi0.0: [drm] fb1: panel-mipi-dbid frame buffer device
notro commented 6 months ago

Black as in no backlight? There's no backlight device in your DT overlay, is backlight hardwired or have you just forgotten it?

EthiceDD commented 6 months ago

I plugged in the led and got a white screen and no response, like I didn't plug in the led, it just became a white screen

notro commented 6 months ago

A white screen means the controller hasn't been properly configured. Double check your init commands.

EthiceDD commented 6 months ago

But I'm using the init command: https://github.com/notro/panel-mipi-dbi/wiki/Displays#adafruit-ili9341-pitft-tft-lcd-screen

# Adafruit ILI9341 PiTFT TFT LCD Screen
# width=320,height=240

command 0x01  # Software reset
delay 128

command 0xEF 0x03 0x80 0x02
command 0xCF 0x00 0xC1 0x30
command 0xED 0x64 0x03 0x12 0x81
command 0xE8 0x85 0x00 0x78
command 0xCB 0x39 0x2C 0x00 0x34 0x02
command 0xF7 0x20
command 0xEA 0x00 0x00
command 0xc0 0x23  # Power control VRH[5:0]
command 0xc1 0x10  # Power control SAP[2:0];BT[3:0]
command 0xc5 0x3e 0x28  # VCM control
command 0xc7 0x86  # VCM control2

# Command 36h sets the read order from frame memory to the display panel
# Remember to swap width/height on 0/180 rotations
#command 0x36 0x88 # rotation 0
command 0x36 0xE8 # rotation 90
#command 0x36 0x48 # rotation 180
#command 0x36 0x28 # rotation 270

command 0x37 0x00  # Vertical scroll zero
command 0x3a 0x55  # COLMOD: Pixel Format Set
command 0xb1 0x00 0x18  # Frame Rate Control (In Normal Mode/Full Colors)
command 0xb6 0x08 0x82 0x27  # Display Function Control
command 0xF2 0x00  # 3Gamma Function Disable
command 0x26 0x01  # Gamma curve selected

# Set Gamma
command 0xe0 0x0F 0x31 0x2B 0x0C 0x0E 0x08 0x4E 0xF1 0x37 0x07 0x10 0x03 0x0E 0x09 0x00  
command 0xe1 0x00 0x0E 0x14 0x03 0x11 0x07 0x31 0xC1 0x48 0x08 0x0F 0x0C 0x31 0x36 0x0F
command 0x11  # Exit Sleep
delay 120
command 0x29  # Display on
delay 120

This init command doesn't look like it can go wrong.

notro commented 6 months ago

Is something, modetest/fbcon, driving the display? The driver won't write the init commands until it's first use.

You can enable debug output to see what's happening in the driver: https://github.com/notro/panel-mipi-dbi/wiki/Debugging#drmdebug