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.

AM335xEVM + capacitive touchscreen Sitronix st1232 + ti-sdk-am335x-evm-06.00.00.00 linux

Hi, I have a custom board based on AM335xEVM. The board has a capacitive touch with Atmel mXT224E or Sitronix st1232. mXT224E works fine but I have problems with st1232.

I think touch chip and software driver are working:

* Driver is init ok:

root@am335x-evm:~# dmesg | grep st1232                                                                                                                                                                                                      
[    1.587432] input: st1232-touchscreen as /devices/platform/omap/omap_i2c.1/i2c-1/1-0055/input/input0

This output is a single finger single touch:

root@am335x-evm:~# evtest /dev/input/event0                                                                                                                                                                                                  
Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0x0 product 0x0 version 0x0
Input device name: "st1232-touchscreen"
Supported events:
  Event type 0 (Sync)
  Event type 1 (Key)
    Event code 330 (Touch)
  Event type 3 (Absolute)
    Event code 0 (X)
      Value      0
      Min        0
      Max        0
    Event code 1 (Y)
      Value      0
      Min        0
      Max        0
    Event code 48 (Touch Major)
      Value      0
      Min        0
      Max      255
    Event code 53 (Position X)
      Value      0
      Min        0
      Max      799
    Event code 54 (Position Y)
      Value      0
      Min        0
      Max      479
Testing ... (interrupt to exit)
Event: time 1389914878.971455, type 3 (Absolute), code 48 (Touch Major), value 95
Event: time 1389914878.971455, type 3 (Absolute), code 53 (Position X), value 368
Event: time 1389914878.971486, type 3 (Absolute), code 54 (Position Y), value 268
Event: time 1389914878.971486, -------------- Config Sync ------------
Event: time 1389914878.971486, -------------- Report Sync ------------
Event: time 1389914878.994649, type 3 (Absolute), code 48 (Touch Major), value 58
Event: time 1389914878.994649, type 3 (Absolute), code 53 (Position X), value 368
Event: time 1389914878.994649, type 3 (Absolute), code 54 (Position Y), value 266
Event: time 1389914878.994649, -------------- Config Sync ------------
Event: time 1389914878.994649, -------------- Report Sync ------------
Event: time 1389914879.006520, -------------- Config Sync ------------
Event: time 1389914879.006520, -------------- Report Sync ------------
Event: time 1389914879.397542, -------------- Config Sync ------------
Event: time 1389914879.397542, -------------- Report Sync ------------
Event: time 1389914879.407033, -------------- Config Sync ------------
Event: time 1389914879.407063, -------------- Report Sync ------------

ts_calibrate and ts_test failed:

root@am335x-evm:~# ts_test 
tslib: Selected device is not a touchscreen (must support ABS_X and ABS_Y events)

But I modified linux driver /drivers/input/touchscreen/st1232.c:

static int __devinit st1232_ts_probe(struct i2c_client *client,
					const struct i2c_device_id *id)
{
{...}
	set_bit(EV_KEY, input_dev->evbit);//added
	set_bit(ABS_X, input_dev->absbit);//added
	set_bit(ABS_Y, input_dev->absbit);//added
	set_bit(BTN_TOUCH, input_dev->keybit);//added

	input_set_abs_params(input_dev,ABS_MT_TOUCH_MAJOR, 0, MAX_AREA, 0, 0);
{...}
}

Whith these modifications ts_test and ts_calibrate do not produce error, but they don't work:

- ts_test: when I touch the panel, mouse cursor goes to x,y=0,0

- ts_calibrate: when I touch the panel it does not do anything, it keeps waiting for touch presses.

mxt224 touchscreen does work with my Qt app, but ts1232 touchscreen does not work. I modify this export:

- With mxt224: export QWS_MOUSE_PROTO="Tslib:/dev/input/touchscreen"

- With st1232: export QWS_MOUSE_PROTO="Tslib:/dev/input/event0"

ts1232 creates mouse0 and event0, but I see activity only in event0, in mouse0 I only see debug info I have added to the linux driver:

root@am335x-evm:~# cat /proc/bus/input/devices 
I: Bus=0018 Vendor=0000 Product=0000 Version=0000
N: Name="st1232-touchscreen"
P: Phys=
S: Sysfs=/devices/platform/omap/omap_i2c.1/i2c-1/1-0055/input/input0
U: Uniq=
H: Handlers=mouse0 event0 
B: PROP=0
B: EV=b
B: KEY=400 0 0 0 0 0 0 0 0 0 0
B: ABS=610000 3

