rudiratlos
Posts: 216
Joined: Tue May 01, 2012 8:47 am
Location: Germany (old europe)

Re: new kernel regression with fbtft

Thu Sep 10, 2020 8:31 am

no, I haven't built my own kernel. When is the new kernel available?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3886
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: new kernel regression with fbtft

Fri Sep 11, 2020 9:42 pm

There is a build of the updated kernel available now using "sudo rpi-update".

rudiratlos
Posts: 216
Joined: Tue May 01, 2012 8:47 am
Location: Germany (old europe)

Re: new kernel regression with fbtft

Sun Sep 13, 2020 11:36 am

I've upgraded to "Linux pump 5.4.64-v7+ #1340 SMP Fri Sep 11 14:09:35 BST 2020 armv7l GNU/Linux" via rpi-update and apt update/upgrade

but display doen't work at all. Looks like that the entry in /boot/config.txt

Code: Select all

dtoverlay=adafruit18_green,dc_pin=9,reset_pin=27,bgr=1,rotate=270,debug=3,verbose=3
doesn't take the dc_pin and reset_pin parameter

Code: Select all

[    7.567535] fbtft: module is from the staging directory, the quality is unknown, you have been warned.
[    7.571131] fb_st7735r: module is from the staging directory, the quality is unknown, you have been warned.
[    7.572169] fbtft_of_value: buswidth = 8
[    7.572179] fbtft_of_value: bpp = 1
[    7.572185] fbtft_of_value: debug = 3
[    7.572192] fbtft_of_value: rotate = 270
[    7.572201] fbtft_of_value: fps = 25
[    7.572270] fb_st7735r spi0.0: fbtft_gamma_parse_str() str=
[    7.572277] fb_st7735r spi0.0: 02 1c 07 12 37 32 29 2d 29 25 2B 39 00 01 03 10
               03 1d 07 06 2E 2C 29 2D 2E 2E 37 3F 00 00 02 10
