cancel
Showing results for 
Search instead for 
Did you mean: 

How to stm32mp1 ili9340 parallel RGB LTDC device tree & driver linux kernel

iheb
Associate III

i have been trying to use the LTDC peripheral on the Linux kernel to use it on the ILI9340 / ILI9340 in 8 bit mode.
i use this in the device tree:

 

 

&ltdc {
	status = "okay";

	port {
		#address-cells = <1>;
		#size-cells = <0>;

		ltdc_ep1_out: endpoint@1 {
			reg = <1>;
			remote-endpoint = <&dsi_in>;
		};
	};
};

&dsi {
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";

	ports {
		#address-cells = <1>;
		#size-cells = <0>;

		port@0 {
			reg = <0>;
			dsi_in: endpoint {
				remote-endpoint = <&ltdc_ep1_out>;
			};
		};

		port@1 {
			reg = <1>;
			dsi_out: endpoint {
				remote-endpoint = <&panel_in>;
			};
		};
	};

	panel_ili9341: panel-ili9341@0 {
		compatible = "displaytech,dt024ctft", "ilitek,ili9341";
		reg = <0>;
		reset-gpios = <&gpioe 4 GPIO_ACTIVE_LOW>;
		power-supply = <&v3v3>;
		status = "okay";

		port {
			panel_in: endpoint {
				remote-endpoint = <&dsi_out>;
			};
		};
	};
};


//// 

	ltdc_pins_mx: ltdc_mx-0 {
		pins1 {
			pinmux = <STM32_PINMUX('A', 9, AF14)>, 		/* LTDC_R5 */
					 <STM32_PINMUX('B', 9, AF14)>,  /* LTDC_B7 */
					 <STM32_PINMUX('D', 3, AF14)>,  /* LTDC_G7 */
					 <STM32_PINMUX('E', 13, AF14)>, /* LTDC_DE */
					 <STM32_PINMUX('E', 15, AF14)>, /* LTDC_R7 */
					 <STM32_PINMUX('H', 3, AF14)>,  /* LTDC_R1 */
					 <STM32_PINMUX('H', 4, AF9)>,   /* LTDC_G5 */
					 <STM32_PINMUX('H', 12, AF14)>, /* LTDC_R6 */
					 <STM32_PINMUX('I', 1, AF14)>,  /* LTDC_G6 */
					 <STM32_PINMUX('I', 6, AF14)>,  /* LTDC_B6 */
					 <STM32_PINMUX('I', 9, AF14)>,  /* LTDC_VSYNC */
					 <STM32_PINMUX('I', 10, AF14)>; /* LTDC_HSYNC */
			bias-disable;
			drive-push-pull;
			slew-rate = <0>;
		};
		pins2 {
			pinmux = <STM32_PINMUX('E', 14, AF14)>; /* LTDC_CLK */
			bias-disable;
			drive-push-pull;
			slew-rate = <1>;
		};
	};

	ltdc_sleep_pins_mx: ltdc_sleep_mx-0 {
		pins {
			pinmux = <STM32_PINMUX('A', 9, ANALOG)>, /* LTDC_R5 */
					 <STM32_PINMUX('B', 9, ANALOG)>,  /* LTDC_B7 */
					 <STM32_PINMUX('D', 3, ANALOG)>,  /* LTDC_G7 */
					 <STM32_PINMUX('E', 13, ANALOG)>, /* LTDC_DE */
					 <STM32_PINMUX('E', 14, ANALOG)>, /* LTDC_CLK */
					 <STM32_PINMUX('E', 15, ANALOG)>, /* LTDC_R7 */
					 <STM32_PINMUX('H', 3, ANALOG)>,  /* LTDC_R1 */
					 <STM32_PINMUX('H', 4, ANALOG)>,  /* LTDC_G5 */
					 <STM32_PINMUX('H', 12, ANALOG)>, /* LTDC_R6 */
					 <STM32_PINMUX('I', 1, ANALOG)>,  /* LTDC_G6 */
					 <STM32_PINMUX('I', 6, ANALOG)>,  /* LTDC_B6 */
					 <STM32_PINMUX('I', 9, ANALOG)>, /* LTDC_VSYNC */
					 <STM32_PINMUX('I', 10, ANALOG)>; /* LTDC_HSYNC */
		};
	};

 

 

