This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] AM625:为定制 AM625 SOM 配置 TSC2046

Guru**** 1931890 points
Other Parts Discussed in Thread: TSC2046, AM625, SK-AM62B, SK-LCD1
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1322404/am625-configure-tsc2046-for-custom-am625-som

器件型号:AM625
主题中讨论的其他器件:TSC2046SK-AM62BSK-LCD1

在我们定制的 AM625 SOM 中、我们使用了触控 IC TSC2046、现在我想使用器件树结构文件对其进行配置、 以便我可以使用 AM625 SOM 的触控功能

我们使用的是7" TFT 显示屏、它支持电阻式触控  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Aditya:

    我已将您的问题分配给相关专家、他们会很快回复您。

    此致、

    尼蒂卡

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Aditya:

    您可以在此处找到有关器件树节点的文档:

    ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-linux-kernel-6.1.46+gitAUTOINC+247b2535b2-g247b2535b2/Documentation/devicetree/bindings$ grep -r TSC2046
    input/touchscreen/ads7846.txt:Device tree bindings for TI's ADS7843, ADS7845, ADS7846, ADS7873, TSC2046
    input/touchscreen/ads7846.txt:Example for a TSC2046 chip connected to an McSPI controller of an OMAP SoC::
    iio/adc/ti,tsc2046.yaml:title: Texas Instruments TSC2046 touch screen controller.
    iio/adc/ti,tsc2046.yaml:  TSC2046 is a touch screen controller with 8 channels ADC.
    

    您可以通过搜索 ADS78或 tsc2046来搜索有关人们如何为自己的电路板编写 devicetree 节点的示例、如下所示:

    ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-linux-kernel-6.1.46+gitAUTOINC+247b2535b2-g247b2535b2/arch$ grep -r tsc2046
    arm/mach-pxa/magician.c:struct pxa2xx_spi_chip tsc2046_chip_info = {
    arm/mach-pxa/magician.c:                .controller_data        = &tsc2046_chip_info,
    arm/mach-pxa/hx4700.c:static const struct ads7846_platform_data tsc2046_info = {
    arm/mach-pxa/hx4700.c:static struct pxa2xx_spi_chip tsc2046_chip = {
    arm/mach-pxa/hx4700.c:static struct spi_board_info tsc2046_board_info[] __initdata = {
    arm/mach-pxa/hx4700.c:          .platform_data   = &tsc2046_info,
    arm/mach-pxa/hx4700.c:          .controller_data = &tsc2046_chip,
    arm/mach-pxa/hx4700.c:  spi_register_board_info(ARRAY_AND_SIZE(tsc2046_board_info));
    arm/boot/dts/omap3-panel-sharp-ls037v7dw01.dtsi:        tsc2046@0 {
    arm/boot/dts/omap3-panel-sharp-ls037v7dw01.dtsi:                compatible = "ti,tsc2046";
    arm/boot/dts/imx7d-sdb-reva.dts:                pinctrl_tsc2046_pendown: tsc2046_pendown {
    arm/boot/dts/omap3-evm-common.dtsi:     tsc2046@0 {
    arm/boot/dts/omap3-ldp.dts:     tsc2046@0 {
    arm/boot/dts/imx6qdl-skov-cpu-revc.dtsi:                compatible = "ti,tsc2046e-adc";
    arm/boot/dts/omap3-lilly-a83x.dtsi:     tsc2046@0 {
    arm/boot/dts/omap3-lilly-a83x.dtsi:             compatible = "ti,tsc2046";
    arm/boot/dts/imx6dl-plym2m.dts:         compatible = "ti,tsc2046e-adc";
    arm/boot/dts/imx6dl-plym2m.dts:         pinctrl-0 = <&pinctrl_tsc2046>;
    arm/boot/dts/imx6dl-plym2m.dts: pinctrl_tsc2046: tsc2046grp {
    arm/boot/dts/omap3-pandora-common.dtsi: tsc2046@0 {
    arm/boot/dts/omap3-pandora-common.dtsi:         compatible = "ti,tsc2046";
    arm/boot/dts/dove-cm-a510.dtsi:         compatible = "ti,tsc2046";
    arm/boot/dts/at91sam9261ek.dts:                         tsc2046@2 {
    arm/boot/dts/imx6dl-victgo.dts:         compatible = "ti,tsc2046e-adc";
    arm/boot/dts/imx7d-sdb.dts:     tsc2046@0 {
    arm/boot/dts/imx7d-sdb.dts:             compatible = "ti,tsc2046";
    arm/boot/dts/imx7d-sdb.dts:             pinctrl-0 = <&pinctrl_tsc2046_pendown>;
    arm/boot/dts/imx7d-sdb.dts:             pinctrl_tsc2046_pendown: tsc2046_pendown {
    arm/boot/dts/imx6dl-prtvt7.dts:         compatible = "ti,tsc2046e-adc";
    

    此致、

    尼克

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Nick。

    这是我的 DTS 函数

    &main_spi0 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&tsspi0_pins_default>;
    	status = "okay";
    	#address-cells = <1>;
    	#size-cells = <0>;
    	ti,pindir-d0-out-d1-in = <0>;
    
    	tsc2046@0 {
    		pinctrl-names = "default";
    		pinctrl-0 = <&vdd_mmc1_pins_default>;
    
    		reg = <0>;    / CS0 /
    	        compatible = "ti,tsc2046";
            	interrupt-parent= <&main_gpio0>;
    	        interrupts = <41 GPIO_ACTIVE_LOW>;
            	spi-max-frequency = <1250000>;
    		pendown-gpio = <&main_gpio0 41 GPIO_ACTIVE_LOW>;
    		vcc-supply = <&vcc_3v3_sys>;
    
    		ti,x-min = /bits/ 16 <0>;
    		ti,x-max = /bits/ 16 <800>;
    		ti,y-min = /bits/ 16 <0>;
            	ti,y-max = /bits/ 16 <480>;
            	ti,x-plate-ohms = /bits/ 16 <40>;
            	//ti,y-plate-ohms = /bits/ 16 <200>;
            	ti,pressure-max = /bits/ 16 <255>;
    /*
            	ti,vref-delay-usecs = <20000>;
            	ti,vref-mv      = <3300>;
    		ti,keep-vref-on    =  <1>;
    
            	ti,debounce-rep =  <1>;
            	ti,debounce-tol =  <30>;
            	ti,debounce-max =  <10>;
            
            	ti,settle-delay-usec  = /bits/ 16 <150>;
    		ti,penirq-recheck-delay-usecs = /bits/ 16 <20000>;
                
    		touchscreen-x-mm    = <115>;
    		touchscreen-y-mm    = <86>;
    */
    		wakeup-source;
    	};
    };


    这是我的 Pinmux 设置
    //TOUCH-Start
    	tsspi0_pins_default: tsspi0-pins-default {
    		pinctrl-single,pins = <
    			AM62X_IOPAD(0x1bc, PIN_OUTPUT, 7) / (A14) SPI0_CLK /
    			AM62X_IOPAD(0x1c0, PIN_OUTPUT, 0) / (B13) SPI0_D0 /
    			AM62X_IOPAD(0x1c4, PIN_INPUT, 0) / (B14) SPI0_D1 /
    			AM62X_IOPAD(0x1b4, PIN_OUTPUT, 0) /* (A13) SPI0_CS0 | GPIO1_15*/
    		>;
    	};
    
    	tsc_Int_Busy_pins_default: tsc-Int-pins-default {
    		pinctrl-single,pins = <
    			AM62X_IOPAD(0xa8, PIN_INPUT, 7) / (M21) GPIO0_41 /
    			AM62X_IOPAD(0xac, PIN_INPUT, 7) / (L21) GPIO0_42 /
    		>;
    	};
    //End
    


    现在、在更改了 k3-am62x-sk-common.dtsi 中的所有这些细节后、我无法在定制的 AM625 SOM 上启用触摸屏。
    而是在引导日志中、我只将这些作为输出
    [    1.493093] ads7846 spi3.0: touchscreen, irq 335
    [    1.498125] input: ADS7846 Touchscreen as /mailto:devices/platform/bus@f0000/20100000.spi/spi_master/spi3/spi3.0/input/input0
    


    谢谢。此致、
    Aditya T

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    是否有关于进一步配置 TSC2046的任何更新?

    谢谢。此致、
    Aditya Tandulwadkar

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Aditya:

    对延迟回复深表歉意。 我没有这些器件需要自行测试、但我明天会更仔细地查看您的 devicetree 设置、以查看是否有任何可能需要更改的内容。

    此致、

    尼克

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Nick、

    我在定制 AM625 SOM 上启用了电阻式触控技术、取得了成功。 但现在我想对 AM625 SOM 的触控进行校准、该器件具有 TSC2046触控控制器 IC

    谢谢。此致、
    Aditya Tandulwadkar

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Aditya:

    1) 1)要确认、您现在能够看到触摸输入事件? 您最终做了哪些更改来修复它?

    过去、我使用 evtest 来检查触控输入、如本主题所示: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/862817/am3358-touchscreen-error/3197806#3197806 

    2) 2)您在显示屏上使用什么软件? 威兰/韦斯顿?  EGFLS?  滑块? 还有其他问题吗?

    此致、

    尼克

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Nick。

    1)=>下面给出的行对我有用:
         触摸屏大小 x =<4096>;
         触摸屏大小 y =<4096>;

    我还使用过 evtest 工具、它可以识别显示屏各个角落的触摸、但如何使用这些数据进行校准呢?

    2)=>我正在使用的平台是 X11公路显示上的 linuxfb。

    谢谢。此致、
    Aditya Tandulwadkar

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    2024年2月28日编辑:该响应中的信息似乎不适用于 AM62x。 请参考我稍后的答复:
    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1322404/am625-configure-tsc2046-for-custom-am625-som/5063378#5063378 

    您好、Aditya:

    几年前、Weston 校准保存在校准文件中。 您可以删除旧校准数据、然后校准工具将在启动时运行。 以下这些旧线程可能会有所帮助:
    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/723728/linux-am4378-touchscreen-calibration-problem
    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/495706/am572x-touch-screen-calibration 

    我链接到的 wiki 文本在这里:

    How to Recalibrate the Touchscreen
    
    Weston based Graphic System
    Where is the ws-calibrate.rules file?
    The Processor SDK Linux moves the Weston calibration file for the touchscreen from the default location of /etc/udev/rules.d/ws-calibrate.rules to instead be placed at /run/media/mmcblk0p1/ws-calibrate.rules if the SD device is present. This was done to allow user's to easily delete this file and force a recalibration without requiring a Linux PC to mount the file system or a serial console to access the device. In this case the ws-calibrate.rules file is now written to a FAT partition of the SD card, which can be mounted on both Windows or Linux.
    
    If the ws-calibrate.rules file is created at /run/media/mmcblk0p1/ws-calibrate.rules, and there is not already a file in /etc/udev/rules.d/ws-calibrate.rules then the file is also copied to the old default location.
    
    In the case that there is no SD card available then the ws-calibrate.rules file will be written to the default /etc/udev/rules.d/ws-calibrate.rules.
    
    Recalibrating by Deleting ws-calibrate.rules
    To trigger touchscreen re-calibration, both ws-calbration.rules files need to be deleted. The ws-calbration.rules file which is now written to the FAT partition of the SD card can be deleted by simply inserting the SD card into a PC and deleting the ws-calbration.rules file found on the first partition (assuming the first partition is a FAT partition) and we also need to delete /etc/udev/rules.d/ws-calibrate.rules from the filesystem. After both ws-calibration.rules files are removed, you will be asked to calibrate the touchscreen when the Weston is launched at the first time or relaunched by issuing "/etc/init.d/weston start" command at the console.
    
    Alternatively, you may delete the above listed files directly from the EVM's console by issuing the following commands at EVM's Linux prompt, and reboot the EVM to allow recalibration of the LCD.
    
     rm /etc/udev/rules.d/ws-calibrate.rules
     rm /run/media/mmcblk0p1/ws-calibrate.rules
     reboot
     
     Non-Weston based Graphic System
    Where is the pointercal file?
    The Processor SDK Linux moves the calibration file for the touchscreen from the default location of /etc/pointercal to instead be placed at /run/media/mmcblk0p1/pointercal if the SD device is present. This was done to allow user's to easily delete this file and force a recalibration without requiring a Linux PC to mount the file system or a serial console to access the device. In this case the pointercal file is now written to a FAT partition of the SD card, which can be mounted on both Windows or Linux.
    
    If the pointercal file is created at /run/media/mmcblk0p1/pointercal, and there is not already a file in /etc/pointercal then the file is also copied to the old default location. This is to prevent requiring the export of the TSLIB_CALIBFILE variable as described in later sections of this document.
    
    In the case that there is no SD card available then the pointercal file will be written to the default /etc/pointercal location.
    
    Recalibrating by Deleting pointercal
    Because the pointercal file is now written to the FAT partition of the SD card recalibrating the touchscreen can be done by simply inserting the SD card into a PC and deleting the pointercal file found on the first partition (assuming the first partition is a FAT partition). When the system is then rebooted you will be asked to calibrate the touchscreen.
    
    Recalibrating over Serial Console
    If you do have access to the serial console you can always recalibrate the touchscreen using the ts_calibrate command as normal. However, in this case if you already have a pointercal file on the SD card you will need to export the TSLIB_CALIBFILE variable to point to that location before you run ts_calibrate. i.e.
    
    target# export TSLIB_CALIBFILE=/run/media/mmcblk0p1/pointercal
    target# ts_calibrate
    NOTE: If you have Matrix or any other GUI application already running you should stop that application (How to Stop Matrix) before running ts_calibrate so that you can see the calibration screen.
    
    Exporting TSLIB_CALIBFILE
    The environment variable TSLIB_CALIBFILE is used by the tslib package to indicate the location of the pointercal file. The default value for TSLIB_CALIBFILE is /etc/pointercal. If you are writing a program that uses tslib you should make sure that you export TSLIB_CALIBFILE to point to the location of your pointercal file (as indicated in the previous section), or that you place a copy of the pointercal file at the default /etc/pointercal location.

    我不确定这些信息现在是否仍然适用于 AM62x?

    此致、

    尼克

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Nick。

    感谢您提供上述信息。 但它对我没有太大帮助。
    我的触控坐标出错了

    谢谢。此致、
    Aditya Tandulwadkar

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Aditya:

    我正在自行设置一个可在上面运行测试的屏幕(与您的屏幕不同、它在这里进行了说明: https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/09_01_00_08/exports/docs/linux/How_to_Guides/Target/How_to_enable_Microtips_LVDS_Panel_on_AM62_SK_EVM.html)。

    在我完成这一设置后、请向我提供更多信息、说明您已尝试进行校准的内容以及观察到的结果。

    此致、

    尼克

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Nick。

    我正在使用的显示屏是7英寸 TFT RGB 显示屏、有800×480像素。 它支持24位数据、即 RGB888。

    另一方面,运行 evtest 实用程序后,我能够识别触摸的所有角落和不同的点显示,但当我想在它上执行 QT 应用程序,与 linuxfb 平台或任何其他平台

    eglfs、linuxfb、minimal、minimalegl、offscreen、 vnc、wayland-EGL、wayland、xcb  

    在任何这些平台上、单击使用 QT 的任何按钮后、触控识别错误。

    现在、我不明白如何设置触摸事件的正确参数?

    谢谢。此致、

    Aditya Tandulwadkar  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Aditya:

    我将继续在我身边做这件事。 我星期一在度假、我的硬件设置将在星期三准备就绪。 但是、我建议您尝试在网上搜索其他资源、以便使用您感兴趣的任何软件平台校准触摸屏。

    我可以提供有关如何使用在 SDK 中启用的默认软件校准 Microtips 显示面板的 TI EVM 的指导。 但您的解决方案可能与我在这里可以测试的解决方案不同。

    无论哪种方法、我们两个人都运行测试、而不是等待我在我身边取得进展、这样的速度都会更快。

    此致、

    尼克

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Nick。

    是的、我正在自行尝试校准触摸、如果有任何进展、将在此处进行更新

    谢谢。此致、
    Aditya Tandulwadkar

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Aditya:

    我使用 Weston 触摸校准器重新校准我身边的触摸屏。

    它运行良好-当我通过直接触摸屏幕上显示的+符号进行校准时、测试触摸应用显示的是我手指下面的触摸、当我有意在+符号下面触摸大约一英寸时、 然后、测试触摸应用显示出离我的手指有一英寸左右的距离。

    下面是完整步进。

    硬件和软件版本  

    SK-AM62B - EVM
    SK-LCD1 -带电容式触摸屏的显示器
    AM62x Linux SDK 9.1

    设置显示屏和触摸屏  

    请按照以下步骤操作: https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/09_01_00_08/exports/docs/linux/How_to_Guides/Target/How_to_enable_Microtips_LVDS_Panel_on_AM62_SK_EVM.html

    UBoot 步骤:

    Hit any key to stop autoboot:  0
    => name_overlays=k3-am625-sk-microtips-mf101hie-panel.dtbo
    => boot
    

    触摸屏不响应  ,直到我按照上面的文档中的说明,标签
    "AM625 SK EVM 上启用触摸 Microtips 面板的步骤:"

    运行并测试触摸校准器  

    TI Linux SDK 默认使用 Weston。 有关与 Weston 交互和运行测试的更多文档、请访问:
    https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/09_01_00_08/exports/docs/linux/Foundational_Components Graphics/Graphics_and_Display.html#wayland-Weston

    首先、检查 Weston 触摸屏校准器是否已启用。 在我的电路板上、touchpers_calibrator 已经被设置为 true:

    # vi /etc/xdg/weston/weston.ini
    ...
    [libinput]
    touchscreen_calibrator=true
    #enable_tap=true
    

    只是为了安全,停止和重新启动韦斯顿

    root@am62xx-evm:/# systemctl stop weston
    Warning: Stopping weston.service, but it can still be activated by:
      weston.socket
    root@am62xx-evm:/# systemctl start weston
    [ 1467.604787] audit: type=1006 audit(1501.104:57): pid=5332 uid=0 old-auid=4294967295 auid=1000 tty=tty7 old-ses=4294967295 ses=5 res=1
    [ 1467.617321] audit: type=1300 audit(1501.104:57): arch=c00000b7 syscall=64 success=yes exit=4 a0=8 a1=ffffcd12d128 a2=4 a3=ffff96660020 items=0 ppid=1 pid=5332 auid=1000 u
    id=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=tty7 ses=5 comm="(weston)" exe="/lib/systemd/systemd" key=(null)
    [ 1467.643381] audit: type=1327 audit(1501.104:57): proctitle="(weston)"
    

    运行校准

    root@am62xx-evm:/# weston-touch-calibrator
    could not load cursor 'dnd-move'
    could not load cursor 'dnd-copy'
    could not load cursor 'dnd-none'
    device "/sys/devices/platform/bus@f0000/20000000.i2c/i2c-0/0-0041/input/input1/event0" - head "LVDS-1"
    root@am62xx-evm:/# weston-touch-calibrator /sys/devices/platform/bus@f0000/20000000.i2c/i2c-0/0-0041/input/input1/event0
    could not load cursor 'dnd-move'
    could not load cursor 'dnd-copy'
    could not load cursor 'dnd-none'
    // at this point, + symbols appeared on the screen and I was able to press them

    您可以通过运行其中一个 Weston 示例应用程序来测试校准的精确度:

    root@am62xx-evm:~# /usr/bin/weston-simple-touch
    // Ctrl-C to exit the demo

    也可以直接使用 evtest:

    root@am62xx-evm:~# /usr/bin/evtest

    似乎校准数据可能无法在重新启动之间保存。 我尚未对此进行实验、但此层叠溢出帖子可能包含一些有关将校准数据粘贴到记忆棒中的有用信息:
    https://stackoverflow.com/questions/67162466/where-is-the-calibration-matrix-in-weston-wayland

    此致、

    尼克