[    7.572347] fb_st7735r spi0.0: fbtft_request_one_gpio: 'reset' GPIO
[    7.572380] fb_st7735r spi0.0: fbtft_request_one_gpio: 'dc' GPIO
[    7.572406] fb_st7735r spi0.0: fbtft_request_one_gpio: 'rd' GPIO
[    7.572430] fb_st7735r spi0.0: fbtft_request_one_gpio: 'wr' GPIO
[    7.572456] fb_st7735r spi0.0: fbtft_request_one_gpio: 'cs' GPIO
[    7.572480] fb_st7735r spi0.0: fbtft_request_one_gpio: 'latch' GPIO
[    7.572504] fb_st7735r spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    7.572528] fb_st7735r spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    7.572552] fb_st7735r spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    7.572577] fb_st7735r spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    7.572601] fb_st7735r spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    7.572625] fb_st7735r spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    7.572649] fb_st7735r spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    7.572673] fb_st7735r spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    7.572698] fb_st7735r spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    7.572722] fb_st7735r spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    7.572746] fb_st7735r spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    7.572770] fb_st7735r spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    7.572794] fb_st7735r spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    7.572818] fb_st7735r spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    7.572844] fb_st7735r spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    7.572868] fb_st7735r spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    7.572892] fb_st7735r spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    7.572916] fb_st7735r spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    7.572940] fb_st7735r spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    7.572965] fb_st7735r spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    7.572989] fb_st7735r spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    7.573013] fb_st7735r spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    7.573037] fb_st7735r spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    7.573061] fb_st7735r spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    7.573086] fb_st7735r spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    7.573110] fb_st7735r spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    7.573134] fb_st7735r spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    7.573158] fb_st7735r spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    7.573182] fb_st7735r spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    7.573208] fb_st7735r spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    7.573575] fb_st7735r spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    7.573602] fb_st7735r spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    7.573626] fb_st7735r spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    7.573650] fb_st7735r spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    7.573674] fb_st7735r spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    7.573699] fb_st7735r spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    7.573723] fb_st7735r spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    7.573747] fb_st7735r spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    7.573771] fb_st7735r spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    7.573795] fb_st7735r spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    7.573819] fb_st7735r spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    7.573844] fb_st7735r spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    7.573868] fb_st7735r spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    7.573892] fb_st7735r spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    7.573916] fb_st7735r spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    7.573940] fb_st7735r spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    7.573965] fb_st7735r spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    7.573989] fb_st7735r spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    7.573996] fb_st7735r spi0.0: fbtft_verify_gpios()
[    7.574004] fb_st7735r spi0.0: fbtft_reset()
[    7.704356] fb_st7735r spi0.0: init: write(0x01) 
[    7.704410] fb_st7735r spi0.0: init: mdelay(150)
[    7.854427] fb_st7735r spi0.0: init: write(0x11) 
[    7.854465] fb_st7735r spi0.0: init: mdelay(500)
[    8.354498] fb_st7735r spi0.0: init: write(0xB1) 0x01 0x2C 0x2D 
[    8.354596] fb_st7735r spi0.0: init: write(0xB2) 0x01 0x2C 0x2D 
[    8.354647] fb_st7735r spi0.0: init: write(0xB3) 0x01 0x2C 0x2D 0x01 0x2C 0x2D 
[    8.354700] fb_st7735r spi0.0: init: write(0xB4) 0x07 
[    8.354743] fb_st7735r spi0.0: init: write(0xC0) 0xA2 0x02 0x84 
[    8.354789] fb_st7735r spi0.0: init: write(0xC1) 0xC5 
[    8.354830] fb_st7735r spi0.0: init: write(0xC2) 0x0A 0x00 
[    8.354874] fb_st7735r spi0.0: init: write(0xC3) 0x8A 0x2A 
[    8.354918] fb_st7735r spi0.0: init: write(0xC4) 0x8A 0xEE 
[    8.354962] fb_st7735r spi0.0: init: write(0xC5) 0x0E 
[    8.355002] fb_st7735r spi0.0: init: write(0x20) 
[    8.355027] fb_st7735r spi0.0: init: write(0x3A) 0x05 
[    8.355067] fb_st7735r spi0.0: init: write(0x29) 
[    8.355091] fb_st7735r spi0.0: init: mdelay(100)
[    8.455108] fb_st7735r spi0.0: init: write(0x13) 
[    8.455152] fb_st7735r spi0.0: init: mdelay(10)
[    8.549771] fb_st7735r spi0.0: Display update: 472 kB/s, fps=0
[    8.558155] graphics fb1: fb_st7735r frame buffer, 160x128, 40 KiB video memory, 4 KiB buffer memory, fps=25, spi0.0 at 4 MHz

rudiratlos
Posts: 216
Joined: Tue May 01, 2012 8:47 am
Location: Germany (old europe)

Re: new kernel regression with fbtft

Sun Sep 13, 2020 11:48 am

moving back to 4.19 kernel via

Code: Select all

rpi-update e1050e94821a70b2e4c72b318d6c6c968552e9a2
uname -a
Linux pump 4.19.118-v7+ #1311 SMP Mon Apr 27 14:21:24 BST 2020 armv7l GNU/Linux
it recognizes the dc_pin and reset parameter, display works (with pixel artefacts)

Code: Select all

[    5.407008] fb_st7735r spi0.0: fbtft_request_one_gpio: 'reset-gpios' = GPIO27
[    5.409343] fb_st7735r spi0.0: fbtft_request_one_gpio: 'dc-gpios' = GPIO9

Code: Select all

[    5.403121] fbtft: module is from the staging directory, the quality is unknown, you have been warned.
[    5.406145] fb_st7735r: module is from the staging directory, the quality is unknown, you have been warned.
[    5.406804] fbtft_of_value: buswidth = 8
[    5.406817] fbtft_of_value: bpp = 1
[    5.406821] fbtft_of_value: debug = 3
[    5.406828] fbtft_of_value: rotate = 270
[    5.406833] fbtft_of_value: fps = 25
[    5.406922] fb_st7735r spi0.0: fbtft_gamma_parse_str() str=
[    5.406927] fb_st7735r spi0.0: 02 1c 07 12 37 32 29 2d 29 25 2B 39 00 01 03 10
               03 1d 07 06 2E 2C 29 2D 2E 2E 37 3F 00 00 02 10
