Calibration of touchscreen for 4D Systems Gen4 LCD for BBB

I am having a problem calibrating the touch screen on the 4D Systems Gen4 7" LCD display with a resistive touchscreen. Near the center of the display the calibration is very close but near the edges it’s off by more than 0.25 inch. At the lower left corner of the LCD the pointer appears approximately 0.25" above and 0.25" to the right the touch point. At the upper right hand corner the pointer appears 0.4" below and .3" to the left of the touch point.

The instructions for calibrating the touchscreen in the Gen4 user manual do not seem to apply. My environment is a BeagleBone Black with the latest image of Debian Stretch (Ver 9.5 dated 2018-09-16)

How can I calibrate the touch screen?

@texasEE, this is one of the screen’s i haven’t had a chance to personally calibrate yet. I had a chance to test the 4 and 5 inch, so those have it implemented. For the 7-inch, the values are in the device tree overlay, copied from the 4 and 5 inch displays, just disabled:

On your beagle run:


debian@test-bbb-2:~$ cd /opt/source/bb.org-overlays/
debian@test-bbb-2:/opt/source/bb.org-overlays$ git pull
Already up-to-date.
debian@test-bbb-2:/opt/source/bb.org-overlays$ nano src/arm/BB-BONE-4D7R-01-00A1.dts

Un-Comment:

                                interrupt-parent = <&gpio0>;
                                interrupts = <14 IRQ_TYPE_LEVEL_HIGH>;

                                //touchscreen-offset-x=<250>;
                                //touchscreen-offset-y=<300>;

                                touchscreen-inverted-y;
                        };

to:

                                interrupt-parent = <&gpio0>;
                                interrupts = <14 IRQ_TYPE_LEVEL_HIGH>;

                                touchscreen-offset-x=<250>;
                                touchscreen-offset-y=<300>;

                                touchscreen-inverted-y;
                        };

Then rebuild and install via:

debian@test-bbb-2:/opt/source/bb.org-overlays$ make
debian@test-bbb-2:/opt/source/bb.org-overlays$ sudo make install

and then restart to test.

Regards,

I’ve tried editing the touchscreen-offset-x & touchscreen-offset-y values from 250 to 5000 with very little results. Cursor is still off from touch position near the edges of the screen by about the same amount. Can you provide some idea of expected number values and what I should expect as number is increased or decreased?

@texasEE, i belive they are pixel values in the microchip touch sensor… But since you aren’t getting any good feedback, please run this script and share it’s output to this thread.

sudo /opt/scripts/tools/version.sh

Regards,

Output from /opt/scripts/tools/version.sh

git:/opt/scripts/:[73593ebe3b7d3cc381eeb502d45ccb33a6ec5e78]
eeprom:[A335BNLT000C1826BBBG0816]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Image 2018-01-28]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2018.01-00002-g9aa111a004]:[location: dd MBR]
kernel:[4.9.105-ti-r114]
nodejs:[v6.12.3]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
uboot_overlay_options:[dtb_overlay=/lib/firmware/BBB-VIPMOTOR-PRU-00A0.dtbo]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade &lt;pkg&gt;]
pkg:[bb-cape-overlays]:[4.4.20180803.0-0rcnee0~stretch+20180804]
pkg:[bb-wl18xx-firmware]:[1.20170829-0rcnee2~stretch+20180104]
pkg:[kmod]:[23-2rcnee1~stretch+20171005]
pkg:[roboticscape]:[0.3.4-git20170602-0rcnee4~stretch+20171108]:[GOT_REPLACED_BY_NEXT]
WARNING:pkg:[librobotcontrol]:[NOT_INSTALLED]
pkg:[firmware-ti-connectivity]:[20170823-1rcnee0~stretch+20170830]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal i2c bluetooth netdev cloud9ide gpio pwm eqep admin spi tisdk weston-launch xenomai]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait uboot_detected_capes=BB-BONE-LCD7-01, coherent_pool=1M net.ifnames=0 quiet]
dmesg | grep pinctrl-single
[    1.404269] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
dmesg | grep gpio-of-helper
[    1.404883] gpio-of-helper ocp:gpio_helper: ready
[    1.405495] gpio-of-helper ocp:cape-universal: ready
END

@texasEE, something is fishy, that’s not a GEN 4 LCD…

U-Boot is reporting:

uboot_detected_capes=BB-BONE-LCD7-01,

Which would be this older model: https://www.4dsystems.com.au/product/4DCAPE_70/

Which uses the am335’x adc input as a resistive touchscreen control. It’s touch events wasn’t very accurate…

Regards,

Ah, that would be a problem. Switched displays while trying to debug this issue. Once switching back to the 4D Systems Gen4 7" display the values started to adjust the cursor position. After some “playing” found that x of 100 and y of 275 worked.

Question, it would appear that this needs to be adjusted for each unit, or is there a good default value other than the 250 & 300 values which appear on my unit to over compensate for the issue? It’s a cumbersome job to interactively develop the adjustment for each unit.

@texasEE done!

It’ll be the default going forward… and will be installed by apt update/upgrade shortly…

Regards,