2008-03-17 16:29:41     nano-X with AD7877 in svn

Document created by Aaronwu Employee on Aug 6, 2013
Version 1Show Document
  • View in full screen mode

2008-03-17 16:29:41     nano-X with AD7877 in svn

Andreas Schroeder (GERMANY)

Message: 52605    Hi,

 

i used nano-x with AD7877 with an older kernel. Now i updated to svn:

 

kernel:    Linux release 2.6.24.3-ADI-2008R2-pre-bf400-svn4462, build #24 PREEMPT Mon Mar 17 21:03:00 CET 2008

toolchain: bfin-uclinux-gcc release gcc version 4.1.2 (ADI svn)

user-dist: release svn-6379, build #210 Thu Mar 13 09:16:27 CET 2008

In the new kernel the tsdev does not exist, so /dev/ts does not exist too.

 

Now nano-X doesn't run anymore:

 

root:/var/nano-x> ./nano-X &

88

root:/var/nano-x> Error 19 opening AD7877 touchscreen device [/dev/ts0]

Cannot initialise mouse

 

Can anybody tell me what happend to the tsdev or how to use AD7877 in nano-X without it?

 

Greetings,

Andreas

QuoteReplyEditDelete

 

 

2008-03-17 17:19:51     Re: nano-X with AD7877 in svn

Mike Frysinger (UNITED STATES)

Message: 52610    try symlinking /dev/input/ts0 to /dev/ts0 and it should work

QuoteReplyEditDelete

 

 

2008-03-17 18:10:12     Re: nano-X with AD7877 in svn

Andreas Schroeder (GERMANY)

Message: 52611    Thanks for the good idea.

I couldn't ln the device, because ts0 does already exist, but i changed the inputdevice in the touchscreen_ad7877.h in the microwindows dir. Now it starts but it does not work:

 

[AD7877] Error 22 reading from touch panel

nano-X: GsError (GrGetNextEvent) Mouse error

 

I checked ad7877 input with event_test and this works a little bit:

 

root:/var/nano-x> ./event_test /dev/input/event0

Input driver version is 1.0.0

Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0

Input device name: "AD7877 Touchscreen"

Supported events:

  Event type 0 (Reset)

    Event code 0 (Reset)

    Event code 3 (Absolute)

  Event type 3 (Absolute)

    Event code 0 (X)

      Value      0

      Min        0

      Max     4095

    Event code 1 (Y)

      Value      0

      Min        0

      Max     4095

    Event code 24 (Pressure)

      Value      0

      Min        0

      Max     1000

Testing ... (interrupt to exit)

Event: time 322255543.788184, type 0 (Reset), code 0 (Reset), value 0

Event: time 322255544.700188, type 0 (Reset), code 0 (Reset), value 0

Event: time 322255547.656191, type 0 (Reset), code 0 (Reset), value 0

 

But the touchscreen does not deliver any coordinates..

I checked with TSLIB tool and it's similar. The calibration tool starts but it does not get any data from the touch.

 

So i does not work at the moment...

 

Best regards

Andreas

QuoteReplyEditDelete

 

 

2008-03-17 18:35:03     Re: nano-X with AD7877 in svn

Mike Frysinger (UNITED STATES)

Message: 52613    tsdev was deprecated (and removed in trunk) so nano-x may need updating to use tslib+evdev like everyone else

QuoteReplyEditDelete

 

 

2008-03-18 06:04:22     Re: nano-X with AD7877 in svn

Andreas Schroeder (GERMANY)

Message: 52677    ok, thanks.

I'll try to patch nano-x and look why event_test does only return 0 (reset) events...

QuoteReplyEditDelete

 

 

2008-03-18 07:12:39     Re: nano-X with AD7877 in svn

Mike Frysinger (UNITED STATES)

Message: 52687    event_test should do the right thing regardless of nano-x ... but i'll have to build up trunk to test it out.  i know it's working in 2008R1 as i tested that yesterday.

QuoteReplyEditDelete

 

 

2008-03-18 16:55:45     Re: nano-X with AD7877 in svn

Andreas Schroeder (GERMANY)

