qphan734
Posts: 5
Joined: Sun Jul 15, 2018 6:38 pm

Help getting DPI touchscreen to work on Compute Module 3

Mon Jul 16, 2018 6:02 am

Hi Everyone,

I am trying to get a touchscreen to work with the Compute Module 3. The datasheet for the touchscreen I am using is here:
https://www.dropbox.com/s/4qhjoxcnwvo52 ... C.PDF?dl=0.

After doing some research and experimentation, I was able to get the screen to display correctly using the following settings in the /boot/config.txt file. Below is the setting I used:

Code: Select all

#Disable SPI and I2C pins - only for Raspberry Pi Boards, not Compute Modules???
dtparam=i2c_arm=on

# Overlay Settings
dtoverlay=dpi24

# Overscan settings
overscan_left=0
overscan_right=0
overscan_top=0
overscan_bottom=0
framebuffer_width=320
framebuffer_height=240

#Enable the lcd, , set as the default output.
enable_dpi_lcd=1
display_default_lcd=1

# Custom Display CVT and HDMI Timings for LCD
dpi_group=2
dpi_mode=87

# For details on these values, see the following:
# https://www.raspberrypi.org/documentation/hardware/raspberrypi/dpi/README.md
# http://blog.reasonablycorrect.com/raw-dpi-raspberry-pi/
dpi_output_format=0x1C017
hdmi_timings=320 0 20 0 68 240 0 4 0 18 0 0 0 60 0 40000000 1
Since I am using the all the pins for the full 24-bit RGB for the DPI display, I need to move the I2C SDA and SD0 to a different location for the touch panel (GPIO 28,29). I have wired the following pins (SCL, SDA, Vdd, GND) directly to GPIO 28, GPIO 29, 3.3V, and GND of the CM3 IO board (J6). Next, I modified and compiled the dpi24-overlay.dts file with the following:

Code: Select all

/dts-v1/; /plugin/; /{
        compatible = "brcm,bcm2708";
        // There is no DPI driver module, but we need a platform device
        // node (that doesn't already use pinctrl) to hang the pinctrl
        // reference on - leds will do
        fragment@0 {
                target = <&leds>;
                __overlay__ {
                        pinctrl-names = "default";
                        pinctrl-0 = <&dpi24_pins>;
                };
        };
        fragment@1 {
                target = <&gpio>;
                __overlay__ {
                        dpi24_pins: dpi24_pins {
                                brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11
                                             12 13 14 15 16 17 18 19 20
                                             21 22 23 24 25 26 27>;
                                brcm,function = <6>; /* alt2 */
                                brcm,pull = <0>; /* no pull */
                        };
                };
        };
        fragment@2 {
                target = <&i2c1_pins>;
                __overlay__ {
                        brcm,pins = <28 29>;
                        brcm,function = <4>; /* alt0 */
                        brcm,pull = <0>; /* pull none */
                };
        };
};
Also, The touch panel uses the FT5216 controller IC, which seems to be supported by the raspberry pi kernel (edt-ft5x06 driver). However, I was unable to get any response from the touchscreen.

What steps am I missing? How can I get this touch panel to work? Can somebody point me to the right direction?

Thanks in advance.

demedeirosa
Posts: 17
Joined: Wed Jul 11, 2018 1:57 pm

Re: Help getting DPI touchscreen to work on Compute Module 3

Mon Jul 16, 2018 3:34 pm

I am no expert, but im going through some of the same issues now. Did you try

Code: Select all

raspi-gpio get
to see if your io is configured correctly?

qphan734
Posts: 5
Joined: Sun Jul 15, 2018 6:38 pm

Re: Help getting DPI touchscreen to work on Compute Module 3

Tue Jul 17, 2018 3:04 pm

Yes I have and it seems to be configured correctly. When scoping the SCL and SDA, there seems to be no clock or activity going on.

Also, I tested against the official Raspberry PI 7 inch touchscreen as well. The instructions said to connect GPIO0 and GPIO1 to CD1_SDA and CD1_SCL, respectively. This works if I load in the dt-blob.bin specified in the instructions. However, if I just create a custom overlay to switch GPIO0 and GPIO1 to ALT0 mode (SCL and SDA), nothing shows up on the screen.

What is the difference between configuring the pins in the dt-blob.bin vs configuring pins in an overlay and loading in the config.txt? Is this a driver issue? I tried doing the modprobe on the edt-ft5x06 to load the driver but it did not seem to help.

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

Re: Help getting DPI touchscreen to work on Compute Module 3

Tue Jul 17, 2018 3:18 pm

