Grok (Twitter A.I.) might be stuck. I need expert help from the geniuses in here

I will try to keep it short and on point

What I have:

Issue:
I’ve going at this for a couple days now a few hours after work.
I can get the display to work without any issues with Raspberry Pi OS and was even able to switch display orientation and touch, so no issue with Raspberry Pi OS.

Here’s the display config for raspberry PI OS
dtoverlay=vc4-kms-v3d
dtoverlay=waveshare-28dpi-3b-4b
dtoverlay=waveshare-28dpi-3b
dtoverlay=waveshare-28dpi-4b
dtoverlay=waveshare-touch-28dpi
dtoverlay=vc4-kms-dpi-2inch8
enable_dpi_lcd=1
display_default_lcd=1

Issue I’m having is with Zynthian OS. After playing with it first couple days, i arrived with this display config:

enable_dpi_lcd=1
display_default_lcd=1
dpi_group=2
dpi_mode=87
dpi_output_format=0x7F216
hdmi_timings=480 0 26 16 10 640 0 25 10 15 0 0 0 60 0 32000000 1
dtoverlay=waveshare-28dpi-3b-4b
dtoverlay=waveshare-28dpi-4b
dtoverlay=waveshare-touch-28dpi

#0: rotate 0 degrees; 1: rotate 90 degrees; 2: rotate 180 degrees; 3: rotate 270 degrees
display_rotate=1

This config is very different than what i had for raspberry Pi OS.
with this display config, **webconf does not work. ** after some analysis myself and with Grok’s help, i found out that there’s a conflict. The WebConf failure is due to zynthian-webconf expecting /dev/i2c-1, but the Waveshare touch overlay uses /dev/i2c-22, and hdmi_timings triggers a GPIO conflict preventing I2C1.
Grok is suggesting modifying webconf to use I2C-22 which is where I stopped and came here to ask instead. I don’t want to do that and mess something else up.

Any help would be greatly appreciated.
Thanks.

Also want to mention that i have other issues with display rotation versus touch but i wanted to see if i could fix that in webconf whihc is how i found out it was not working. Just want to tackle this 1 issue at a time.

Thanks @Hans_JB , Me too. I think you did a great job presenting the issue concisely.

I think that actually might be your best move, if you feel comfortable making a change like that. If you do try that, it would be great if you could change webconf to not be sensitive to something like I2C pins-definition, since it doesn’t seem like it should really know anything about the hardware screen. Then your change would be helpful, and you could do a Pull Request for it. I would suggest entering a trouble report, and it might make sense to still do so, but I fear that the response might be that a Pi400 is not supported.

It might be helpful to see the config that works with raspberry Pi OS.

Disclaimer:

I consider myself a competent level one support person, maybe on some good days level two or three (IBM Support Center definitions), for some questions on some parts of Zynthian. One of the “geniuses in here” might come along with a much better-easier answer.

Unrelated to your issue (at least directly):

I’m really interested in LLM/AI - any chance we could see the transcript of your interaction with Grok, either here or via DM?

Screens, and specifically waveshare ones had a long and fairly dis-honourable history around here.

Quite why is open to speculation and prejudice. @ribans maintenance tool certainly cleaned up many of the early issues ( see posts passim) but as Pi’s move on there always seems to be a succession of problems.

The best analysis I’ve seen is that this is an area awash with clones of one sort and another and the code on them doesn’t always include all the required functions.
As we have a fairly limited ( in Internet terms) user base and as you have discovered our use case is different from the mainstream Pi implementation in terms of expected presentation and conflicts.

Sadly this is no more than a statement of situation not a resolution, but the well stated situation report you have delivered is a great help in this regards. I did have further insight in my attempts in this direction by stripping the zynth to just screen & Pi and building from their, but I have three screens from the same supplier ( heavily discounted on the appearance of the Pi4) and two of them behave similarly and one doesn’t.

Thanks for the reply @tunagenes.

  • I’ve edited my first post to include the display config that works with latest Bookworm
  • I don’t feel that comfortable making a change like that but i’m willing to give it a try.
  • Yes i am aware RPi 400 is not supported but managed to get Zynthina working with it for a while now thanks to @jofemodo’s help.
  • I can definitely send you the transcript of my interaction with Grok via PM. I was pleasantly surprised. A lot of things i tried myself by researching but I got similar answers from Grok. It’s my first time using it and saved a lot of back and forth between me and the great people like you that helps around here.
1 Like

Yes, you are correct. Waveshare and Zynthian are not best friends based on the drivers they used and how they operate but you can get them to work with some patience. I have a few of them and i can get all of them to work with zynthian right except for the 2.8 inch which is very close to working once i figure out the orientation, touch orientation and webconf issue.