Message: 52717    I patched microwindows. now it runs with tslib. but i have some problems with the ad7877 driver. it does not execute any interrupt when there is not trafic on the spi-bus. i used a small script to generate some traffic and then it worked...

ad7877_poll.sh

microwin_tslib.patch

QuoteReplyEditDelete

 

 

2008-03-18 17:12:12     Re: nano-X with AD7877 in svn

Mike Frysinger (UNITED STATES)

Message: 52720    there should be no need for -I/-L paths to the tslib build directory ... those things are installed into the staging directory and paths to those get automatically added to your flags by the uclinux-dist build system

 

so simply using #include <tslib.h> in the source should be sufficient

 

should abstract the PD return type away with a typedef rather than using an (int) cast ... that'll break on any system where sizeof(int) != sizeof(void*) ... so any 64bit system

 

comparing (pd_fd < NULL) looks wrong ... that should obviously be a !=

 

did you try running the ts_calibrate app ?

http://docs.blackfin.uclinux.org/doku.php?id=ad7877_touchscreen_input_device_driver#touchscreen_calibration

 

otherwise, perhaps Michael Hennerich could comment on the lack of traffic ...

QuoteReplyEditDelete

 

 

2008-03-18 17:22:43     Re: nano-X with AD7877 in svn

Andreas Schroeder (GERMANY)

Message: 52721    ok, there are some things to modify in that patch. I extracted some parts of a pda patch.

 

i tryed event_test and ts_calibrate. both work only when the poll-script is running.

QuoteReplyEditDelete

 

 

2008-03-19 05:14:20     Re: nano-X with AD7877 in svn

Michael Hennerich (GERMANY)

Message: 52746    Andreas,

 

the AD7877 driver works fine on svn trunk.

Are you sure that you have wired up the AD7877 /DAV Interrupt - and NOT the PENIRQ.

PENIRQ is not used by the driver.

 

-Michael

 

root:/> version

kernel:    Linux release 2.6.24.3-ADI-2008R2-pre-svn4471, build #5705 Wed Mar 19 09:33:44 CET 2008

toolchain: bfin-linux-uclibc-gcc release gcc version 4.1.2 (ADI svn)

user-dist: release svn-6302, build #1983 Wed Mar 19 09:32:57 CET 2008

root:/> event_test /dev/input/event1

Input driver version is 1.0.0

Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0

Input device name: "AD7877 Touchscreen"

Supported events:

  Event type 0 (Reset)

    Event code 0 (Reset)

    Event code 3 (Absolute)

  Event type 3 (Absolute)

    Event code 0 (X)

      Value   2280

      Min        0

      Max     4095

    Event code 1 (Y)

      Value   1723

      Min        0

      Max     4095

    Event code 24 (Pressure)

      Value      0

      Min        0

      Max     1000

Testing ... (interrupt to exit)

Event: time 39.112000, type 3 (Absolute), code 0 (X), value 1164

Event: time 39.112000, type 3 (Absolute), code 1 (Y), value 2198

Event: time 39.112000, type 3 (Absolute), code 24 (Pressure), value 324

Event: time 39.112000, type 0 (Reset), code 0 (Reset), value 0

Event: time 39.208000, type 3 (Absolute), code 24 (Pressure), value 0

Event: time 39.208000, type 0 (Reset), code 0 (Reset), value 0

Event: time 39.564000, type 3 (Absolute), code 0 (X), value 2664

Event: time 39.564000, type 3 (Absolute), code 1 (Y), value 1649

Event: time 39.564000, type 3 (Absolute), code 24 (Pressure), value 280

Event: time 39.564000, type 0 (Reset), code 0 (Reset), value 0

Event: time 39.608000, type 3 (Absolute), code 0 (X), value 2663

Event: time 39.608000, type 3 (Absolute), code 1 (Y), value 1680

Event: time 39.608000, type 3 (Absolute), code 24 (Pressure), value 277

Event: time 39.608000, type 0 (Reset), code 0 (Reset), value 0

Event: time 39.652000, type 3 (Absolute), code 0 (X), value 2657

Event: time 39.652000, type 3 (Absolute), code 1 (Y), value 1700