[    5.407008] fb_st7735r spi0.0: fbtft_request_one_gpio: 'reset-gpios' = GPIO27
[    5.409343] fb_st7735r spi0.0: fbtft_request_one_gpio: 'dc-gpios' = GPIO9
[    5.409391] fb_st7735r spi0.0: fbtft_verify_gpios()
[    5.409398] fb_st7735r spi0.0: fbtft_reset()
[    5.548817] fb_st7735r spi0.0: init: write(0x01) 
[    5.548864] fb_st7735r spi0.0: init: mdelay(150)
[    5.698899] fb_st7735r spi0.0: init: write(0x11) 
[    5.698985] fb_st7735r spi0.0: init: mdelay(500)
[    6.199019] fb_st7735r spi0.0: init: write(0xB1) 0x01 0x2C 0x2D 
[    6.199104] fb_st7735r spi0.0: init: write(0xB2) 0x01 0x2C 0x2D 
[    6.199137] fb_st7735r spi0.0: init: write(0xB3) 0x01 0x2C 0x2D 0x01 0x2C 0x2D 
[    6.199173] fb_st7735r spi0.0: init: write(0xB4) 0x07 
[    6.199201] fb_st7735r spi0.0: init: write(0xC0) 0xA2 0x02 0x84 
[    6.199230] fb_st7735r spi0.0: init: write(0xC1) 0xC5 
[    6.199254] fb_st7735r spi0.0: init: write(0xC2) 0x0A 0x00 
[    6.199281] fb_st7735r spi0.0: init: write(0xC3) 0x8A 0x2A 
[    6.199310] fb_st7735r spi0.0: init: write(0xC4) 0x8A 0xEE 
[    6.199343] fb_st7735r spi0.0: init: write(0xC5) 0x0E 
[    6.199368] fb_st7735r spi0.0: init: write(0x20) 
[    6.199384] fb_st7735r spi0.0: init: write(0x3A) 0x05 
[    6.199410] fb_st7735r spi0.0: init: write(0x29) 
[    6.199426] fb_st7735r spi0.0: init: mdelay(100)
[    6.299439] fb_st7735r spi0.0: init: write(0x13) 
[    6.299512] fb_st7735r spi0.0: init: mdelay(10)
[    6.394260] fb_st7735r spi0.0: Display update: 471 kB/s, fps=0
[    6.401748] graphics fb1: fb_st7735r frame buffer, 160x128, 40 KiB video memory, 4 KiB buffer memory, fps=25, spi0.0 at 4 MHz

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3886
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: new kernel regression with fbtft

Mon Sep 14, 2020 1:39 pm

Fair enough - try this one:

Code: Select all

/*
 * Device Tree overlay for Adafruit 1.8" TFT LCD with ST7735R chip 160x128
 */

/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2835";

	fragment@0 {
		target = <&spidev0>;
		__overlay__ {
			status = "disabled";
		};
	};

	fragment@1 {
		target = <&spi0>;
		__overlay__ {
			/* needed to avoid dtc warning */
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			af18: adafruit18@0 {
				compatible = "fbtft,adafruit18";
				reg = <0>;
				pinctrl-names = "default";
				spi-max-frequency = <40000000>;
				rotate = <90>;
				buswidth = <8>;
				fps = <50>;
				height = <160>;
				width = <128>;
				reset-gpios = <&gpio 25 0>;
				dc-gpios = <&gpio 24 0>;
				led-gpios = <&gpio 18 0>;
				bgr;
				debug = <0>;
			};
		};
	};

	__overrides__ {
		green = <&af18>, "compatible=fbtft,adafruit18_green";
		speed     = <&af18>,"spi-max-frequency:0";
		rotate    = <&af18>,"rotate:0";
		fps       = <&af18>,"fps:0";
		bgr       = <&af18>,"bgr?";
		debug     = <&af18>,"debug:0";
		dc_pin    = <&af18>,"dc-gpios:4";
		reset_pin = <&af18>,"reset-gpios:4";
		led_pin   = <&af18>,"led-gpios:4";
	};
};

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3886
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: new kernel regression with fbtft

Tue Sep 15, 2020 8:57 am

And if that doesn't work, try this:

Code: Select all

/*
 * Device Tree overlay for Adafruit 1.8" TFT LCD with ST7735R chip 160x128
 */

