With the removal of the "init=" code for fbtft in 5.4, is there any method to send custom strings to devices other than to patch the driver?
Many of the little TFT displays that come from random sellers require tweaks to get them working properly. Making custom "init=" strings to use inside device tree files was fiddly, but at least it avoided modifying kernel drivers.
For example, I have an st7789v based display that needs to be issued the following so it displays colour properly:
0x1000021 /* MIPI_DCS_ENTER_INVERT_MODE */
(No, this is not a 'rgb' vs 'bgr' issue.)
I am pretty sure there is no solution to this and that we're at the mercy of driver maintainers now. I just wanted to confirm.
Re: replacement for fbtft "init=" section in 5.4+?
hello, I had same problem with inverted colors using my device tree overlay without an init section, so i added one and now all is well.
compile with
add
to /boot/config.txt
on 5.4 and newer may need to edit the the gpio sections inverting the lastbit
EXAMPLE
dc-gpios = <&gpio 25 0>;
to
dc-gpios = <&gpio 25 1>;
Code: Select all
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";
fragment@0 {
target = <&spi0>;
__overlay__ {
status = "okay";
spidev@0{
status = "disabled";
};
spidev@1{
status = "disabled";
};
};
};
fragment@1 {
target = <&gpio>;
__overlay__ {
pitft_pins: pitft_pins {
brcm,pins = <25 27>;
brcm,function = <1 1>; /* out */
brcm,pull = <0>; /* none */
};
};
};
fragment@2 {
target = <&spi0>;
__overlay__ {
/* needed to avoid dtc warning */
#address-cells = <1>;
#size-cells = <0>;
pitft: pitft@0{
compatible = "sitronix,st7789v";
reg = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pitft_pins>;
spi-max-frequency = <48000000>;
rotate = <0>;
width = <240>;
height = <240>;
fps = <30>;
buswidth = <8>;
reset-gpios = <&gpio 27 0>;
dc-gpios = <&gpio 25 0>;
led-gpios = <&gpio 26 0>;
debug = <0>;
init = <0x1000011
0x20000ff
0x1000036 0x70
0x100003a 0x05
0x10000b2 0x0c 0x0c 0x00 0x33 0x33
0x10000b7 0x35
0x10000bb 0x1a
0x10000c0 0x2c
0x10000c2 0x01
0x10000c3 0x0b
0x10000c4 0x20
0x10000c6 0x0f
0x10000d0 0xa4 0xa1
0x1000021
0x10000e0 0x00 0x19 0x1E 0x0A 0x09 0x15 0x3D 0x44 0x51 0x12 0x03 0x00 0x3F 0x3F
0x10000e1 0x00 0x18 0x1E 0x0A 0x09 0x25 0x3F 0x43 0x52 0x33 0x03 0x00 0x3F 0x3F
0x1000029>;
};
};
};
__overrides__ {
speed = <&pitft>,"spi-max-frequency:0";
rotate = <&pitft>,"rotate:0";
width = <&pitft>,"width:0";
height = <&pitft>,"height:0";
fps = <&pitft>,"fps:0";
debug = <&pitft>,"debug:0";
};
};
Code: Select all
dtc -@ -I dts -O dtb -o output.dtbo input.dts
Code: Select all
dtoverlay=filename,rotate=270
on 5.4 and newer may need to edit the the gpio sections inverting the lastbit
EXAMPLE
dc-gpios = <&gpio 25 0>;
to
dc-gpios = <&gpio 25 1>;
-
- Posts: 117
- Joined: Wed Apr 02, 2014 11:46 am
Re: replacement for fbtft "init=" section in 5.4+?
hello, I use this int , but color error
color error

who know which is the problem?
I am use kernel 5.4 , (4.9 work well)
Code: Select all
init = <0x1000011
0x20000ff
0x1000036 0x70
0x100003a 0x05
0x10000b2 0x0c 0x0c 0x00 0x33 0x33
0x10000b7 0x35
0x10000bb 0x1a
0x10000c0 0x2c
0x10000c2 0x01
0x10000c3 0x0b
0x10000c4 0x20
0x10000c6 0x0f
0x10000d0 0xa4 0xa1
0x1000021
0x10000e0 0x00 0x19 0x1E 0x0A 0x09 0x15 0x3D 0x44 0x51 0x12 0x03 0x00 0x3F 0x3F
0x10000e1 0x00 0x18 0x1E 0x0A 0x09 0x25 0x3F 0x43 0x52 0x33 0x03 0x00 0x3F 0x3F
0x1000029>;
color error

who know which is the problem?
I am use kernel 5.4 , (4.9 work well)
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 4607
- Joined: Mon Sep 29, 2014 1:07 pm
- Location: Cambridge
Re: replacement for fbtft "init=" section in 5.4+?
Colour ramp images are the best way to diagnose colour map problems like this - try viewing something like https://richardrosenman.com/wp-content/ ... mage03.jpg on the Pi - but in the absence of more information it's worth adding the "bgr" property to your overlay to see if it helps:
Code: Select all
bgr;
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 13118
- Joined: Wed Dec 04, 2013 11:27 am
- Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.
Re: replacement for fbtft "init=" section in 5.4+?
Please don't double post - viewtopic.php?f=38&t=294784&p=1779326DRAgon715205 wrote: ↑Mon Dec 14, 2020 6:35 amhello, I use this int , but color error
Code: Select all
init = <0x1000011 0x20000ff 0x1000036 0x70 0x100003a 0x05 0x10000b2 0x0c 0x0c 0x00 0x33 0x33 0x10000b7 0x35 0x10000bb 0x1a 0x10000c0 0x2c 0x10000c2 0x01 0x10000c3 0x0b 0x10000c4 0x20 0x10000c6 0x0f 0x10000d0 0xa4 0xa1 0x1000021 0x10000e0 0x00 0x19 0x1E 0x0A 0x09 0x15 0x3D 0x44 0x51 0x12 0x03 0x00 0x3F 0x3F 0x10000e1 0x00 0x18 0x1E 0x0A 0x09 0x25 0x3F 0x43 0x52 0x33 0x03 0x00 0x3F 0x3F 0x1000029>;
color error
who know which is the problem?
I am use kernel 5.4 , (4.9 work well)
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
I'm not interested in doing contracts for bespoke functionality - please don't ask.