Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7596

Interfacing (DSI, CSI, I2C, etc.) • Re: Small TFT based on ILI9341 ST7789 - how to use

$
0
0
There are quite a few 240x240pixel displays around which can be used with the init command sequence posted here download/file.php?id=70754

One of these is the Joy-IT 1.3in SBC-LCD01 - https://joy-it.net/en/products/SBC-LCD01

That one is a little special though as it has no CS-signal! CS on this model is permanently enabled, hence it requires a special overlay to Mae use of it.
Below example considers there is no CS-signal, and as the module is write only the MISO signal also got omitted -> GPIO9 is available to be used for other purposes (backlight control in below example).

the overlay file

Code:

/* * mipi-dbi-spi0-no-miso-no-cs-overlay.dts * * aBUGSworstnightmare Feb 2025 - rev 0r1 */#include <dt-bindings/gpio/gpio.h>/dts-v1/;/plugin/;/ {compatible = "brcm,bcm2835";fragment@0 {target = <&spi0_cs_pins>;frag0: __overlay__ {brcm,pins;};};fragment@1 {target = <&spi0>;__overlay__ {cs-gpios;status = "okay";};};fragment@2 {target = <&spidev1>;__overlay__ {status = "disabled";};};fragment@3 {target = <&spi0_pins>;__overlay__ {brcm,pins = <10 11>;};};panel_fragment: fragment@10 {target = <&spi0>;__overlay__ {/* needed to avoid dtc warning */#address-cells = <1>;#size-cells = <0>;status = "okay";panel: panel@0 {compatible = "panel", "panel-mipi-dbi-spi";reg = <0>;spi-max-frequency = <32000000>;width-mm = <0>;height-mm = <0>;timing: panel-timing {hactive = <320>;vactive = <240>;hback-porch = <0>;vback-porch = <0>;clock-frequency = <0>;hfront-porch = <0>;hsync-len = <0>;vfront-porch = <0>;vsync-len = <0>;};};};};fragment@11 {target = <&panel>;__dormant__  {backlight = <&backlight_gpio>;};};fragment@12 {target-path = "/";__dormant__  {backlight_gpio: backlight_gpio {compatible = "gpio-backlight";gpios = <&gpio 255 GPIO_ACTIVE_HIGH>;};};};fragment@20 {target = <&panel>;__dormant__  {backlight = <&backlight_pwm>;};};fragment@21 {target-path = "/";__dormant__  {backlight_pwm: backlight_pwm {compatible = "pwm-backlight";brightness-levels = <0 6 8 12 16 24 32 40 48 64 96 128 160 192 224 255>;default-brightness-level = <15>;pwms = <&pwm 0 200000>;};};};fragment@22 {target = <&pwm>;__dormant__ {pinctrl-names = "default";pinctrl-0 = <&pwm_pins>;assigned-clock-rates = <1000000>;status = "okay";};};fragment@23 {target = <&gpio>;__dormant__ {pwm_pins: pwm_pins {brcm,pins = <18>;brcm,function = <2>; /* Alt5 */};};};fragment@24 {target = <&chosen>;__dormant__  {bootargs = "snd_bcm2835.enable_headphones=0";};};__overrides__ {compatible    = <&panel>, "compatible";speed         = <&panel>, "spi-max-frequency:0";cpha          = <&panel>, "spi-cpha?";cpol          = <&panel>, "spi-cpol?";write-only    = <&panel>, "write-only?";width         = <&timing>, "hactive:0";height        = <&timing>, "vactive:0";x-offset      = <&timing>, "hback-porch:0";y-offset      = <&timing>, "vback-porch:0";clock-frequency = <&timing>, "clock-frequency:0";width-mm      = <&panel>, "width-mm:0";height-mm     = <&panel>, "height-mm:0";/* optional gpios */reset-gpio    = <&panel>, "reset-gpios:0=", <&gpio>,<&panel>, "reset-gpios:4",<&panel>, "reset-gpios:8=0"; /* GPIO_ACTIVE_HIGH */dc-gpio       = <&panel>, "dc-gpios:0=", <&gpio>,<&panel>, "dc-gpios:4",<&panel>, "dc-gpios:8=0"; /* GPIO_ACTIVE_HIGH */backlight-gpio        = <0>, "+11+12",<&backlight_gpio>, "gpios:4";backlight-pwm         = <0>, "+20+21+22+23+24";backlight-pwm-chan    = <&backlight_pwm>, "pwms:4";backlight-pwm-gpio    = <&pwm_pins>, "brcm,pins:0";backlight-pwm-func    = <&pwm_pins>, "brcm,function:0";backlight-def-brightness = <&backlight_pwm>, "default-brightness-level:0";};};
config.txt entry for enabling the module - as said, GPIO9 is use for backlight

Code:

#dtoverlay=# waveshare 1.3in - 240x240pixel - SKU19650# on SPI-0 for permanently enable CS displays, GPIO9 free to usedtoverlay=mipi-dbi-spi0-no-miso-no-cs,speed=32000000dtparam=compatible=wavesku19650\0panel-mipi-dbi-spidtparam=write-only,cpha,cpoldtparam=width=240,height=240,width-mm=23,height-mm=23dtparam=reset-gpio=24,dc-gpio=25,backlight-gpio=9
IMG_20250223_104406.jpg
IMG_20250223_104359.jpg

Statistics: Posted by aBUGSworstnightmare — Sun Feb 23, 2025 9:52 am



Viewing all articles
Browse latest Browse all 7596

Trending Articles