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.

Linux/AM4378: Erratic touchscreen pen-up events

Part Number: AM4378

Tool/software: Linux

TISDK version: 4.3.0.5

Linux Version: 4.9.69

I am trying to get the touchscreen working on a custom board and I was getting very erratic pen up event coordinates. I read here that increasing the value of the "ti,charge-delay" property could help with this. I increased the value and it definitely helped, but I was still getting some inconsistent results every once in a while.

I guess my first question is, what is a normal value for the ti,charge-delay property? And secondly, do you have any idea why the driver would be giving these inconsistent results?

  • Hello Tanner,

    Double-checking: you are using a resistive touch screen connected through the ADC input pins, right?

    What values are you passing to the tsadc driver through your device tree?

    Regards,
    Nick
  • Hey Nick,

    Yes that is correct - I am using a resistive touch screen connected with ADC pins. Currently, my tsadc node in my device looks like this:

    &tscadc {
        status = "okay";
        compatible = "ti,am3359-tscadc";
        tsc {
            ti,wires = <4>;
            ti,x-plate-resistance = <500>;
            ti,coordinate-readouts = <5>;
            ti,wire-config = <0x00 0x11 0x22 0x33>;
            ti,charge-delay = <0x4000>;
        };
    };

  • Tanner,

    From the bindings document included in the SDK:

    Optional properties:
    - child "tsc"
            ti,charge-delay: Length of touch screen charge delay step in terms of
                             ADC clock cycles. Charge delay value should be large
                             in order to avoid false pen-up events. This value
                             effects the overall sampling speed, hence need to be
                             kept as low as possible, while avoiding false pen-up
                             event. Start from a lower value, say 0x400, and
                             increase value until false pen-up events are avoided.
                             The pen-up detection happens immediately after the
                             charge step, so this does in fact function as a
                             hardware knob for adjusting the amount of "settling
                             time".

    These values usually need to be "tuned" to each touchscreen, and even each board.

    I hope this is helpful to you.

  • Sorry, meant to mention that the document is in Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt and may provide some other useful information for you as you tune your touchscreen.

  • Yes, I saw that documentation (it was linked in my original post). But how high can the charge delay go? As you can see, I already have it set at 0x4000. I actually tried going all the way up to 0x9000, but even then I still was not getting 100% accuracy.

  • Tanner,

    I'm sorry I missed the link in your original post. 

    I took a look at the driver, and it is using this value to program the TS_CHARGE_DELAY register at line 183 of drivers/input/touchscreen/ti_am335x_tsc.c. Here is an overview of the register:

    So it seems you could theoretically go up to 0x40000.

    I hope this helps.

  • Ron,

    Thank you for pointing me to that register field. The driver documentation says to start with a charge delay at 0x400 but it doesn't say anything about the max value, so I wasn't sure at what point increasing it would stop having an effect. It seems like a charge delay value around 0x20000 gives consistent results for my touchscreen.

  • Tanner,

    Yes, we could definitely improve that doc to make it more clear. I'm glad you were able to find a value that works well.

    Thanks again for the post.