FYI, this DPI display use quiet all the GPIOs (other little LCD are usually on the SPI bus). You wont be able to use a DAC or a serial MIDI interface (standard MIDI DIN connector).

Yes I’m aware. Unfortunately, it’s one of the displays that best fit what I’m trying to do. The plan is to use usb to connect any controllers i plan to use with it instead of going the GPIO route.

@tunagenes . I PM’d you the convo.
I had to copy and paste and it’s not perfect. Looks like there’s not a good way to differentiate between my replies and Grok’s so i had to manually add them for the first few times. got tired after that so the rest will have to stay as is :joy:
let me know if you have any questions.
thanks

1 Like

I’ve been using Waveshare since the first Zynthian I built… I changed 3 of them, the first two to have bigger ones (from '3.5 to '4,3), the third ('7) in my second Zynthian that only has the touch and not the encoders. Honestly I’ve never had any problems… I’m not a particularly lucky person, so I don’t think I was lucky this time…

1 Like

Waveshare are sending me some surface mount ICs that need to be swapped to fix the issue with touch failing if the screen is touched during boot. It’s not exactly the simplest firmware update!!!

I copied @riban 's post to USB touch screen problem on 7" inch HDMI - #20 by tunagenes, I think this is where it actually belongs. Although I think it is of some interest to this thread as well.

1 Like

Hi @Hans_JB - Have you made any progress on this? If not, I have a couple of ideas on how to proceed, they are not mutually exclusive:

You could try to figure out (perhaps with Grok’s help?) why these changes are necessary - after all ZynthianOS is actually Bookworm. I believe the kernel is not even recompiled for Zynthian (per @jofemodo ). I’m not sure that will actually lead to a solution though.

That’s the change to webconf to use i2c-22 instead of i2c-1 as Grok suggested. Now I hesitate to disagree with Grok, but I don’t see why webconf has to use any I2C interface at all. It’s interacting via HTML, right? I say this without having looked at webconf at all. I have read in this forum about it a little, and I know it somehow uses the tornado package to be a web server, and a search on tornado does yield some interesting results. I cannot guarantee that changing it will not cause some other problem to pop out, but unless somebody else (@riban , @jofemodo @wyleu @Lanfranco @le51 @Baggypants @???) chimes in with a better answer, I don’t see any other approach.

And may the Force be with you…

1 Like

… to be mentioned in the middle of this group of prepared people, flatters me… but I am not prepared. For me the Waveshare displays worked perfectly (3 out of 3), I use the Raspy 5, the non-technical question that comes to mind is: If it works for me, why doesn’t it work for others? :thinking:

No, I haven’t had the chance to dive more into it. Doing some house updates, remodeling and such.
Having webconf to use a different I2C was weird to me and why i heasitated to do that change and because every update woukd require me to have to redo it.
I feel the same way and think that if it works with bookworm it should definitely work with Zynthian. Once i have sone free time i will definitely continue.
Anything you think i should try feel free to send it my way.
Thanks

1 Like

I only have issues with stuff that requires extra drivers. Like the CM4-Display base IO https://www.waveshare.com/wiki/CM4-DISP-BASE-5A. I manage to get it working but not with what they shared on tbeir site. I even contacted their support and they told me to get the newer version which fixed and issue with bookworm due to some resistors/IC combo. As an engineer I found that weird because i work on both milatry and commercial stuff and you dont design the way they design.
Like i said, i got the cm4-display IO to work with bookworm and zynthian with some config files manipulation.

Every orher DSI display i have from waveshare i have no issues with.

you will have to add the i2c2 overlay in config.txt

What are exactly your troubles now ?

I don’t want to modify the webconf to use a different I2C to avoid a conflict with the display. Also I’m not sold on the fact that webconf uses a specific I2C. I might be wrong but that’s what Grok (AI) suggested

I didn’t find any schematic of your display, but looking closely at this picture:

Power, 3.3V and 5V are on the left side of picture. Usual I2C1 pins (close from 3.3V are used for the DPI interface. (left upper row, look at the zig zag of the track)

the touch function (capacitive for sure) is done with the second fpc connector and is maybe connected to i2c2 i2c0 (look there’s “SDA SCL” on the fpc and and pcb tracks are routed to pins n° 19 & 23).

Just use the custom config choice in webconf and put in there the config that is working under RaspiOs.

I’ve decompiled waveshare-touch-28dpi.dtbo, command is:

dtc -I dtb -O dts -o waveshare-touch-28dpi.dts waveshare-touch-28dpi.dtbo

and waveshare-touch-28dpi.dts looks like this

/dts-v1/;

/ {
	compatible = "brcm,bcm2708\0brcm,bcm2711\0brcm,bcm2712";

	fragment@0 {
		target-path = "/";

		__overlay__ {

			rpi_backlight {
				compatible = "gpio-backlight";
				gpios = <0xffffffff 0x12 0x00>;
				default-on;
				pinctrl-names = "default";
			};
		};
	};

	fragment@1 {
		target-path = "/";

		__overlay__ {

			i2c@0 {
				compatible = "i2c-gpio";
				gpios = <0xffffffff 0x0a 0x00 0xffffffff 0x0b 0x00>;
				i2c-gpio,delay-us = <0x04>;
				#address-cells = <0x01>;
				#size-cells = <0x00>;
				phandle = <0x01>;
			};
		};
	};

	fragment@2 {
		target = <0x01>;

		__overlay__ {
			#address-cells = <0x01>;
			#size-cells = <0x00>;

			ft6236@14 {
				compatible = "goodix,gt911";
				reg = <0x14>;
				interrupt-parent = <0xffffffff>;
				irq-gpios = <0xffffffff 0x1b 0x02>;
				touchscreen-size-x = <0x1e0>;
				touchscreen-size-y = <0x280>;
				touchscreen-x-mm = <0x2b>;
				touchscreen-y-mm = <0x3a>;
				touchscreen-swapped-x-y;
				touchscreen-inverted-y;
			};

			ft6236@5d {
				compatible = "goodix,gt911";
				reg = <0x5d>;
				interrupt-parent = <0xffffffff>;
				irq-gpios = <0xffffffff 0x1b 0x02>;
				touchscreen-size-x = <0x1e0>;
				touchscreen-size-y = <0x280>;
				touchscreen-x-mm = <0x2b>;
				touchscreen-y-mm = <0x3a>;
				touchscreen-swapped-x-y;
				touchscreen-inverted-y;
			};
		};
	};

	__overrides__ {
		touchscreen-inverted-x = [00 00 00 00 2b 32 00];
		touchscreen-inverted-y = [00 00 00 00 2d 33 00];
		touchscreen-swapped-x-y = [00 00 00 00 2d 31 00];
	};

	__fixups__ {
		gpio = "/fragment@0/__overlay__/rpi_backlight:gpios:0\0/fragment@1/__overlay__/i2c@0:gpios:0\0/fragment@1/__overlay__/i2c@0:gpios:12\0/fragment@2/__overlay__/ft6236@14:interrupt-parent:0\0/fragment@2/__overlay__/ft6236@14:irq-gpios:0\0/fragment@2/__overlay__/ft6236@5d:interrupt-parent:0\0/fragment@2/__overlay__/ft6236@5d:irq-gpios:0";
	};

	__local_fixups__ {

		fragment@2 {
			target = <0x00>;
		};
	};
};

So, it takes care of setting up the alternate i2c port for the touch interface, while (I guess) vc4-kms-dpi-2inch8.dtbo should define all specific display panel timings, initialization and so on:

/dts-v1/;

/ {
	compatible = "brcm,bcm2835";

	fragment@100 {
		target-path = "/";

		__overlay__ {

			panel {
				rotation = <0x00>;
				phandle = <0x03>;

				port {

					endpoint {
						remote-endpoint = <0x01>;
						phandle = <0x02>;
					};
				};
			};
		};
	};

	fragment@101 {
		target = <0xffffffff>;

		__overlay__ {
			status = "okay";
			pinctrl-names = "default";
			phandle = <0x0a>;

			port {

				endpoint {
					remote-endpoint = <0x02>;
					phandle = <0x01>;
				};
			};
		};
	};

	fragment@102 {
		target = <0x03>;

		__dormant__ {
			backlight = <0x04>;
		};
	};

	fragment@103 {
		target-path = "/";

		__dormant__ {

			backlight {
				compatible = "gpio-backlight";
				gpios = <0xffffffff 0xff 0x00>;
				phandle = <0x04>;
			};
		};
	};

	fragment@104 {
		target = <0x03>;

		__dormant__ {
			backlight = <0x05>;
		};
	};

	fragment@105 {
		target-path = "/";

		__dormant__ {

			backlight_pwm {
				compatible = "pwm-backlight";
				brightness-levels = <0x00 0x06 0x08 0x0c 0x10 0x18 0x20 0x28 0x30 0x40 0x60 0x80 0xa0 0xc0 0xe0 0xff>;
				default-brightness-level = <0x10>;
				pwms = <0xffffffff 0x00 0x30d40>;
				phandle = <0x05>;
			};
		};
	};

	fragment@106 {
		target = <0xffffffff>;

		__dormant__ {
			pinctrl-names = "default";
			pinctrl-0 = <0x06>;
			assigned-clock-rates = <0xf4240>;
			status = "okay";
		};
	};

	fragment@107 {
		target = <0xffffffff>;

		__dormant__ {

			pwm_pins {
				brcm,pins = <0x12>;
				brcm,function = <0x02>;
				phandle = <0x06>;
			};
		};
	};

	fragment@108 {
		target = <0xffffffff>;

		__dormant__ {
			bootargs = "snd_bcm2835.enable_headphones=0";
		};
	};

	__overrides__ {
		backlight-gpio = [00 00 00 00 2b 31 30 32 2b 31 30 33 00 00 00 00 04 67 70 69 6f 73 3a 34 00];
		backlight-pwm = "\0\0\0\0+104+105+106+107+108";
		backlight-pwm-chan = [00 00 00 05 70 77 6d 73 3a 34 00];
		backlight-pwm-gpio = <0x06 0x6272636d 0x2c70696e 0x733a3000>;
		backlight-pwm-func = <0x06 0x6272636d 0x2c66756e 0x6374696f 0x6e3a3000>;
		backlight-def-brightness = [00 00 00 05 64 65 66 61 75 6c 74 2d 62 72 69 67 68 74 6e 65 73 73 2d 6c 65 76 65 6c 3a 30 00];
		rotate = [00 00 00 03 72 6f 74 61 74 69 6f 6e 3a 30 00];
		clock-frequency = "\0\0\0\aclock-frequency:0";
		hactive = "\0\0\0\ahactive:0";
		hfp = "\0\0\0\ahfront-porch:0";
		hsync = "\0\0\0\ahsync-len:0";
		hbp = "\0\0\0\ahback-porch:0";
		vactive = "\0\0\0\avactive:0";
		vfp = "\0\0\0\avfront-porch:0";
		vsync = "\0\0\0\avsync-len:0";
		vbp = "\0\0\0\avback-porch:0";
		hsync-invert = "\0\0\0\ahsync-active:0=0";
		vsync-invert = "\0\0\0\avsync-active:0=0";
		de-invert = "\0\0\0\ade-active:0=0";
		pixclk-invert = "\0\0\0\apixelclk-active:0=0";
		width-mm = [00 00 00 03 77 69 64 74 68 2d 6d 6d 3a 30 00];
		height-mm = <0x03 0x68656967 0x68742d6d 0x6d3a3000>;
		rgb565 = [00 00 00 08 62 75 73 2d 66 6f 72 6d 61 74 3a 30 3d 30 78 31 30 31 37 00 00 00 00 09 70 69 6e 63 74 72 6c 2d 30 3a 30 3d 00 ff ff ff ff];
		rgb565-padhi = [00 00 00 08 62 75 73 2d 66 6f 72 6d 61 74 3a 30 3d 30 78 31 30 32 32 00 00 00 00 09 70 69 6e 63 74 72 6c 2d 30 3a 30 3d 00 ff ff ff ff];
		bgr666 = "\0\0\0\bbus-format:0=0x1023";
		bgr666-padhi = [00 00 00 08 62 75 73 2d 66 6f 72 6d 61 74 3a 30 3d 30 78 31 30 32 34 00 00 00 00 09 70 69 6e 63 74 72 6c 2d 30 3a 30 3d 00 ff ff ff ff];
		rgb666-padhi = [00 00 00 08 62 75 73 2d 66 6f 72 6d 61 74 3a 30 3d 30 78 31 30 31 35 00 00 00 00 09 70 69 6e 63 74 72 6c 2d 30 3a 30 3d 00 ff ff ff ff];
		bgr888 = [00 00 00 08 62 75 73 2d 66 6f 72 6d 61 74 3a 30 3d 30 78 31 30 31 33 00 00 00 00 09 70 69 6e 63 74 72 6c 2d 30 3a 30 3d 00 ff ff ff ff];
		rgb888 = [00 00 00 08 62 75 73 2d 66 6f 72 6d 61 74 3a 30 3d 30 78 31 30 30 61 00 00 00 00 09 70 69 6e 63 74 72 6c 2d 30 3a 30 3d 00 ff ff ff ff];
		bus-format = "\0\0\0\bbus-format:0";
	};

	fragment@0 {
		target = <0x03>;

		__overlay__ {
			compatible = "panel-dpi";
			width-mm = <0x39>;
			height-mm = <0x2b>;
			bus-format = <0x1015>;
			phandle = <0x08>;

			panel-timing {
				clock-frequency = <0x19a2800>;
				hactive = <0x1e0>;
				hfront-porch = <0x41>;
				hsync-len = <0x1e>;
				hback-porch = <0x41>;
				hsync-active = <0x00>;
				vactive = <0x280>;
				vfront-porch = <0x19>;
				vsync-len = <0x0a>;
				vback-porch = <0x19>;
				vsync-active = <0x00>;
				de-active = <0x01>;
				pixelclk-active = <0x00>;
				phandle = <0x07>;
			};
		};
	};

	fragment@1 {
		target = <0xffffffff>;

		__overlay__ {
			pinctrl-0 = <0xffffffff>;
			phandle = <0x09>;
		};
	};

	__symbols__ {
		panel = "/fragment@100/__overlay__/panel";
		panel_in = "/fragment@100/__overlay__/panel/port/endpoint";
		dpi_node = "/fragment@101/__overlay__";
		dpi_out = "/fragment@101/__overlay__/port/endpoint";
		backlight = "/fragment@103/__dormant__/backlight";
		backlight_pwm = "/fragment@105/__dormant__/backlight_pwm";
		pwm_pins = "/fragment@107/__dormant__/pwm_pins";
		panel_generic = "/fragment@0/__overlay__";
		timing = "/fragment@0/__overlay__/panel-timing";
		dpi_node_generic = "/fragment@1/__overlay__";
	};

	__fixups__ {
		dpi = "/fragment@101:target:0\0/fragment@1:target:0";
		gpio = "/fragment@103/__dormant__/backlight:gpios:0\0/fragment@107:target:0";
		pwm = "/fragment@105/__dormant__/backlight_pwm:pwms:0\0/fragment@106:target:0";
		chosen = "/fragment@108:target:0";
		dpi_18bit_cpadhi_gpio0 = "/fragment@1/__overlay__:pinctrl-0:0";
	};

	__local_fixups__ {

		fragment@100 {

			__overlay__ {

				panel {

					port {

						endpoint {
							remote-endpoint = <0x00>;
						};
					};
				};
			};
		};

		fragment@101 {

			__overlay__ {

				port {

					endpoint {
						remote-endpoint = <0x00>;
					};
				};
			};
		};

		fragment@102 {
			target = <0x00>;

			__dormant__ {
				backlight = <0x00>;
			};
		};

		fragment@104 {
			target = <0x00>;

			__dormant__ {
				backlight = <0x00>;
			};
		};

		fragment@106 {

			__dormant__ {
				pinctrl-0 = <0x00>;
			};
		};

		__overrides__ {
			backlight-gpio = <0x0d>;
			backlight-pwm-chan = <0x00>;
			backlight-pwm-gpio = <0x00>;
			backlight-pwm-func = <0x00>;
			backlight-def-brightness = <0x00>;
			rotate = <0x00>;
			clock-frequency = <0x00>;
			hactive = <0x00>;
			hfp = <0x00>;
			hsync = <0x00>;
			hbp = <0x00>;
			vactive = <0x00>;
			vfp = <0x00>;
			vsync = <0x00>;
			vbp = <0x00>;
			hsync-invert = <0x00>;
			vsync-invert = <0x00>;
			de-invert = <0x00>;
			pixclk-invert = <0x00>;
			width-mm = <0x00>;
			height-mm = <0x00>;
			rgb565 = <0x00 0x18>;
			rgb565-padhi = <0x00 0x18>;
			bgr666 = <0x00>;
			bgr666-padhi = <0x00 0x18>;
			rgb666-padhi = <0x00 0x18>;
			bgr888 = <0x00 0x18>;
			rgb888 = <0x00 0x18>;
			bus-format = <0x00>;
		};

		fragment@0 {
			target = <0x00>;
		};
	};
};

The only mystery to me, is, I can’t find any doc about

enable_dpi_lcd=1

wich should, I believe, declare all the GPIOs used by the DPI interface.

Thanks for all this.

That’s the first thing i did and did not work. I tried modifying it in different ways. I can see the backlight but nothing is displayed. Looks like display panel timing was off. Hdmi_timing for some reason is one of the things that works which makes no sense to me.

If you notice in my first post, the display config that works for zynthian but kills webconf does not incluse any vc4-kms…for whatever reason when that’s included i get no display at all.

I did pay attention to the traces like u did before but decided to ignore them after because it did not help my situation

Best i can do is start from scratch again and try a few other things.