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.

AM3354: TSC2046 driver issue

Part Number: AM3354
Other Parts Discussed in Thread: TSC2046, ADS7846

Hi all,

I am using custom board with AM3354 SoC. Board is copy of BeagleBone Black + TSC2046 connected to SPI0 CS0 which is used for touchscreen controller of the AM-1024768FTMQW-T00H LCD.

I use Processor SDK Linux  06_01_00_08.

In order to get any response when I touch the display I had to modify the ads7846.c driver as shown bellow:

 /*
 * We'd set TX word size 8 bits and RX word size to 13 bits ... except
 * that even if the hardware can do that, the SPI controller driver
 * may not.  So we stick to very-portable 8 bit words, both RX and TX.
 */

-   spi->bits_per_word = 8;   
+  spi->bits_per_word = 16;

-   spi->mode = SPI_MODE_0;
+  spi->mode = SPI_MODE_1;
    err = spi_setup(spi);
    if (err < 0)

However, when I touch the display I start getting the following error outputted continuously:
[ 1487.869143] ads7846 spi0.0: spi_sync --> -22                                                        
[ 1487.889109] ads7846 spi0.0: spi_sync --> -22                                                        
[ 1487.909106] ads7846 spi0.0: spi_sync --> -22                                                        
[ 1487.929139] ads7846 spi0.0: spi_sync --> -22                                                        
[ 1487.949088] ads7846 spi0.0: spi_sync --> -22                                                        
[ 1487.969110] ads7846 spi0.0: spi_sync --> -22                                                        
[ 1487.989070] ads7846 spi0.0: spi_sync --> -22                                                        
[ 1488.009115] ads7846 spi0.0: spi_sync --> -22                                                        
[ 1488.029154] ads7846 spi0.0: spi_sync --> -22

Here is my dts node:
&spi0 {
        pinctrl-names = "default";
        pinctrl-0 = <&spi0_pins>;
        status = "okay";
    tsc2046@0 {
        reg = <0>;    
        compatible = "ti,tsc2046";
        interrupt-parent = <&gpio3>;
        interrupts = <14 0>;    
        spi-max-frequency = <1000000>;
        pendown-gpio = <&gpio3 14 0>;

        ti,x-min = /bits/ 16 <0>;
        ti,x-max = /bits/ 16 <8000>;
        ti,y-min = /bits/ 16 <0>;
        ti,y-max = /bits/ 16 <4800>;
        ti,x-plate-ohms = /bits/ 16 <350>;
        ti,pressure-max = /bits/ 16 <255>;
        wakeup-source;
    };

};

I seem to get the touchscreen controller registered & initialized in the kernel:

[    4.327498] ads7846 spi0.0: spi0.0 supply vcc not found, using dummy regulator                       
[    4.334991] ads7846 spi0.0: Linked as a consumer to regulator.0                                      
[    4.341408] ads7846 spi0.0: touchscreen, irq 55
[    4.346128] input: ADS7846 Touchscreen as /devices/platform/ocp/48030000.spi/spi_master/spi0/spi0.0/0

I am able to see the gpio3_14 registered in /proc/interrupts as irq for ads7846:
52:          0      INTC 111 Level     48310000.rng                                                    
 53:        965      INTC  37 Level     SGX ISR                                                         
 55:          0  481ae000.gpio  14 Edge      ads7846                                                    
 56:          0  44e07000.gpio   6 Edge      48060000.mmc cd                                           
I see the irq incrementing when tapping on the display, but at the same time the kernel starts continously outputting ads7846 spi0.0: spi_sync --> -22, the part where this error comes from is: 
ads7846_read_state() ->
   while (msg_idx < ts->msg_count) {

        ts->wait_for_sync();

        m = &ts->msg[msg_idx];

        error = spi_async(ts->spi, m);//error = spi_sync(ts->spi, m);

        if (error) {
            dev_err(&ts->spi->dev, "spi_async --> %d\n", error);
            packet->tc.ignore = true;
            return;
        }

which can be tracked to spi.c driver, where spi_sync() is implemented. The error -22 seems to indicate that the message is of incompatible type (include/uapi/asm-generic/errno-base.h):
#define    EINVAL        22    /* Invalid argument */

Also when ads7846 spi0.0: spi_sync --> -22, there is NO signal on the spi bus. The ads7846.c cannot read the touchscreen data from the TSC2046. 

Previously I've used a customized driver with kernel 3.2 (Sitara Linux SDK 06.00.00.00) and it worked, but now the requirement is to stick with PROCESSOR SDK LINUX (kernel mainline) sources, so I have to use ads7846.c.

Can anyone help with pointers on what might be wrong?

Thanks and regards.

  • Hello,

    Just an FYI, support will be limited on this question: I do not have any hardware with that part, we do not support driver modification on these forums, and it looks like the community maintains the driver instead of TI.

    Why did you make the driver changes that you did?

    Regards,

    Nick

  • Hi NIck,

    As I said, it was not working with SPI_MODE_0, anyway I managed to get rid of the spi_sync() error, by changing back the bits_per_word parameter to 8, but now I see constant activity on the spi line:

    PENDOWN IRQ (connected to gpio3_14) is now constantly low and floods the processor with interrupts, hence the touchscreen is irresponsive.

    I understand that you cannot replicate this on your side, because of the custom hardware, and if you don't have any ideas for further debugging, you could consider this closed. However I'd appreciate any pointers for debugging this.

    Best Regards,
    Yordan