/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2835";

	fragment@0 {
		target = <&spidev0>;
		__overlay__ {
			status = "disabled";
		};
	};

	fragment@1 {
		target = <&spi0>;
		__overlay__ {
			/* needed to avoid dtc warning */
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			af18: adafruit18@0 {
				compatible = "fbtft,adafruit18";
				reg = <0>;
				pinctrl-names = "default";
				spi-max-frequency = <40000000>;
				rotate = <90>;
				buswidth = <8>;
				fps = <50>;
				height = <160>;
				width = <128>;
				reset-gpios = <&gpio 25 1>;
				dc-gpios = <&gpio 24 0>;
				led-gpios = <&gpio 18 0>;
				bgr;
				debug = <0>;
			};
		};
	};

	__overrides__ {
		green = <&af18>, "compatible=fbtft,adafruit18_green";
		speed     = <&af18>,"spi-max-frequency:0";
		rotate    = <&af18>,"rotate:0";
		fps       = <&af18>,"fps:0";
		bgr       = <&af18>,"bgr?";
		debug     = <&af18>,"debug:0";
		dc_pin    = <&af18>,"dc-gpios:4";
		reset_pin = <&af18>,"reset-gpios:4";
		led_pin   = <&af18>,"led-gpios:4";
	};
};
This overlay marks the reset GPIO as being active-low, something that was necessary for at least one other display under 5.4.

rudiratlos
Posts: 216
Joined: Tue May 01, 2012 8:47 am
Location: Germany (old europe)

Re: new kernel regression with fbtft

Mon Sep 21, 2020 9:23 am

with the following .dts my display (waveshare1.8 / adafruit1.8 green) is working.
pixelartefacts are gone with rotation 0. with rotation 90 (.dts from phil) are still there.
bgr parameter is not working. red pixel appear blue and blue pixel appear red.

my /boot/config.txt

Code: Select all

dtoverlay=adafruit18,green,dc_pin=9,reset_pin=27,debug=3

my /boot/cmdline.txt

Code: Select all

console=serial0,115200 console=tty1 .... rootwait fbcon=map:10 fbcon=rotate:1

Code: Select all

/*
 * Device Tree overlay for Adafruit/Waveshare 1.8" TFT LCD with ST7735 chip 160x128
 *
 * compile:
 * dtc -@ -I dts -Odtc -@ -I dts -O dtb -o /boot/overlays/adafruit18.dtbo adafruit18.dts
 */

/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2835";

	fragment@0 {
		target = <&spidev0>;
		__overlay__ {
			status = "disabled";
		};
	};

	fragment@1 {
		target = <&spi0>;
		__overlay__ {
			/* needed to avoid dtc warning */
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			st7735: st7735@0 {
				compatible = "fbtft,adafruit18";
				reg = <0>;
				pinctrl-names = "default";
				spi-max-frequency = <40000000>;
				rotate = <0>;
				buswidth = <8>;
				fps = <25>;
				height = <160>;
				width = <128>;
				reset-gpios = <&gpio 25 1>;
				dc-gpios = <&gpio 24 0>;
				led-gpios = <&gpio 18 0>;
				bgr = <0>;
				debug = <0>;
			};
		};
	};

	__overrides__ {
		green     = <&st7735>,"compatible=fbtft,adafruit18_green";
		height    = <&st7735>,"height:0";
		width     = <&st7735>,"width:0";
		speed     = <&st7735>,"spi-max-frequency:0";
		rotate    = <&st7735>,"rotate:0";
		fps       = <&st7735>,"fps:0";
		bgr       = <&st7735>,"bgr:0";
		debug     = <&st7735>,"debug:0";
		dc_pin    = <&st7735>,"dc-gpios:4";
		reset_pin = <&st7735>,"reset-gpios:4";
		led_pin   = <&st7735>,"led-gpios:4";
	};
};

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3886
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: new kernel regression with fbtft

Mon Sep 21, 2020 9:39 am

The bgr parameter is a Device Tree boolean - true if the property is present, false if it's absent. This should work better:

Code: Select all

/*
 * Device Tree overlay for Adafruit/Waveshare 1.8" TFT LCD with ST7735 chip 160x128
 *
 * compile:
 * dtc -@ -I dts -Odtc -@ -I dts -O dtb -o /boot/overlays/adafruit18.dtbo adafruit18.dts
 */