root@am335x-evm:~# ls /dev/input/ by-path event0 mice mouse0 root@am335x-evm:~# cat /dev/input/mouse0 [ 821.302947] DEBUG: finger[0]: x=465, y=213, t=213 [ 821.312805] DEBUG: finger[0]: x=465, y=213, t=213 [ 821.322662] DEBUG: finger[0]: x=465, y=213, t=212 [ 821.339935] DEBUG: finger[0]: x=465, y=213, t=211 [ 821.350433] DEBUG: finger[0]: x=465, y=213, t=209 [ 821.360961] DEBUG: finger[0]: x=465, y=213, t=205 [ 821.373229] DEBUG: finger[0]: x=464, y=213, t=195 [ 821.451995] DEBUG: finger[0]: x=464, y=214, t=186 [ 821.460937] DEBUG: finger[0]: x=463, y=215, t=178 [ 821.469512] DEBUG: finger[0]: x=463, y=215, t=173 [ 821.485748] DEBUG: finger[0]: x=463, y=215, t=168 [ 821.494415] DEBUG: finger[0]: x=463, y=215, t=168 [ 822.110107] DEBUG: finger[0]: x=433, y=218, t=166 [ 822.119964] DEBUG: finger[0]: x=433, y=218, t=171 [ 822.129821] DEBUG: finger[0]: x=431, y=218, t=176 [ 822.139678] DEBUG: finger[0]: x=430, y=218, t=181 [5]+ Stopped(SIGTSTP) cat /dev/input/mouse0 root@am335x-evm:~# cat /dev/input/event0 [ 839.011932] DEBUG: finger[0]: x=424, y=216, t=180��R�0���R�5���R�6 [ 839.021667] DEBUG: finger[0]: x=424, y=216, t=182��R���R���R�?0� [ 839.031555] DEBUG: finger[0]: x=423, y=216, t=185��R�?5���R�?6���R�?��R�? [ 839.041473] DEBUG: finger[0]: x=423, y=218, t=187��RKc0���RKc5���RKc6���RKc [ 839.051391] DEBUG: finger[0]: x=421, y=220, t=187��RKc��R��0���R��5���R��6 [ 839.062316] DEBUG: finger[0]: x=419, y=221, t=186��R����R����Rɵ0���Rɵ5���Rɵ6���R����R�����0����5����6���R'���R' [ 839.121154] DEBUG: finger[0]: x=418, y=223, t=185��R�~0���R�~5���R�~6 [ 839.129760] DEBUG: finger[0]: x=416, y=224, t=185��R�~��R�~ [ 839.138427] DEBUG: finger[0]: x=415, y=224, t=185��R��0���R��5���RԤ6 [ 839.147155] DEBUG: finger[0]: x=414, y=225, t=185��RԤ��RԤ��R��0� [ 839.155731] DEBUG: finger[0]: x=414, y=225, t=185��R��5���R��6���R����R����R��0���R��5���R��6���R����R����R� 0���R� 5���R� 6���R�

I think this is not the most suitable forum for this problem but I hope somebody could help me.

Thank you in advance

Best regards

  • I have found a solution here: http://lists.atmark-techno.com/pipermail/armadillo/2013-July/009068.html

    diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c
    index 4ab3713..170123d 100644
    --- a/drivers/input/touchscreen/st1232.c
    +++ b/drivers/input/touchscreen/st1232.c
    @@ -26,6 +26,8 @@
     #include <linux/slab.h>
     #include <linux/types.h>
    
    +#define FORCE_SINGLE_EVENT
    +
     #define ST1232_TS_NAME	"st1232-ts"
    
     #define MIN_X		0x00
    @@ -100,11 +102,27 @@ static irqreturn_t st1232_ts_irq_handler(int irq, void *dev_id)
     	struct input_dev *input_dev = ts->input_dev;
     	int count = 0;
     	int i, ret;
    +	static int pendown = 0;
    
     	ret = st1232_ts_read_data(ts);
     	if (ret < 0)
     		goto end;
    
    +#ifdef FORCE_SINGLE_EVENT
    +	for (i = 0; i < 1; i++) {
    +		if (!finger[i].is_valid) {
    +			pendown = 0;
    +			input_report_key(input_dev, BTN_TOUCH, 0);
    +			input_report_abs(input_dev, ABS_PRESSURE, 0);
    +		} else {
    +			if (pendown++ == 0)
    +				input_report_key(input_dev, BTN_TOUCH, 1);
    +			input_report_abs(input_dev, ABS_PRESSURE, 1);
    +			input_report_abs(input_dev, ABS_X, finger[i].x);
    +			input_report_abs(input_dev, ABS_Y, finger[i].y);
    +		}
    +	}
    +#else
     	/* multi touch protocol */
     	for (i = 0; i < MAX_FINGERS; i++) {
     		if (!finger[i].is_valid)
    @@ -120,6 +138,7 @@ static irqreturn_t st1232_ts_irq_handler(int irq, void *dev_id)
     	/* SYN_MT_REPORT only if no contact */
     	if (!count)
     		input_mt_sync(input_dev);
    +#endif
    
     	/* SYN_REPORT */
     	input_sync(input_dev);
    @@ -164,9 +183,16 @@ static int __devinit st1232_ts_probe(struct i2c_client *client,
     	__set_bit(EV_KEY, input_dev->evbit);
     	__set_bit(EV_ABS, input_dev->evbit);
    
    +#ifdef FORCE_SINGLE_EVENT
    +	input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
    +	input_set_abs_params(input_dev, ABS_PRESSURE, 0, 1, 0, 0);
    +	input_set_abs_params(input_dev, ABS_X, MIN_X, MAX_X, 0, 0);
    +	input_set_abs_params(input_dev, ABS_Y, MIN_Y, MAX_Y, 0, 0);
    +#else
     	input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, MAX_AREA, 0, 0);
     	input_set_abs_params(input_dev, ABS_MT_POSITION_X, MIN_X, MAX_X, 0, 0);
     	input_set_abs_params(input_dev, ABS_MT_POSITION_Y, MIN_Y, MAX_Y, 0, 0);
    +#endif
    
     	error = request_threaded_irq(client->irq, NULL, st1232_ts_irq_handler,
     				     IRQF_ONESHOT, client->name, ts);

    I think tslib does not understand multi-touch protocol, so the solution is using single-touch in st1232 driver. A better solution would be the latest tslib and Qt with multi-touch support.

    Regards