Personal tools

Connecting the DLPDLCR2000EVM projector kit to VisionSOM-STM32MP1

From SomLabs Wiki

Jump to: navigation, search

Connecting the DLPDLCR2000EVM projector kit to VisionSOM-STM32MP1


This tutorial shows how to prepare the system running on the VisionSOM-STM32MP1 module and the VisionCB-STM32MP1-STD carrier board to support the DLPDLCR2000EVM projector kit. The projector can be connected to the RGB LCD Connector of carrier board using an appropriate adapter. The hardware design files are provided here: SoMLabs-DLP-adapter.zip.

Www-DLP-STM32.jpg
Www-DLP-modul.jpg


Preparing the meta-layer

This example is based on the SoMLabs meta-layer for OpenSTLinux that can be obtained and built as described in this tutorial. The projector support can be added by modifying the following recipes in the meta-somlabs layer.

Kernel recipe

The kernel requires a patch that adds the support for the projector kit as a simple panel class. The patch file should be added to the recipe directory: meta-somlabs/recipes-kernel/linux/linux-stm32mp/0001-Added-dlp2000-projector-support.patch

From 39014344e85c8d93cf015e092d44012b3ebfdb6e Mon Sep 17 00:00:00 2001
From: Krzysztof Chojnowski <krzysztof.chojnowski@somlabs.com>
Date: Wed, 22 Apr 2020 15:16:32 +0200
Subject: [PATCH] Added dlp2000 projector support

---
 drivers/gpu/drm/panel/panel-simple.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 2db80f011..6eb7cd053 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1923,6 +1923,31 @@ static const struct panel_desc powertip_ph800480t013_ibc17 = {
 	.bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_NEGEDGE,
 };
 
+static const struct drm_display_mode ti_dlp2000_mode = {
+        .clock = 26000,
+        .hdisplay = 640,
+        .hsync_start = 640 + 14,
+        .hsync_end = 640 + 14 + 12,
+        .htotal = 640 + 14 + 12 + 4,
+        .vdisplay = 480,
+        .vsync_start = 480 + 2,
+        .vsync_end = 480 + 2 + 9,
+        .vtotal = 480 + 22 + 9 + 3,
+        .vrefresh = 60,
+};
+
+static const struct panel_desc ti_dlp2000 = {
+        .modes = &ti_dlp2000_mode,
+        .num_modes = 1,
+        .bpc = 6,
+        .size = {
+                .width = 154,
+                .height = 85,
+        },
+        .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
+        .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_NEGEDGE,
+};
+
 static const struct drm_display_mode qd43003c0_40_mode = {
 	.clock = 9000,
 	.hdisplay = 480,
@@ -2562,6 +2587,9 @@ static const struct of_device_id platform_of_match[] = {
 		.compatible = "powertip,ph800480t013-ibc17",
 		.data = &powertip_ph800480t013_ibc17,
 	}, {
+		.compatible = "ti,dlp2000",
+                .data = &ti_dlp2000,
+        }, {
 		.compatible = "qiaodian,qd43003c0-40",
 		.data = &qd43003c0_40,
 	}, {

The patch will be applied to the kernel sources after adding the following line to the bbappend file: meta-somlabs/recipes-kernel/linux/linux-stm32mp_4.19.bbappend to the existing patches list:

file://0001-Added-dlp2000-projector-support.patch

Device tree

The device tree file is located in the directory meta-somlabs/mx/visionsom-mx/kernel. By default it contains the configuration for Powertip PH800480T013 display, so it needs to be changed to the projector device added in the already mentioned kernel patch:

	panel {
		compatible = "ti,dlp2000", "simple-panel";

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

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

Configuration recipe

In order to configure the projector at system boot a new recipe may be added: meta-somlabs/recipes-somlabs/somlabs-config/somlabs-config.bb.

DESCRIPTION = "SoMLabs custom configuration scripts"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/BSD-3-Clause;md5=550794465ba0ec5312d6919e203a55f9"

#RDEPENDS_${PN} += "initscripts"
DEPENDS_append = " update-rc.d-native"

SRC_URI += " \
	file://projector.sh \
	"

do_install() {
	install -d ${D}${sysconfdir}
	install -d ${D}${sysconfdir}/init.d/
	install -m 0755 ${WORKDIR}/projector.sh ${D}${sysconfdir}/init.d/projector.sh
	update-rc.d -r ${D} projector.sh start 99 3 5 .
}

CONFFILES_${PN} = "${sysconfdir}/init.d/projector.sh"

The recipe bb file installs the projector.sh initialization script located in the meta-somlabs/recipes-somlabs/somlabs-config/somlabs-config directory:

#!/bin/sh

case $1 in
	start)
		echo 63 > /sys/class/gpio/export
		echo out > /sys/class/gpio/gpio63/direction
		echo 63 > /sys/class/gpio/gpio63/value
		i2cset -y 0 0x1b 0x0b 0x00 0x00 0x00 0x00 i
		i2cset -y 0 0x1b 0x0c 0x00 0x00 0x00 0x07 i
		i2cset -y 0 0x1b 0x0d 0x00 0x00 0x00 0x02 i
		;;
esac
exit 0

This script performs the additional configuration and enables the projector using the I2C and GPIO interfaces. Setting the correct signal source and image resolution is realized using the i2cset tool and the GPIO is controlled using the /sys/class/gpio subsystem.

Finally, the new recipe needs to be added to the IMAGE_INSTALL list in the meta-somlabs/recipes-st/images/st-image-weston.bbappend file by putting the recipe name in the existing list:

somlabs-config
NXP Partner ST Partner