/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2835";

	fragment@0 {
		target = <&spidev0>;
		__overlay__ {
			status = "disabled";
		};
	};

	fragment@1 {
		target = <&spi0>;
		__overlay__ {
			/* needed to avoid dtc warning */
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			st7735: st7735@0 {
				compatible = "fbtft,adafruit18";
				reg = <0>;
				pinctrl-names = "default";
				spi-max-frequency = <40000000>;
				rotate = <0>;
				buswidth = <8>;
				fps = <25>;
				height = <160>;
				width = <128>;
				reset-gpios = <&gpio 25 1>;
				dc-gpios = <&gpio 24 0>;
				led-gpios = <&gpio 18 0>;
				debug = <0>;
			};
		};
	};

	__overrides__ {
		green     = <&st7735>,"compatible=fbtft,adafruit18_green";
		height    = <&st7735>,"height:0";
		width     = <&st7735>,"width:0";
		speed     = <&st7735>,"spi-max-frequency:0";
		rotate    = <&st7735>,"rotate:0";
		fps       = <&st7735>,"fps:0";
		bgr       = <&st7735>,"bgr?";
		debug     = <&st7735>,"debug:0";
		dc_pin    = <&st7735>,"dc-gpios:4";
		reset_pin = <&st7735>,"reset-gpios:4";
		led_pin   = <&st7735>,"led-gpios:4";
	};
};
I don't know what to do about the pixel artifacts when the display is rotated.

rudiratlos
Posts: 216
Joined: Tue May 01, 2012 8:47 am
Location: Germany (old europe)

Re: new kernel regression with fbtft

Mon Sep 21, 2020 10:49 am

still not working:

Code: Select all

dtoverlay=adafruit18,green,bgr,dc_pin=9,reset_pin=27,debug=3

Code: Select all

[    4.231045] fb_st7735r: module is from the staging directory, the quality is unknown, you have been warned.
[    4.231436] fbtft_of_value: width = 128
[    4.231443] fbtft_of_value: height = 160
[    4.231450] fbtft_of_value: buswidth = 8
[    4.231458] fbtft_of_value: debug = 3
[    4.231464] fbtft_of_value: rotate = 0
[    4.231471] fbtft_of_value: fps = 25

rudiratlos
Posts: 216
Joined: Tue May 01, 2012 8:47 am
Location: Germany (old europe)

Re: new kernel regression with fbtft

Mon Sep 21, 2020 10:51 am

pixerartefacts are gone, if we use rotate=0 in .dts
and if we do the rotation on application level e.g. gfx library and in cmdline.txt for fbcon.

notro
Posts: 705
Joined: Tue Oct 16, 2012 6:21 pm
Location: Drammen, Norway

Re: new kernel regression with fbtft

Mon Sep 21, 2020 11:33 am

Rotation is panel specific and implemented for a particular panel. The set_var() function uses command 0x36 to set the rotation. The solution for panels for which rotation doesn't work is to uses the init= property to override 0x36, but unfortunately this doesn't work with drivers that has set_var() since it is applied after init().

But rotation didn't work when you used fbtft_device, right?

fbtft is full of strange things since I didn't know anything about these displays and their controllers when I wrote the first drivers (neither did I know anything about the Linux kernel).

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3886
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: new kernel regression with fbtft

Mon Sep 21, 2020 11:59 am

still not working:

Code: Select all

dtoverlay=adafruit18,green,bgr,dc_pin=9,reset_pin=27,debug=3

Code: Select all

[    4.231045] fb_st7735r: module is from the staging directory, the quality is unknown, you have been warned.
[    4.231436] fbtft_of_value: width = 128
[    4.231443] fbtft_of_value: height = 160
[    4.231450] fbtft_of_value: buswidth = 8
[    4.231458] fbtft_of_value: debug = 3
[    4.231464] fbtft_of_value: rotate = 0
[    4.231471] fbtft_of_value: fps = 25
There is no debug output for the bgr property - it is handled by a different function. Are you saying that using the bgr parameter makes no difference?

rudiratlos
Posts: 216
Joined: Tue May 01, 2012 8:47 am
Location: Germany (old europe)

Re: new kernel regression with fbtft

Mon Sep 21, 2020 1:58 pm

using bgr in config.txt makes no difference. red pixels apear blue and blue pixels apear red.
As notro wrote there is a MADCTL (36h) register that flips RGB to BGR color order.

Code: Select all

‘1’ =BGR, (When MADCTL (36h) D3=’1’)
‘0’ =RGB, (When MADCTL (36h) D3=’0’)
I have no idea, how to pass bgr parameter from config.txt to the driver

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3886
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: new kernel regression with fbtft