The official Raspberry Pi touchscreen lives on I2C0, which is reserved for the firmware on most Pis, and is polled by the firmware; the kernel driver retrieves the touch event data from the firmware, not from I2C.

Let's go back to basics. What do the following commands return?

Code: Select all

$ i2cdetect -y 0
$ i2cdetect -y 1
$ raspi-gpio get
(If you don't have raspi-gpio, "sudo apt-get install raspi-gpio")

qphan734
Posts: 5
Joined: Sun Jul 15, 2018 6:38 pm

Re: Help getting DPI touchscreen to work on Compute Module 3

Tue Jul 17, 2018 4:00 pm

This is the response when I run i2cdetect and raspi-gpio get:

Code: Select all

pi@raspberrypi:~ $ i2cdetect -y 0
Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directory
pi@raspberrypi:~ $ i2cdetect -y 1
Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory
pi@raspberrypi:~ $ raspi-gpio get
BANK0 (GPIO 0 to 27):
GPIO 0: level=1 fsel=6 alt=2 func=PCLK
GPIO 1: level=0 fsel=6 alt=2 func=DE
GPIO 2: level=0 fsel=6 alt=2 func=LCD_VSYNC
GPIO 3: level=0 fsel=6 alt=2 func=LCD_HSYNC
GPIO 4: level=0 fsel=6 alt=2 func=DPI_D0
GPIO 5: level=0 fsel=6 alt=2 func=DPI_D1
GPIO 6: level=0 fsel=6 alt=2 func=DPI_D2
GPIO 7: level=0 fsel=6 alt=2 func=DPI_D3
GPIO 8: level=0 fsel=6 alt=2 func=DPI_D4
GPIO 9: level=0 fsel=6 alt=2 func=DPI_D5
GPIO 10: level=0 fsel=6 alt=2 func=DPI_D6
GPIO 11: level=0 fsel=6 alt=2 func=DPI_D7
GPIO 12: level=0 fsel=6 alt=2 func=DPI_D8
GPIO 13: level=0 fsel=6 alt=2 func=DPI_D9
GPIO 14: level=0 fsel=6 alt=2 func=DPI_D10
GPIO 15: level=0 fsel=6 alt=2 func=DPI_D11
GPIO 16: level=0 fsel=6 alt=2 func=DPI_D12
GPIO 17: level=0 fsel=6 alt=2 func=DPI_D13
GPIO 18: level=0 fsel=6 alt=2 func=DPI_D14
GPIO 19: level=0 fsel=6 alt=2 func=DPI_D15
GPIO 20: level=0 fsel=6 alt=2 func=DPI_D16
GPIO 21: level=0 fsel=6 alt=2 func=DPI_D17
GPIO 22: level=0 fsel=6 alt=2 func=DPI_D18
GPIO 23: level=0 fsel=6 alt=2 func=DPI_D19
GPIO 24: level=0 fsel=6 alt=2 func=DPI_D20
GPIO 25: level=0 fsel=6 alt=2 func=DPI_D21
GPIO 26: level=0 fsel=6 alt=2 func=DPI_D22
GPIO 27: level=0 fsel=6 alt=2 func=DPI_D23
BANK1 (GPIO 28 to 45):
GPIO 28: level=1 fsel=4 alt=0 func=SDA0
GPIO 29: level=1 fsel=4 alt=0 func=SCL0
GPIO 30: level=1 fsel=0 func=INPUT
GPIO 31: level=1 fsel=0 func=INPUT
GPIO 32: level=0 fsel=0 func=INPUT
GPIO 33: level=0 fsel=0 func=INPUT
GPIO 34: level=1 fsel=0 func=INPUT
GPIO 35: level=1 fsel=0 func=INPUT
GPIO 36: level=1 fsel=0 func=INPUT
GPIO 37: level=0 fsel=0 func=INPUT
GPIO 38: level=0 fsel=0 func=INPUT
GPIO 39: level=0 fsel=0 func=INPUT
GPIO 40: level=0 fsel=0 func=INPUT
GPIO 41: level=0 fsel=0 func=INPUT
GPIO 42: level=0 fsel=0 func=INPUT
GPIO 43: level=0 fsel=0 func=INPUT
GPIO 44: level=0 fsel=0 func=INPUT
GPIO 45: level=0 fsel=0 func=INPUT
BANK2 (GPIO 46 to 53):
GPIO 46: level=1 fsel=0 func=INPUT
GPIO 47: level=1 fsel=1 func=OUTPUT
GPIO 48: level=0 fsel=4 alt=0 func=SD0_CLK
GPIO 49: level=1 fsel=4 alt=0 func=SD0_CMD
GPIO 50: level=1 fsel=4 alt=0 func=SD0_DAT0
GPIO 51: level=1 fsel=4 alt=0 func=SD0_DAT1
GPIO 52: level=1 fsel=4 alt=0 func=SD0_DAT2
GPIO 53: level=1 fsel=4 alt=0 func=SD0_DAT3

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

Re: Help getting DPI touchscreen to work on Compute Module 3

Tue Jul 17, 2018 4:18 pm

Problem 1: Either you don't have the i2c_dev module loaded, or you don't have any enabled I2C buses or both. Running lsmod will tell you if i2c_dev is loaded - if not, "sudo modprobe i2c_dev" and "ls /dev/i2c*".

Problem 2: Your overlay changes the pins claimed on behalf of i2c1, but sets the pin functions to alt0 for i2c0. If the pin functions are changing it's because you have "dtparam=i2c_arm_on" in config.txt, and i2c_arm maps to i2c1. To avoid any confusion, on a Compute Module it is better to use the proper bus names - "dtparam=i2c0=on".

Problem 3: The standard kernel builds may come with the driver module, but nothing is loading it and telling it which device and i2c bus to use - for that you need to extend your overlay.

Fix the first two problems to the point where the device is appearing in the output of "i2cdetect -y 1", then we can talk about the overlay.

qphan734
Posts: 5
Joined: Sun Jul 15, 2018 6:38 pm

Re: Help getting DPI touchscreen to work on Compute Module 3

Tue Jul 17, 2018 4:46 pm

Problem 1: Either you don't have the i2c_dev module loaded, or you don't have any enabled I2C buses or both. Running lsmod will tell you if i2c_dev is loaded - if not, "sudo modprobe i2c_dev" and "ls /dev/i2c*".
When I perform an lsmod, I get the below. I do see the i2c_dev so I think the i2c_dev module was loaded.

Code: Select all

pi@raspberrypi:~ $ lsmod
Module                  Size  Used by
cfg80211              573440  0
rfkill                 28672  2 cfg80211
evdev                  24576  1
joydev                 20480  0
sg                     28672  0
hid_logitech_hidpp     36864  0
snd_bcm2835            32768  0
snd_pcm                98304  1 snd_bcm2835
snd_timer              32768  1 snd_pcm
snd                    69632  3 snd_timer,snd_bcm2835,snd_pcm
i2c_bcm2835            16384  0
fixed                  16384  0
uio_pdrv_genirq        16384  0
uio                    20480  1 uio_pdrv_genirq
ax88179_178a           24576  0
hid_logitech_dj        20480  0
i2c_dev                16384  0
ip_tables              24576  0
x_tables               32768  1 ip_tables
ipv6                  434176  24

Problem 2: Your overlay changes the pins claimed on behalf of i2c1, but sets the pin functions to alt0 for i2c0. If the pin functions are changing it's because you have "dtparam=i2c_arm_on" in config.txt, and i2c_arm maps to i2c1. To avoid any confusion, on a Compute Module it is better to use the proper bus names - "dtparam=i2c0=on".
I added the following to the /boot/config.txt and modify the .dts file to reference i2c0_pins instead of i2c1_pins.

/boot/config.txt

Code: Select all

dtparam=i2c0=on
custom.dts

Code: Select all

/dts-v1/; /plugin/; /{
        compatible = "brcm,bcm2708";
        // There is no DPI driver module, but we need a platform device
        // node (that doesn't already use pinctrl) to hang the pinctrl
        // reference on - leds will do
        fragment@0 {
                target = <&leds>;
                __overlay__ {
                        pinctrl-names = "default";
                        pinctrl-0 = <&dpi24_pins>;
                };
        };
        fragment@1 {
                target = <&gpio>;
                __overlay__ {
                        dpi24_pins: dpi24_pins {
                                brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11
                                             12 13 14 15 16 17 18 19 20
                                             21 22 23 24 25 26 27>;
                                brcm,function = <6>; /* alt2 */
                                brcm,pull = <0>; /* no pull */
                        };
                };
        };
        fragment@2 {
                target = <&i2c0_pins>;
                __overlay__ {
                        brcm,pins = <28 29>;
                        brcm,function = <4>; /* alt0 */
                        brcm,pull = <2>; /* pull up*/
                };
        };
};
After doing so, i2cdetect -y 0 command shows the following:

Code: Select all

pi@raspberrypi:~ $ i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Problem 3: The standard kernel builds may come with the driver module, but nothing is loading it and telling it which device and i2c bus to use - for that you need to extend your overlay.
I saw some examples on the forum and this is what we added to the dts file. Are there any issues with this?

Code: Select all

        fragment@2 {
                target = <&i2c0>;
                __overlay__ {
			#address-cells = <1>;
                        #size-cells = <0>;
						
                        edt_ft5x06: edt_ft5x06@38 {
                                compatible = "edt,edt-ft5x06";
                                reg = <0x38>;
                                pinctrl-names = "default";
                                interrupt-parent = <&gpio>;
                                interrupts = <30 2>; /* rising edge */
                                touchscreen-size-y = <240>;
                                touchscreen-size-x = <320>;
                                reset-gpios = <&gpio 31 1>; /* active low */
                        };
                };
        };
Last edited by qphan734 on Tue Jul 17, 2018 5:19 pm, edited 1 time in total.

qphan734
Posts: 5
Joined: Sun Jul 15, 2018 6:38 pm

Re: Help getting DPI touchscreen to work on Compute Module 3

Tue Jul 17, 2018 5:18 pm

After making those changes, the touch screen seems to respond! I just need to calibrate the touchscreen. Thank you very much for the tips and suggestions.

MeetPi
Posts: 9
Joined: Tue Nov 27, 2018 1:23 pm

Re: Help getting DPI touchscreen to work on Compute Module 3

Tue Nov 27, 2018 2:06 pm

Hello fellas!

Does anyone in here have experience with using Kentec K70DWN0-V1-F DPI Touchscreen Displays on Compute Module 3?
Rough specs for the touch screen:
7 inch Diagonal
800 x 480 x RGB Dots
16.7M colors TFT display
With white LED backlight
With 4-wire resistive touch screen

Can't use the HDMI to display Images any longer, ever since I modified the config.txt file (only file I've modified so far). But this is not too tragic (I guess/hope), since I actually aimed to use the DPI as default output.