now this seems to compile fine , however i have nothing shown in the device
i use this command to see what is going on
$>  modetest -M stm
this yeilds the following

 

 

root@stm32mp157c:~# id	crtc	type	possible crtcs	possible clones	

Connectors:
id	encoder	status		name		size (mm)	modes	encoders

CRTCs:
id	fb	pos	size
33	0	(0,0)	(0x0)
  #0  nan 0 0 0 0 0 0 0 0 0 flags: ; type: 
  props:
	24 VRR_ENABLED:
		flags: range
		values: 0 1
		value: 0
	28 GAMMA_LUT:
		flags: blob
		blobs:

		value:
	29 GAMMA_LUT_SIZE:
		flags: immutable range
		values: 0 4294967295
		value: 256

Planes:
id	crtc	fb	CRTC x,y	x,y	gamma size	possible crtcs
31	0	0	0,0		0,0	0       	0x00000001
  formats: AR24 XR24 RG24 RG16 AR15 XR15 AR12 XR12 C8  
  props:
	8 type:
		flags: immutable enum
		enums: Overlay=0 Primary=1 Cursor=2
		value: 1
	30 IN_FORMATS:
		flags: immutable blob
		blobs:

		value:
			01000000000000000900000018000000
			01000000400000004152323458523234
			52473234524731364152313558523135
			41523132585231324338202000000000
			ff010000000000000000000000000000
			0000000000000000
		in_formats blob decoded:
			 AR24:  LINEAR
			 XR24:  LINEAR
			 RG24:  LINEAR
			 RG16:  LINEAR
			 AR15:  LINEAR
			 XR15:  LINEAR
			 AR12:  LINEAR
			 XR12:  LINEAR
			 C8  :  LINEAR
34	0	0	0,0		0,0	0       	0x00000001
  formats: AR24 RG24 RG16 AR15 AR12 C8  
  props:
	8 type:
		flags: immutable enum
		enums: Overlay=0 Primary=1 Cursor=2
		value: 0
	30 IN_FORMATS:
		flags: immutable blob
		blobs:

		value:
			01000000000000000600000018000000
			01000000300000004152323452473234
			52473136415231354152313243382020
			3f000000000000000000000000000000
			0000000000000000
		in_formats blob decoded:
			 AR24:  LINEAR
			 RG24:  LINEAR
			 RG16:  LINEAR
			 AR15:  LINEAR
			 AR12:  LINEAR
			 C8  :  LINEAR

Frame buffers:
id	size	pitch

 

 

This means that the device is not well configured since there are no connectors or devices,

now this driver sources seem to exist in the linux kernel source folder upon searching. however at this point i don't know if doing the right things or if im in the right path ? can any one help and tell me why im not finding any connectors ? or how to get this working properly
Many Thanks

1 REPLY 1
TommyTom
Associate II

I'm no expert, but I think the DSI interface is completely separate to the LTCD system, and the ILI9340 does not support DSI. LTDC on the STM32 products is what the ILI datasheets calls the "8080" interface. In the device tree you need to set up the LTDC interface, as you have done, and then point it to a "panel", instead of DSI.

\ {
...
	// Orient Display 480x272
	panel {
		status = "okay";
		compatible = "qiaodian,qd43003c0-40", "simple-panel";
		power-supply = <&vdd>;
		ports {
			#address-cells = <1>;
			#size-cells = <0>;

			port@0 {
				reg = <0>;
				panel_in: endpoint {
					remote-endpoint = <&ltdc_ep0_out>;
				};
			};
		};
	};
};

...

&ltdc {
	status = "okay";
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&ltdc_pins_mx>;
	pinctrl-1 = <&ltdc_sleep_pins_mx>;

	port {
		ltdc_ep0_out: endpoint@0 {
			reg = <0>;
			remote-endpoint = <&panel_in>;
		};
	};
};

 This is an example from a project I did previously using an Orient Display which has the same "8080" interface as the ILI chips, change the "compatible" string to your ILI chip. Here's the full DTS for context if it helps:

STM32MP151_Dev_Board_Buildroot/board/stm32mp151_dev_board/stm32mp151_dev_board.dts at main · BasicCode/STM32MP151_Dev_Board_Buildroot (github.com) 

Not sure if that's what you were after, but I did have a similar confusion when trying to get an ILI display working on the STM32157-DK2 and got there eventually but I don't have the actual code anymore, sorry.