Mon Sep 21, 2020 2:58 pm

Be careful - there are now multiple versions of the overlay around with different default values.

The last version I posted has BGR mode disabled by default - use "dtoverlay=adafruit,green,bgr" or "dtoverlay=adafruit,green,bgr=on" to enable it.
Other versions have BGR mode enabled by default - use "dtoverlay=adafruit,green,bgr=off" to disable it.
It's clearer and safer to always include either "bgr=on" or "bgr=off". I've seen the driver set the appropriate bit to either a 1 or zero according to the parameter value, so it should work with the real display.

rudiratlos
Posts: 216
Joined: Tue May 01, 2012 8:47 am
Location: Germany (old europe)

Re: new kernel regression with fbtft

Mon Sep 21, 2020 3:56 pm

bgr=off does the trick.

how can I set this parameter to off in .dts file ?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3886
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: new kernel regression with fbtft

Mon Sep 21, 2020 3:59 pm

Delete any line like these:

Code: Select all

		bgr = <0>;
		bgr;

rudiratlos
Posts: 216
Joined: Tue May 01, 2012 8:47 am
Location: Germany (old europe)

Re: new kernel regression with fbtft

Mon Sep 21, 2020 4:08 pm

but if I want to set bgr=on (for other display)?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3886
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: new kernel regression with fbtft

Mon Sep 21, 2020 4:13 pm

Use the parameter.

There are two different things called "bgr" (three if you include the bit in the hardware register) - the property that controls the bit, and the parameter that sets (creates) or clears (deletes) the property. If your overlay includes the property then the BGR bit defaults to on; if your overlay doesn't include the property then the BGR bit defaults to off. As long as you include the parameter declaration (bgr = <&st7735>,"bgr?") then you can always override the default in either direction.

rudiratlos
Posts: 216
Joined: Tue May 01, 2012 8:47 am
Location: Germany (old europe)

Re: new kernel regression with fbtft

Mon Sep 21, 2020 5:00 pm

i have some products in the field, where config.txt doesn't contain bgr=off. and I have my own dtoverlay (not adafruit18), created with my .dts file.
on next update, I just want to copy my new overlay to /boot/overlays. I don't want to write a script that maintains config.txt
in my .dts I just want to set bgr to off as default.

rudiratlos
Posts: 216
Joined: Tue May 01, 2012 8:47 am
Location: Germany (old europe)

Re: new kernel regression with fbtft

Mon Sep 21, 2020 5:07 pm

solved, I've just dropt bgr;
philE, Thank you very much for your support.

micwag
Posts: 4
Joined: Sat Sep 26, 2020 6:04 am

Re: new kernel regression with fbtft

Sun Nov 15, 2020 6:00 am

Hello,
I had recently the same problem with the sainsmart18 display and last linux kernel. My solution was to go back to 4.19.118+.
I see now you found a solution, great.
But I can not follow all the steps...
Can you give a short advice which of the steps are really necessary to get it running?

Thanks
Micha

rudiratlos
Posts: 216
Joined: Tue May 01, 2012 8:47 am
Location: Germany (old europe)

Re: new kernel regression with fbtft

Sun Nov 15, 2020 11:57 am

Hi Micha,
this is my solution:

/boot/cmdline.txt

Code: Select all

console=serial0,115200 console=tty1 ... rootwait fbcon=map:10 fbcon=rotate:1

/boot/config.txt

Code: Select all

dtoverlay=fluidicworks18,green,dc_pin=9,reset_pin=27,debug=3

I've created my own device (fluidicworks18)
fluidicworks18.dts

Code: Select all

/*
 * Device Tree overlay for Adafruit/Waveshare 1.8" TFT LCD with ST7735 chip 160x128
 *
 * compile:
 * dtc -@ -I dts -Odtc -@ -I dts -O dtb -o /boot/overlays/adafruit18.dtbo adafruit18.dts
 */