Below is my config.txt modification:

Code: Select all

# set dtoverlay to 24bit display
dtoverlay=dpi24

# set overscan values for display
overscan_left=0
overscan_right=0
overscan_top=0
overscan_bottom=0

# set display resolution
framebuffer_width=800
framebuffer_height=480

#disable spi and i2c Pins. not needed for this display
dtparam=spi=off
dtparam=i2c_arm=off

# enable cm3 to use dpi channels for the display and set channels as default ouptut
enable_dpi_lcd=1
display_default_lcd=1

# set custom display cvt and hdmi timings for display
dpi_group=2
dpi_mode=87

# set output format and timings for display
dpi_output_format=0x1C017
hdmi_timings=800 0 16 20 46 480 0 22 3 23 0 0 0 50 0 33300000 6
My problem is that the display turns on, BUT no images are displayed. What am I missing? Are there other files that I need to modify? All the required supply voltages for the Display are up and stable.

Help will be very much appreciated! Thank you all in Advance!

PS: Please keep your answers simple. I'm still in a learning curve and want to keep my motivation to get to know the CM3 :-)

MeetPi
Posts: 9
Joined: Tue Nov 27, 2018 1:23 pm

Re: Help getting DPI touchscreen to work on Compute Module 3

Fri Nov 30, 2018 8:33 am