Event: time 39.652000, type 0 (Reset), code 0 (Reset), value 0

Event: time 39.696000, type 3 (Absolute), code 0 (X), value 2654

Event: time 39.696000, type 3 (Absolute), code 1 (Y), value 1716

Event: time 39.696000, type 3 (Absolute), code 24 (Pressure), value 274

Event: time 39.696000, type 0 (Reset), code 0 (Reset), value 0

Event: time 39.740000, type 3 (Absolute), code 1 (Y), value 1724

Event: time 39.740000, type 3 (Absolute), code 24 (Pressure), value 272

Event: time 39.740000, type 0 (Reset), code 0 (Reset), value 0

Event: time 39.780000, type 3 (Absolute), code 0 (X), value 2650

Event: time 39.780000, type 3 (Absolute), code 1 (Y), value 1725

Event: time 39.780000, type 3 (Absolute), code 24 (Pressure), value 275

Event: time 39.780000, type 0 (Reset), code 0 (Reset), value 0

Event: time 39.824000, type 3 (Absolute), code 0 (X), value 2657

Event: time 39.824000, type 3 (Absolute), code 1 (Y), value 1761

Event: time 39.824000, type 3 (Absolute), code 24 (Pressure), value 422

Event: time 39.824000, type 0 (Reset), code 0 (Reset), value 0

Event: time 39.876000, type 3 (Absolute), code 24 (Pressure), value 0

Event: time 39.876000, type 0 (Reset), code 0 (Reset), value 0

Event: time 40.112000, type 3 (Absolute), code 0 (X), value 3156

Event: time 40.112000, type 3 (Absolute), code 1 (Y), value 2742

Event: time 40.112000, type 3 (Absolute), code 24 (Pressure), value 299

Event: time 40.112000, type 0 (Reset), code 0 (Reset), value 0

Event: time 40.156000, type 3 (Absolute), code 0 (X), value 3152

Event: time 40.156000, type 3 (Absolute), code 1 (Y), value 2719

Event: time 40.156000, type 3 (Absolute), code 24 (Pressure), value 289

Event: time 40.156000, type 0 (Reset), code 0 (Reset), value 0

Event: time 40.200000, type 3 (Absolute), code 1 (Y), value 2718

Event: time 40.200000, type 3 (Absolute), code 24 (Pressure), value 286

Event: time 40.200000, type 0 (Reset), code 0 (Reset), value 0

Event: time 40.244000, type 3 (Absolute), code 1 (Y), value 2712

Event: time 40.244000, type 3 (Absolute), code 24 (Pressure), value 281

Event: time 40.244000, type 0 (Reset), code 0 (Reset), value 0

Event: time 40.284000, type 3 (Absolute), code 1 (Y), value 2717

Event: time 40.284000, type 3 (Absolute), code 24 (Pressure), value 278

Event: time 40.284000, type 0 (Reset), code 0 (Reset), value 0

Event: time 40.328000, type 3 (Absolute), code 0 (X), value 3151

Event: time 40.328000, type 3 (Absolute), code 1 (Y), value 2718

Event: time 40.328000, type 3 (Absolute), code 24 (Pressure), value 295

Event: time 40.328000, type 0 (Reset), code 0 (Reset), value 0

Event: time 40.424000, type 3 (Absolute), code 24 (Pressure), value 0

Event: time 40.424000, type 0 (Reset), code 0 (Reset), value 0

QuoteReplyEditDelete

 

 

2008-03-19 15:33:36     Re: nano-X with AD7877 in svn

Jonathan Kotta (UNITED STATES)

Message: 52769    So I spent a good chunk of yesterday looking at this exact same problem.  I guess I should have checked here first.  I basically did exactly what you did.

 

 

In PD_Open(), you should do something more like this:

 

static struct tsdev *ts;

 

static int tslib_open(MOUSEDEVICE *pmd)

{

...

    ts = ts_open(devnode, 1);

 

    if (!ts) {

    EPRINTF("Error %d opening tslib device [%s]\n",

        errno, devnode);

    return -1;

    }

 

    if (ts_config(ts)) {

    EPRINTF("Error %d configuring tslib\n",

        errno);

    return -1;

    }

 

    GdHideCursor(&scrdev); 

    return ts_fd(ts);

}

 

