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.

ts_test varying results after reboots

Summary: After a successful ts_calibration and ts_test, ts_test shows varying results after reboots.

I am connecting a beaglebone black to a 16 bpp, 4 wire touchscreen/LCD. The lcd is working beautifully, but I am having an issue with the touchscreen. I am connecting AIN0-3 directly to the up, down, left, and right pins of the touchscreen via breadboard and breakoutboard.

I can boot up a 3.8 kernel with a custom device tree overlay (and also a modified 3.2 kernel), I can run ts_calibrate and ts_test and get perfect results.

The problem occurs on reboots, sometimes the results of ts_test are near perfect, sometimes they are

off by a small but significant amount, something it is way off. On a reboot when ts_test is way off, if I run ts_calibrate then the results of ts_test are right on the mark.

I haven't been able to make heads or tails of this, whether to focus an hardware or software.

Looking at the touch signals with a scope there is a small amount of noise that seems to increase in frequency as more is displayed on the LCD. However the calibration never seems to change once the board is booted so I do not believe that the noise is at the root of my issue.

/etc/ts.conf contains

module_raw input
module pthres pmin=1
module variance delta=30
module dejitter delta=100
module linear

I'm exporting the following before running any ts_* utils:

export TSLIB_CONSOLEDEVICE=none
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_TSDEVICE=/dev/input/event1
export TSLIB_FBDEVICE=/dev/fb0
#export TSLIB_PLUGINDIR=/usr/lib/ts
export TSLIB_PLUGINDIR=/usr/lib/arm-linux-gnueabihf/ts0
export TSLIB_TSEVENTTYPE=INPUT

I have a debian rootfs and I've installed tslibs via apt-get, but I've also cross compiled tslibs-1.0 and tslibs-1.1 from:

https://github.com/kergoth/tslib

With the same results.