Hello Folks,

does anyone in here has experience with a Kentec K70DWN0-V1-F, 7 Inch dpi24 LCD touch display???

I can't seem to get configuration right for the display to work. :(

MeetPi
Posts: 9
Joined: Tue Nov 27, 2018 1:23 pm

Re: Help getting DPI touchscreen to work on Compute Module 3

Fri Nov 30, 2018 11:03 am

@ qphan734

I'm happy for you that you finally got your display to work ;)

I'm having issues making my display (Kentec K70DWN0-V1-F. http://www.kentecdisplay.com/plus/view.php?aid=20) work.
I checked my CM3 /boot/overlays file but couldn't find any dpi24.dts file. Just .dtbo files.
What do I do? Create my own dpi24.dts file and place it in /boot/overlays? Or download an available dpi24.dts file and modify it?

How did you get your dpi24.dts file?

I'm stuck in config.txt, especially with determining the correct value for the dpi_out_format and for HDMI_timing for my display.

I would appreciate your help very much!

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

Re: Help getting DPI touchscreen to work on Compute Module 3

Fri Nov 30, 2018 4:56 pm

The .dts sources for all of the overlays can be found in the kernel source tree. We are currently shipping 4.14 kernels, so the overlays sources are here.

To build the dpi24 overlay:

Code: Select all

$ dtc -@ -I dts -O dtb -o dpi24.dtbo dpi24-overlay.dts
You will see some warnings, but they are harmless.

MeetPi
Posts: 9
Joined: Tue Nov 27, 2018 1:23 pm

Re: Help getting DPI touchscreen to work on Compute Module 3

Mon Dec 03, 2018 10:13 am

Thank you loads, PhilE, for your reply!

I've downloaded the dpi24-overly file using the following command:

Code: Select all

~$ curl -o dpi24-overlay.dts https://raw.githubusercontent.com/raspberrypi/linux/rpi-4.14.y /arch/arm/boot/dts/overlays/dpi24-overlays.dts
But executing

Code: Select all

~$ dtc -@ -I dts -O dtb -o dpi24.dtbo dpi24-overlay.dts
gives me these errors:

Code: Select all

Error: dpi24-overlay.dts:1.1-2 syntax error
FATAL ERROR: Unable to parse input tree
How can I handle that? (I'm a rookie, as you might have noticed).

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

Re: Help getting DPI touchscreen to work on Compute Module 3

Mon Dec 03, 2018 10:18 am

If you look inside the downloaded file you will probably find that it is an error message - you included an extra 's' in the filename ('dpi24-overlays.dts' instead of 'dpi24-overlay.dts'). Try again.

MeetPi
Posts: 9
Joined: Tue Nov 27, 2018 1:23 pm

Re: Help getting DPI touchscreen to work on Compute Module 3

Mon Dec 03, 2018 2:40 pm

If you look inside the downloaded file you will probably find that it is an error message - you included an extra 's' in the filename ('dpi24-overlays.dts' instead of 'dpi24-overlay.dts').
You're right, PhilE. Thank you!

Corrected my typo and tried the download again. Was successful and the warnings you mentioned (in connection with the dpi24 overlay build) also showed up.

I now have images displayed on the LCD. (And that is a huge step Forward!). But the colours are messed up...

I'm guessing a bad dpi_output_format and/or dpi_timing could be the problem. And I'm out of ideas about setting up the right values for this display (Kentec K70DWN0-V1-F. http://www.kentecdisplay.com/plus/view.php?aid=20) :?


Thank you once, PhilE, for your support!!!

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

Re: Help getting DPI touchscreen to work on Compute Module 3

Mon Dec 03, 2018 3:04 pm

I recommend you find a colour bars image and use it to work out what the colour mapping is. Look at the primary colour bars - red, green and blue - and see how the colour is displayed, then change the wiring until it looks correct.

This image might be useful, because has full colour ramps: http://richardrosenman.com/wp-content/u ... 24x768.jpg

MeetPi
Posts: 9
Joined: Tue Nov 27, 2018 1:23 pm

Re: Help getting DPI touchscreen to work on Compute Module 3

Mon Dec 03, 2018 4:07 pm

Awesome! Will do. Immediately after I get some descent images. My current problem seems to be with the dpi_output_format value and with the hdmi_timings values.

Code: Select all

dpi_output_format=0x6f017
hdmi_timings=800 0 210 2 0 480 0 22 2 23 0 0 0 50 0 19200000 6
don't seem to work for me :?

Andy1978
Posts: 16
Joined: Fri Jan 04, 2013 7:01 pm

Re: Help getting DPI touchscreen to work on Compute Module 3

Fri Dec 07, 2018 6:26 am

hdmi_timings and dpi_output_format is documented here: https://www.raspberrypi.org/documentati ... /README.md

MeetPi
Posts: 9
Joined: Tue Nov 27, 2018 1:23 pm

Re: Help getting DPI touchscreen to work on Compute Module 3

Mon Dec 10, 2018 12:48 pm

Hi PhilE! Hi Andy!

My Display has finally been displaying Images.

Thank you for your help.

But I've already ran into the next problem :lol:
Have created a little .jar file which I can open but freezes. Neither mouse nor keyboard no touch screen responds. So at the Moment, my only chance to exit and close the applicatication is by

Code: Select all

sudo reboot
.

Using

Code: Select all

java -version
returns:

java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) Client VM (build 25.191-b12, mixed mode)

So the lastest java 8 has (obviously) been installed correctly.

Does anyone have an idea what the problem might be?

Thank you all in advance!

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

Re: Help getting DPI touchscreen to work on Compute Module 3

Mon Dec 10, 2018 12:55 pm

You are WAAAAY off topic now. You might have more luck opening a new thread in a more appropriate forum.


Return to “Compute Module”