struct tsdev has a member that keeps track of the fd of the device node.  That way the higher layers can use the fd in select(). 

 

So I have another problem.  the Read() function appears to get valid values from tslib.  But somewhere along the processing chain, the engine decides that the mouse hasn't changed, and the actual coordinates (xpos, ypos) are never changed.  I'll try with your patch and see if it's a mistake I made.

QuoteReplyEditDelete

 

 

2008-03-19 19:47:25     Re: nano-X with AD7877 in svn

Jonathan Kotta (UNITED STATES)

Message: 52785    I got it to work.  Is it normally pretty slow?

microwin.patch

QuoteReplyEditDelete

 

 

2008-03-26 17:04:31     Re: nano-X with AD7877 in svn

Andreas Schroeder (GERMANY)

Message: 53077    I'm a little bit busy at the momet, so i didn't have much time to do blackfin-work.

I have got still some problems with the ad7877. I think there is a problem with my tft-driver, because it works when i set STOPACQ=0 in the platform-dev configuration and don't load the tft-driver-modul. So I have to check the driver and maybe the hardware.

At the moment my nano-x touch-interface is pretty slow too.

QuoteReplyEditDelete

 

 

2008-03-27 03:58:46     Re: nano-X with AD7877 in svn

Yi Li (CHINA)

Message: 53101    Jonathan,

 

Will you send this patch to upstream microwindows? Or I will have a try and send it out.

 

Thanks,

-YI

QuoteReplyEditDelete

 

 

2008-03-27 06:20:33     Re: nano-X with AD7877 in svn

Yi Li (CHINA)

Message: 53122    I tested on BF548-EZKIT (500MHz), the cursor move quite fast. (What do you mean by "slow")?

 

Do you use the default tslib setting:

       module_raw input

        module pthres pmin=1

        module variance delta=30

        module dejitter delta=100

        module linear

QuoteReplyEditDelete

 

 

2008-03-27 14:19:07     Re: nano-X with AD7877 in svn

Jonathan Kotta (UNITED STATES)

Message: 53160    Yi Li:

 

By "slow" I mean there is a lot of latency.  The cursor can move fast; the cursor moves straight to anywhere I touch.  But there is a noticable delay between touching and cursor movement.  If I drag the stylus across the screen, the cursor is a few mm behind.  I have the same hardware and ts.conf as you.

 

I am comparing this to a completely different platform, the omap5912osk, which uses KDrive and tslib, and has much better latency in the touchscreen.  I haven't had time to see where the bottleneck is, if there is one at all.

 

I will try to push the patch up to Microwin.

QuoteReplyEditDelete

 

 

2008-03-27 18:04:53     Re: nano-X with AD7877 in svn

Javier Herrero (SPAIN)

Message: 53186    Hello,

 

I'm currently testing your patch on a BF532, but using the ADS7846 diver instead of the AD7877. As far as I've tested it, seems to work fine, with no noticeable latency.

 

Regards,

 

Javier

QuoteReplyEditDelete

 

 

2008-04-02 03:07:32     Re: nano-X with AD7877 in svn

Yi Li (CHINA)

Message: 53508    It looks there is issue with this patch, while using tslib and nano-x together, "top" shows nano-x is using 99% of the CPU.

 

"

  PID USER     STATUS   VSZ  PPID %CPU %MEM COMMAND

  785 root        S           1254     1    99.2   2.0         nano-X"

QuoteReplyEditDelete

 

 

2008-04-02 14:51:25     Re: nano-X with AD7877 in svn

Andreas Schroeder (GERMANY)

Message: 53562    Hi,

 

it was the same with the version using tsdev. So maybe it's not a bug in this patch.

 

-Andreas

QuoteReplyEditDelete

 

 

2008-04-03 02:38:12     Re: nano-X with AD7877 in svn

Yi Li (CHINA)

Message: 53583    I tested with the old "tsdev" driver, it looks nanox uses about 1% CPU, I add a bug here: http://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=4008, since the patch has been checked into uclinux-dist.

Outcomes