Any ideas/suggestions would be greatly appreciated.

  • Hi Brian,

    Looks like something hardware related to me.

    Have you tried "ts_print" and "ts_print_raw" to see if the values of your touch actions are normal?

    Best regards,
    Miroslav

  • Hi Miroslav,

    Thanks for your reply.  I was playing around with ts_print* the other day, but wasn't sure what to make of the results.  I'm not sure if I'm taking the best approach to using ts_print.  But below are results from this morning.  

    I did a clean boot, no power applied for at least 1 minute.  Run ts_calibrate, run ts_test to confirm calibration.   Then I rerun ts_test and control c to quit, just to repaint the cross hairs in the center of the screen.  Then i run ts_print_raw and use a wooden pointer to hit the center as close as possible.  I've tested rebooting by typing reboot at the console and also disconnecting power, I've found no correlation to this.

    Below are three adjacent samples from ts_print_raw, hitting the same(or as close as possible) location at the center of the screen, after a fresh boot.  After first boot calibration, the calibration was off may reboots, then it was right on three reboots in a row, and then off again.  Its very odd.

    Thank you.  Any suggestions or guidance is greatly appreciated.

    after 1st boot and calibration
    1387418696.707344: 2099 2103 256
    1387418696.711123: 2101 2099 252
    1387418696.713024: 2100 2105 252

    ts_test incorrect
    1387418790.681536: 1885 1988 251
    1387418790.685305: 1881 1989 248
    1387418790.687210: 1883 1987 251

    ts_test incorrect by by small amount
    1387419015.843643: 2060 2032 246
    1387419015.845556: 2061 2032 246
    1387419015.849328: 2062 2034 246

    ts_test incorrect by small mount
    1387418611.488117: 2050 2013 247
    1387418611.491890: 2052 2012 247
    1387418611.495669: 2050 2012 247

    ts_test incorrect
    1387418701.183817: 1855 1993 252
    1387418701.187588: 1859 1994 251
    1387418701.195089: 1860 1992 249

    ts_test incorrect
    1387418811.483794: 2047 1994 248
    1387418811.487562: 2043 1993 248
    1387418811.489464: 2045 1993 248

    ts_test incorrect
    1387418703.384857: 1943 2091 259
    1387418703.386761: 1946 2097 259
    1387418703.388667: 1946 2093 259

    ts_test incorrect by small amount
    1387418800.536291: 2028 2021 246
    1387418800.538207: 2029 2017 247
    1387418800.545730: 2032 2020 246

    ts_test correct
    1387418945.573819: 2099 2109 253
    1387418945.575724: 2096 2107 254
    1387418945.579496: 2100 2098 254

    ts_test correct
    1387418606.525815: 2101 2096 253
    1387418606.527719: 2104 2095 254
    1387418606.531499: 2110 2085 251

    ts_test correct
    1387418616.778225: 2095 2106 253
    1387418616.780138: 2095 2109 253
    1387418616.783916: 2104 2107 252

    ts_test incorrect
    1387418727.938559: 1874 1991 252
    1387418727.942335: 1875 1993 251
    1387418727.946106: 1877 1992 249

     

     

     

     

     

     

  • You may try to use ts_print / ts_print_raw to print the values in the 4 corners of the screen. The X and Y values should either be 0 or maxed out in the corners. This will show you if there is some offset to these values when ts_test shows incorrect results.

    Best regards,
    Miroslav

  • Hi Miroslav,

    Thanks for your reply. I've tested and confirmed what you wrote above.

    After running a ts_calibrate and confirming results with ts_test. The results of ts_print in the upper left corner is zero'ed, or very, very close as expected, ts_print_raw shows an offset which I think is expected.
    ts_print/ts_print_raw do show additional offset after rebooting and ts_test is incorrect.

    I also ordered and just recieved this morning the circuitco LCD3 cape, to compare a known good example.
    http://elinux.org/CircuitCo:BeagleBone_LCD3
    After ts_calibrate/ts_test on the LCD3 cape, I had about 20 reboots all showing correct results with ts_test.
    All testing I'm doing by loading the kernel over tftp and debian rootfs from nfs, so everything is using the exact same kernel and rootfs.

    So, I'm feeling the problem is unlikely software. Unfortunately, that is leaving me stumped on the hardware side. Anymore pointers suggestions would be very appreciated. Thanks


    results after ts_calibration
    ts_print
    1387418934.705009: -1 0 402
    1387418934.706895: 0 0 402
    1387418934.710663: 0 1 402
    1387418934.714415: 0 1 402
    1387418934.718192: -1 1 402

    ts_print_raw
    387418896.100912: 176 213 367
    1387418896.104685: 176 208 366
    1387418896.110600: 0 0 0
    1387418896.110600: 176 208 0

    results after reboot and ts_test is incorrect
    ts_print
    1387419210.051913: -18 1 417
    1387419210.055666: -18 1 416
    1387419210.074670: -18 1 0

    ts_print_raw
    1387419285.560061: 63 201 340
    1387419285.561967: 63 200 344
    1387419285.563870: 65 196 349
    1387419285.569792: 0 0 0
    1387419285.569792: 65 196 0

  • I want to add something interesting I just found.  If I blank the frame-buffer and then turn it back on, and run ts_test, this sequence appears to modify the results of ts_test.  

    I can do the following and see varying results with ts_test.

    echo 1 > /sys/class/graphics/fb0/blank 

    echo 0 > /sys/class/graphics/fb0/blank 

    ts_test

  • Hi Miroslav,

    Thanks for your help on this matter.  Looks like I was able to get it sorted out.

    I took a closer look at the lcd datasheet and display-timings section of my device tree overlay.  

    Found some mistakes I made and corrected them, ts_test is dead on every boot now.

    thanks again.

  • Hi Brian,

    It seems I have same problem you had.

    Can you explain me how you fix it ?

    regards

  • We are using a custom LCD and we need to make a device tree overlay for that LCD.  You can use existing beaglebone black lcd capes as a starting point.  You'll need to look at the datasheet for your LCD and get the correct value for your device tree overlay.

    The following values in the device tree overlay need to be correct for your lcd, I believe my problem was in the display-timings.

                            panel {
                                    compatible = "tilcdc,panel";
                                    pinctrl-names = "default";
                                    pinctrl-0 = <&jamex_lcd_pins>;
    
                                    panel-info {
                                            ac-bias           = <255>;
                                            ac-bias-intrpt    = <0>;
                                            dma-burst-sz      = <16>;
                                            bpp               = <16>;
                                            fdd               = <0x80>;
                                            tft-alt-mode      = <0>;
                                            stn-565-mode      = <0>;
                                            mono-8bit-mode    = <0>;
                                            invert_line_clock = <1>;
                                            invert_frm_clock  = <1>;
                                            sync-edge         = <0>;
                                            sync-ctrl         = <1>;
                                            raster-order      = <0>;
                                            fifo-th           = <0>;
                                            //invert-pxl-clk;
                                            //invert-pxl-clk    = <0>;
                                    };
    
                                    display-timings {
                                            native-mode = <&timing0>;
                                            timing0: 640x480-63 {
                                                    hactive         = <640>;
                                                    vactive         = <480>;
                                                    hback-porch     = <97>;
                                                    hfront-porch    = <46>;
                                                    hsync-len       = <2>;
                                                    vback-porch     = <33>;
                                                    vfront-porch    = <11>;
                                                    vsync-len       = <2>;
                                                    clock-frequency = <40000000>;
                                                    invert_pxl_clk = <0>;
                                                    //hsync-active    = <1>;
                                                    //vsync-active    = <0>;
                                            };
                                    };
    

  • before you change device tree overlay, your screen was working correctly ?

    Can you show me what was old tree overlay used ?

    I try to edit this to use my own LCD but it changes nothing.
  • -The issue was pretty well described above.

    -This was before we committed the dts file to revision control and I don't recall the exact value(s) that I corrected.
    I would focus on hback-porch, hfront-porch, hsync-len, vback-porch, vfront-porch, vsync-len and clock-frequency.

    -The answer should be in your LCD datasheet, that and possibly some trial and error.
  • Ok.

    I try this too :

    echo 1 > /sys/class/graphics/fb0/blank

    echo 0 > /sys/class/graphics/fb0/blank

    ts_print

    and It modifies my touchscreen offset.

    Is it possible that LCD screen or backlight increase DC charge in touchscreen panel when LCD is activated ?
  • Hi all,

    I think my problem comes from advisory 1.0.31 about touchscreen and false pen-up event.
    I use BPS from phytec based on PSP AM335xPSP_04.06.00.11.
    Anyone have a tsc driver for am335x with path for this advisory ?
  • How could be related this two things: display-timings and touchscreen problem?
    I have your same problem after various reboot but I'm not able to solve it

    thanks for help