/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2835";

	fragment@0 {
		target = <&spidev0>;
		__overlay__ {
			status = "disabled";
		};
	};

	fragment@1 {
		target = <&spi0>;
		__overlay__ {
			/* needed to avoid dtc warning */
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			st7735: st7735@0 {
				compatible = "fbtft,adafruit18";
				reg = <0>;
				pinctrl-names = "default";
				spi-max-frequency = <40000000>;
				rotate = <0>;
				buswidth = <8>;
				fps = <25>;
				height = <160>;
				width = <128>;
				reset-gpios = <&gpio 25 1>;
				dc-gpios = <&gpio 24 0>;
				led-gpios = <&gpio 18 0>;
				debug = <0>;
			};
		};
	};

	__overrides__ {
		green     = <&st7735>,"compatible=fbtft,adafruit18_green";
		height    = <&st7735>,"height:0";
		width     = <&st7735>,"width:0";
		speed     = <&st7735>,"spi-max-frequency:0";
		rotate    = <&st7735>,"rotate:0";
		fps       = <&st7735>,"fps:0";
		bgr       = <&st7735>,"bgr?";
		debug     = <&st7735>,"debug:0";
		dc_pin    = <&st7735>,"dc-gpios:4";
		reset_pin = <&st7735>,"reset-gpios:4";
		led_pin   = <&st7735>,"led-gpios:4";
	};
};

COMPILE it:

Code: Select all

dtc -@ -I dts -O dtb -o /boot/overlays/fluidicworks18.dtbo fluidicworks18.dts
my OS version:

Code: Select all

uname -a
Linux pump 5.4.72-v7l+ #1356 SMP Thu Oct 22 13:57:51 BST 2020 armv7l GNU/Linux

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3886
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: new kernel regression with fbtft

Sun Nov 15, 2020 3:02 pm

Note that you will need to use sudo dtc if you want to write the compiled overlay direct to the overlays directory.

micwag
Posts: 4
Joined: Sat Sep 26, 2020 6:04 am

Re: new kernel regression with fbtft

Sun Feb 07, 2021 6:27 pm

Hallo Rudi,
thanks for your response. I did not saw for long time, hence I was not online here. Will check soon, if it is working.

Thanks for support,
Michael

micwag
Posts: 4
Joined: Sat Sep 26, 2020 6:04 am

Re: new kernel regression with fbtft

Mon Mar 29, 2021 5:20 pm

Fiddeled a bit around and got it working now with my SainSmart 1,8" TFT LCD. WIth above one it was not working because parameter of my used screen seems to be different.

created st7735r.dts

Code: Select all

pi@raspberrypi:~ $ nano st7735r.dts
with following content:

Code: Select all

/* Device tree overlay for ST7735R */

/dts-v1/;
/plugin/;

/ {
  compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

  fragment@0 {
    target = <&spi0>;
    __overlay__ {
      status = "okay";
    };
  };

  fragment@1 {
    target = <&spidev0>;
    __overlay__ {
      status = "disabled";
    };
  };

  fragment@2 {
    target = <&gpio>;
    __overlay__ {
      st7735r_display_pins: st7735r_display_pins {
        brcm,pins = <24 25>;
        brcm,function = <1 1>;
        brcm,pull = <0 0>;
      };
    };
  };

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

      st7735rdisplay: st7735r-display@0{
        compatible = "jianda,jd-t18003-t01", "sitronix,st7735r";
        reg = <0>;
        pinctrl-names = "default";
        pinctrl-0 = <&st7735r_display_pins>;

        spi-max-frequency = <32000000>;
        rotation = <270>;
        fps = <20>;
        height = <160>;
        width = <128>;
        buswidth = <8>;
        reset-gpios = <&gpio 25 0>;
        dc-gpios = <&gpio 24 0>;
        debug = <0>;
      };
    };
  };

  __overrides__ {
    speed = <&st7735rdisplay>,"spi-max-frequency:0";
    rotate = <&st7735rdisplay>,"rotation:0";
    fps = <&st7735rdisplay>,"fps:0";
    debug = <&st7735rdisplay>,"debug:0";
  };
};
Compiled with device tree compiler:

Code: Select all

pi@raspberrypi:~ $ sudo dtc -@ -I dts -O dtb -o /boot/overlays/st7735r.dtbo st7735r.dts


Added the device in /boot/config.txt:

Code: Select all

pi@raspberrypi:~ $ sudo nano /boot/config.txt
Added at the end of config.txt

Code: Select all

dtoverlay=st7735r
System restart:

Code: Select all

pi@raspberrypi:~ $ sudo shutdown -r now
Works again, also with buster now!

See also:
https://www.gtkdb.de/index_36_3100.html

Return to “Device Tree”