edjuh
Posts: 18
Joined: Sat Dec 21, 2013 12:38 pm

Re: Tontec 2.4-inch TFT LCD

Fri Feb 07, 2014 10:14 am

I seem to have a bit of a fight.
In X I can not get the menu to work with the correct credentials.
so I tried ; sudo make menuconfig (not (sudo) make xconfig)
but there I can not find the touchscreen menu at all.

On the edge of 'should we spell it out completely', how is the -nolisten option used?
Because that is preventing me from being able to doing - make xconfig - via sudo.
The PI is used headless BTW, which is perhaps not the wisest of choices here.

xof
Posts: 33
Joined: Thu Aug 29, 2013 10:35 am

Re: Tontec 2.4-inch TFT LCD

Fri Feb 07, 2014 4:31 pm

edjuh wrote:I seem to have a bit of a fight.
In X I can not get the menu to work with the correct credentials.
so I tried ; sudo make menuconfig (not (sudo) make xconfig)
but there I can not find the touchscreen menu at all.

On the edge of 'should we spell it out completely', how is the -nolisten option used?
Because that is preventing me from being able to doing - make xconfig - via sudo.
The PI is used headless BTW, which is perhaps not the wisest of choices here.
I talked about -nolisten because I have no screen connected to the Pi (no HDMI nor Composite ), no keyboard nor mouse, I have to use my desktop as an X server to run X applications on the Pi.

The 'old way' was simply,
* on the PI, to 'export DISPLAY=mydesktop:0.0' (or 'export DISPLAY=10.0.0.39:0.0') before launching an X application and,
* on my desktop, to allow external applications to use the display with an 'xhost +' in a session (via an xterm with a shell).

It didn't work and I discovered that X wasn't even listening to external connections (on Ubuntu 13.04); there is a '-nolisten' X option when you 'ps alx |grep X'. Googling, I found http://docs.petervg.nl/index.php/compon ... -in-ubuntu which helped except that it was not 'gdm' on my system but 'lightdm'... I had to add 'xserver-allow-tcp=true' in '/etc/lightdm/lightdm.conf' (instead of modifying /etc/gdm/gdm.schemas). I also removed the '-nolisten' in /etc/X11/xinit/xserverrc .

(To tell the whole story, I solved this a couple of weeks earlier, while trying Mathematica on the Pi : http://www.wolfram.com/raspberry-pi/ ... )


xof

User avatar
Hitechcomputergeek
Posts: 28
Joined: Wed Nov 27, 2013 4:29 am

Re: Tontec 2.4-inch TFT LCD

Sat Feb 08, 2014 12:08 am

Hitechcomputergeek wrote: Will try this soon.
Okay - 'soon' turned out being 'about a week' because I had a LOT of homework. I'm having trouble compiling it. How do I get the patch? I have cloned the git repositories, but I don't know what to do because I do not have another computer, and the directions at https://github.com/osandov/raspi/tree/master/tsc2007 are for cross-compiling it. I do have a jailbroken iPod Touch, but that is definitely not a Linux computer. I don't know what to do to compile it on the Pi itself.

xof
Posts: 33
Joined: Thu Aug 29, 2013 10:35 am

Re: Tontec 2.4-inch TFT LCD

Sat Feb 08, 2014 7:13 am

Hitechcomputergeek wrote: Okay - 'soon' turned out being 'about a week' because I had a LOT of homework. I'm having trouble compiling it. How do I get the patch? I have cloned the git repositories, but I don't know what to do because I do not have another computer, and the directions at https://github.com/osandov/raspi/tree/master/tsc2007 are for cross-compiling it. I do have a jailbroken iPod Touch, but that is definitely not a Linux computer. I don't know what to do to compile it on the Pi itself.
I talked about patches because it is what you get when you 'apt-get install linux-source-X.YY' : a tar.gz with the sources and a patch.gz file in /usr/src. When you 'git clone' (what?), I don't know if you need to patch (I guess no but I can't be sure - Remember : I don't tell you what to do, I just tell you what I have done (and, so far, I got a running kernel with a 'modprob-able' tsc2007 module, That's all).

When you have the source tree on your Pi (probably in /usr/src/linux-source-XX.YY.ZZ/), go there. You need a .config file (it is beginning with a dot, the file is 'invisible' by a simple 'ls' but 'ls -l .config' (or 'ls -li') would reveal it). You can get the running one by 'zcat /proc/config.gz > .config' . Have a look at the README file (in the source tree). You have to do something like 'make oldconfig' (or a variant); I suppose it 'upgrades' the .config file or something like that (I don't know if answering carefully to the many many questions helps, I just okayed all the many many questions with an <enter>. Now, you have to change the configuration because the tsc2007 driver (for the 'touch' part of the Tontec) is not compiled by default. To do that, you need to 'make <something>config'. Finding 'tsc2007' might be tricky as there are many many options and they doesn't seem to be all shown by default. edjuh did not find it in the 'menuconfig'. It seems easier (?) with 'xconfig' (I remembered using something like 10..15 years ago). You have to check an option to see all modules and search/find 'tsc2007' with <ctrl>-F. You can configure it as a module or hard-wired (toggle no/checked/dot-for-module). I suppose you can choose 'as a module' (dot).

If your Pi is connected to an HDMI screen, a keyboard and a mouse, all you need, to 'make xconfig', is 'apt-get install libqt4-dev'. When you use another computer as X-server, see above for the export DISPLAY=...; xhost + and the -nolisten stuff.

When the configuration is OK (there should be a 'CONFIG_TOUCHSCREEN_TSC2007=m' line in the .config file), just 'make' (and cross the fingers). It will takes about 7 hours on the Pi to complete. It is a good idea to log the compilation messages ('nohup make > somefile.log 2>&1') so you can check later what went wrong if it did. (I use 'nohup' because I don't want to stay connected to the Pi all the time). Don't wait 7 hours idle; check from time to time that it is still up and running ('tail somefile.log'; 'ls somefile.log';...). You can 'grep tsc2007 somefile.log' to check it has been compiled or 'find . -name "tsc2007*"' to check a tsc2007.ko has been generated.

When done (I did not see a special congratulation message, it seems to just stop without error message (?)). You need to install the stuff : 'make modules_install' will copy all the .ko files in a /lib/modules/<some-version>/ dircectory. The only thing left is to replace the /boot/kernel.img with the freshly compiled ./arch/arm/boot/zImage ('sudo cp ./arch/arm/boot/zImage /boot/kernel.img'). You need to be root (superuser; sudo) for these two last operations (not for the rest as long as you have 'rw'-rights in the source tree). It may be a good idea to save a copy of the running kernel.img; the modules take care of themselves if the compiled version is not the running one (they will go in another directory). That's all. You don't need to care about a Lilo or a grub, there is none, the boot process just load /boot/kernel.img. If it fails you just need to 'mount' the SD/file-system on another computer and restore the kernel.img.

Then 'sudo shutdown -r now' (don't just pull the power, the files need to be written on the SD card). Hopefully the Pi wakes up to life again and you can check you run your new kernel ('uname -a') and that you can 'sudo modprobe tsc2007', 'lsmod' (and eventually 'dmesg' to see what's going on (?)). Congratulation!

Then you are in unexplored territory for me as I still miss the hardware to go further. Grrr!...

xof

edjuh
Posts: 18
Joined: Sat Dec 21, 2013 12:38 pm

Re: Tontec 2.4-inch TFT LCD

Sat Feb 08, 2014 12:27 pm

It was about 15 years ago I did a kernel patch as well, so it's a bit of catching up, as well as .. uhhh, how did I do ... :oops:

xof
Posts: 33
Joined: Thu Aug 29, 2013 10:35 am

Re: Tontec 2.4-inch TFT LCD

Fri Feb 14, 2014 5:38 pm

I got the hardware a couple of days ago...

I have a tsc2007.ko module but I don't know how to use it yet... (I am using 3.6.11 but the compilation of 3.10.29 went fine)

If I just 'modprobe' it, it loads silently and 'dmesg' says nothing. After reading https://www.kernel.org/doc/Documentatio ... ng-devices, I tried :
# echo tsc2007 0x48 > /sys/class/i2c-adapter/i2c-1/new_device
dmesg gives
[ 8522.172306] i2c i2c-1: new_device: Instantiated device tsc2007 at 0x48
[ 8522.214216] tsc2007 1-0048: platform data is required!
[ 8522.214259] tsc2007: probe of 1-0048 failed with error -22
I don't know what it is all about neither how to supply it.
However, there are changes in 'tree' /sys/bus/i2c (some new stuff) but no changes in /dev/input/ and xinput_calibrator tells me :
Error: No calibratable devices found.

It is frustrating because the hardware seems working (and the chip is supported for a long time). I don't know about the interrupt yet; is it connected?, where?, is it needed?

If I write a little quick&dirty program interacting with the tsc2003 through /dev/i2c-1 ,

Code: Select all

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <linux/i2c-dev.h>
#include <sys/ioctl.h>
#include <fcntl.h>

const char *I2C_BUS_DEV = "/dev/i2c-1";

void crash(const char *str)
    {
    perror(str);
    exit(-1);
    }
int i2c_rw(int fd, int reg)
    {
    int    x;

    if ((x = i2c_smbus_read_word_data(fd, reg)) < 0)
        return(-1);
    return(((x&0xff)<<8) + ((x&0xff00)>>8));
    }
int main()
    {
    int    fd;
    int    res;
    int    x, y, z1, z2;

    if ((fd = open(I2C_BUS_DEV, O_RDWR)) < 0)
        crash(I2C_BUS_DEV);

    if (ioctl(fd, I2C_SLAVE, 0x48) < 0)  /* 0x1e = tsc2003 address */
        crash("I2C_SLAVE 0x1e tsc2003");

    while (1)
        {
        y = i2c_rw(fd, 0xd4);
        x = i2c_rw(fd, 0xc4);
        z1 = i2c_rw(fd, 0xe4);
        z2 = i2c_rw(fd, 0xf4);
        i2c_rw(fd, 0);
        printf("%6d %6d %6d %6d\n", x>>4, y>>4, z1>>4, z2>>4);
        usleep(500000);
        }

    close(fd);
    exit (0);
    }
(gcc -o tsc2003 -l rt tsc2003.c )

I can see differences in readings when I touch the screen :
Image
(The chip is read twice a second while I 'touch' (near) the four corners; interrupted with <ctrl>-C)

16 headers of the 3 rows are connected to LP3943 ('16-LED Fun Light Driver' http://www.ti.com/lit/ds/snvs256b/snvs256b.pdf). So, even with no documentation all the features of the board seem usable. It is just a question of 'Linux architecture' knowledge...

The screen refresh seems a little slow and the cpu load of mztx06a seems a little high (video doesn't seem to be an option; I don't know if it is by design (the use of the SPI bus) or because of the current implementation (that could be bettered with some 'firmware' to speed up the refresh and free the cpu (?))

edjuh
Posts: 18
Joined: Sat Dec 21, 2013 12:38 pm

Re: Tontec 2.4-inch TFT LCD

Fri Feb 14, 2014 6:43 pm

That looks good, I will give it another try this weekend, see what I can come up with.

theimmc
Posts: 53
Joined: Tue Feb 05, 2013 10:31 pm

Re: Tontec 2.4-inch TFT LCD

Fri Feb 14, 2014 11:41 pm

I haven't gotten the touchscreen to work (just stumbled onto this thread) but I fixed the CPU utilization on my display.

Essentially, mztx06a loops indefinitely, reading the frame buffer, looking for differences, and updating the LCD through I2C. It does this as quickly as it can, so it takes up all the idle CPU cycles on the Pi.

My workaround is twofold : add a delay loop to limit frame rate to 30 fps max, and change the makefile to turn on optimization.

Makefile change is easy - add -O3. This alone will not solve your CPU problem.

The changes in loadFrameBuffer_diff_320() :

Code: Select all

    while (1) {
+        struct timespec ts1, ts2;
+        long elapsed;

+        clock_gettime(CLOCK_MONOTONIC, &ts1);
        numdiff=0;

.....

            printf ("Read < %d chars when loading file %s\n", hsize*vsize*3, "ss");
+        clock_gettime(CLOCK_MONOTONIC, &ts2);
+        elapsed = ts2.tv_nsec - ts1.tv_nsec;
+        elapsed += (ts2.tv_sec - ts1.tv_sec) * 1000000000;
+        if (elapsed < 33333333) {
+            struct timespec et;
+            et.tv_sec = 0;
+            et. tv_nsec = 33333333 - elapsed;
+            nanosleep(&et, NULL);
+        }
    }
With this change, when screen is static, it only takes up about 15% CPU.

xof
Posts: 33
Joined: Thu Aug 29, 2013 10:35 am

Re: Tontec 2.4-inch TFT LCD

Sun Feb 16, 2014 6:58 am

Note : there is (also) some activity on github
around https://github.com/yaolet/mztx06a

https://github.com/yaolet/mztx06a/network shows the forks
(See https://en.wikipedia.org/wiki/GitHub on Wikipedia)

xof
Posts: 33
Joined: Thu Aug 29, 2013 10:35 am

Re: Tontec 2.4-inch TFT LCD

Tue Feb 18, 2014 5:14 pm

One step further...

looking at https://github.com/osandov/raspi/tree/master/tsc2007 (signaled by dougie » Wed Jan 29, 2014 7:14 am) , I realized that tsc_raspi.c seems to contain the missing 'platform data' for the Raspberry Pi...
(notice that Google gives very few results when searching 'tsc_raspi.c')

I copied the tsc_raspi.c and the Makefile in my /usr/src/linux-source-3.6/drivers/input/touchscreen/ directory (the Makefile under the name 'Makefile.tsc_raspi' to 'make -f Makefile.tsc_raspi' without compromising the original 3.6(.11) source tree). I got a 'tsc_raspi.ko' I could 'insmod' and 'dmesg' gave me some new messages :

[ 1940.800596] input: TSC2007 Touchscreen as /devices/virtual/input/input3
[ 1940.870244] tsc2007 0-0048: i2c io error: -5
[ 1940.881181] tsc2007 0-0048: i2c io error: -5

0-0048 was odd because(, on my model), the tsc2003 is on i2c-1 (and not i2c-0; there are two i2c buses on the Raspberry Pi)...
After replacing 'i2c_get_adapter(0)' by 'i2c_get_adapter(1)', 'insmod tsc_raspi.ko' gave me a clean :

[ 2334.292122] input: TSC2007 Touchscreen as /devices/virtual/input/input4

and no error message! Furthermore xinput_calibrator now finds a calibratable device :
Image

...Unfortunately, the device doesn't react yet when I touch it. I suspect one has to investigate the 'penirq_pin' stuff...

xof
Posts: 33
Joined: Thu Aug 29, 2013 10:35 am

Re: Tontec 2.4-inch TFT LCD

Thu Feb 20, 2014 12:01 pm

The TSC2003 (http://www.ti.com/lit/ds/symlink/tsc2003.pdf) *PENIRQ pin doesn't seem to be connected... (?)
Image
The pin doesn't seem to connect with GPIO-17 when I test it (with a continuity tester).
("PENIRQ GPIO pin (17=default)" in tsc_raspi.c (https://github.com/osandov/raspi/blob/m ... sc_raspi.c))

...It would be easier with the schematics of the board. This is a very mysterious board... Maybe someone should contact the author of the screen driver https://github.com/yaolet/mztx06a or of http://helloraspberrypi.blogspot.be/201 ... 0-rgb.html (?; he seems to have some more infos but doesn't know about the 'touch' part either). There is no reason to keep the schematics secret, the CPLD programming is enough (if necessary).

I do not dare to 'mod' the board yet (connect pin 10 of the TSC2003 to the header 11). Those pins are very tiny, aren't they?...

I wonder if I could go further by pulling up header 11 and grounding it by hand while touching the screen...

Anyway, it works with a mouse, no?...

theimmc
Posts: 53
Joined: Tue Feb 05, 2013 10:31 pm

Re: Tontec 2.4-inch TFT LCD

Thu Feb 20, 2014 6:49 pm

Personally, I'm more interested in using the screen as a control panel / display rather than a console, so I think the code you posted above is a great start for that, rather than a kernel module that can work as a mouse replacement. Thanks for investigating this touch screen. If anyone else got farther than you did on this, they did not post their results online.

takatango
Posts: 4
Joined: Sat Feb 15, 2014 8:55 pm
Location: Germany
Contact: Website

Re: Tontec 2.4-inch TFT LCD

Tue Feb 25, 2014 7:17 am

Hi all,
I wrote my dealer an and this is the answer:
"Please download all the datasheet in the descrption: http://dl.vmall.com/c0je2pnrxr All the datasheet we can supply are in the this link."
Can this help?
Greetings...
Last edited by takatango on Thu Feb 27, 2014 7:16 pm, edited 1 time in total.

theimmc
Posts: 53
Joined: Tue Feb 05, 2013 10:31 pm

Re: Tontec 2.4-inch TFT LCD

Tue Feb 25, 2014 8:03 am

takatango wrote:Hi all,
I wrote my dealer an and this is the answer:
"Please download all the datasheet in the descrption: http://dl.vmall.com/c0je2pnrxr All the datasheet we can supply are in the this link."
Can this help?
Greetings...
Many thanks for the file! The website worries me a little (it made a ton of connections after I clicked on it) but I managed to get the file down. It looks like the same files that is available on Tontec's Amazon listing, as well as on github (a few posts above). It adds to it datasheets for LP3943, TSC2003, and the schematic for the pi-mztx-ext. That is EXTREMELY useful!

I've copied it to my DropBox account. Feel free to download it from https://www.dropbox.com/s/udwgzfrl5zmwg ... xt_lcd.zip - if anyone only wants the schematic, you can find it at https://www.dropbox.com/s/hz2mo7cgmhxmo ... 10-sch.pdf

According to the schematics, /PENIRQ is connected to GPIO4.

xof
Posts: 33
Joined: Thu Aug 29, 2013 10:35 am

Re: Tontec 2.4-inch TFT LCD

Tue Feb 25, 2014 11:37 am

That is good news! :-)

However, in the "Raspberry Pi User Guide" (and http://elinux.org/RPi_Low-level_peripherals), pin 11 of J1 is also 'General Purpose Clock' (and I don't know what it means (and a lot of 'Do not connect' in the book (but not on the web) are connected)).

I thus tried

$ sudo insmod /usr/src/linux-source-3.6/drivers/input/touchscreen/tsc_raspi.ko penirq_pin=4

and seem to got no changes (?)...

Then I used WiringPi's '$ gpio readall' (http://wiringpi.com/) because it gives correspondences between physical and various logical names. Line 7 reads :

wiringPi =7; GPIO=4; Phys=7; Name=GPIO 7; Mode=IN; Value=low;

(I think that if is connected with /PENIRQ, 'value' should be 'high' (no touch) but who knows... (?))
It is a little strange the GPIO=4 is named 'GPIO 7' but I don't know where the bug is.
So, as it did not seem to work with penirq_pin=4, why not try with penirq_pin=7?...
It now reacts! ...a little too much as I can not use the mouse anymore... ('something' resets the 'x' to a default value after a short time (?) (curiously it does not affect the 'y' (?)).

But, with the pen down, I can move the cursor.
So far, X & Y are inverted and I am thus not able to xinput_calibrate...
Image
(the pictures show cursor movements associated with toothpick movements)

I can move the cursor but I do not seem to be able to 'click' (?) but if I move the cursor touching the screen (on false positions), I can click with the mouse and get the expected result (I can event control the cursor with the mouse as long as the pen stays down and does not move).

So, it is not yet OK but it is progressing... (must solve the X-Y swap problem)

[edited] could probably be solved with a good TransformationMatrix in the "inputclass" section of /etc/X11/xorg.conf.d/99-calibration.conf (?) [/edited]

theimmc
Posts: 53
Joined: Tue Feb 05, 2013 10:31 pm

Re: Tontec 2.4-inch TFT LCD

Tue Feb 25, 2014 2:59 pm

Maybe you can flip the screen orientation in mztx06a instead - I've always felt that it is upside down :) Great progress!

xof
Posts: 33
Joined: Thu Aug 29, 2013 10:35 am

Re: Tontec 2.4-inch TFT LCD

Tue Feb 25, 2014 5:24 pm

theimmc wrote:Maybe you can flip the screen orientation in mztx06a instead - I've always felt that it is upside down :) Great progress!
Maybe. (As I have no smartphone, I am not used to portrait screens ;-) )

Anyway, with /etc/X11/xorg.conf.d/99-calibration.conf looking like :

Section "InputClass"
Identifier "calibration"
MatchProduct "TSC2007 Touchscreen"
Option "Calibration" "-23 4052 -175 4138"
Option "TransformationMatrix" "0 -1 1 -1 0 1 0 0 1"
EndSection

I get the cursor moving almost under the stick with a landscape screen ('almost' because I have to redo the 'calibration').

But I am new to touch devices and I don't know how to 'click' (with a 'paint' program, I can move the cursor but the pencil doesn't 'touch' the paper; I can not draw nor click the [Quit] button (which is however highlighted when the cursor passes on it); I still have to use the mouse to click).

I suppose xev can help (?) (http://www.x.org/archive/X11R7.6/doc/ma ... ev.1.xhtml) (I could compare with my Wacom tablet...)
(is it a question of pressure threshold?)

theimmc
Posts: 53
Joined: Tue Feb 05, 2013 10:31 pm

Re: Tontec 2.4-inch TFT LCD

Tue Feb 25, 2014 7:48 pm

xof wrote:But I am new to touch devices and I don't know how to 'click' (with a 'paint' program, I can move the cursor but the pencil doesn't 'touch' the paper; I can not draw nor click the [Quit] button (which is however highlighted when the cursor passes on it); I still have to use the mouse to click).
I've not used touch devices on Linux, but on Windows I lift my finger up and then tap it quickly. Does that work?

theimmc
Posts: 53
Joined: Tue Feb 05, 2013 10:31 pm

Re: Tontec 2.4-inch TFT LCD

Tue Feb 25, 2014 9:54 pm

I should also have noticed that in the schematics, J1 pin 7 is labelled GPIO4_IRQ. It's in the upper left diagram. Moot point now since xof already found this out, but just in case anyone wants to trace other pins...

xof
Posts: 33
Joined: Thu Aug 29, 2013 10:35 am

Re: Tontec 2.4-inch TFT LCD

Fri Feb 28, 2014 3:50 pm

It is almost working but I am still stuck...

dmesg seems correct,
I can find tsc2007 with 'xinput --list', get properties with 'xinput --list-props <id>', get lots of events with 'xev',...
But it still doesn't 'click' (xev state stays 0x0; with a tablet, it becomes 0x100 when touching (?)).
I don't know if it is something in tsc_raspi.c (tsc2007.c seems to be used elsewhere, so I gess it works...) or if something is missing in an X config file... It seems to be a not so rare problem but I did not find the solution yet (Google seems to find 'touchscreen xev state 0x0' or 'touchscreen doesn't click').

Here is a little low res video : http://videobam.com/fJlEg (I don't know the site; the first I found)

The cursor follows the pen and some buttons (Window controls _ = X) get the focus. (resolution is too low and movements are too quick to follow but believe me, it does).

It is also an attempt to power the Raspberry with batteries... ;-)

Note that there is no 5 Volts regulator : voltage must not be much more than 5 Volts if you don't want to fry your Pi (in this case 4*1.2 Volts is OK but the device sucks a little too much current, working Voltage is probably a little low; it doesn't feel very stable).
As I can not click (and the battery is too weak to handle a keyboard and a mouse), I control the Raspberry though the Ethernet link (ssh [email protected]; sudo insmod ...; startx &; export DISPLAY=localhost:0.0; xev)

[edited] By the way, I used the schematics (and the associated post) to find out the IRQ GPIO pin (Thanks a lot) [/edited]
Last edited by xof on Sat Mar 01, 2014 10:57 am, edited 1 time in total.

xof
Posts: 33
Joined: Thu Aug 29, 2013 10:35 am

Re: Tontec 2.4-inch TFT LCD

Sat Mar 01, 2014 10:40 am

http://marks-space.com/2013/09/07/progr ... pberry-pi/

seems promising...

I didn't read it yet, but using evtest (sudo apt-get install evtest), I get things like :
...
Event: time 1393667786.713055, -------------- SYN_REPORT ------------
Event: time 1393667786.721838, type 3 (EV_ABS), code 0 (ABS_X), value 2811
Event: time 1393667786.721838, type 3 (EV_ABS), code 1 (ABS_Y), value 2697
Event: time 1393667786.721838, -------------- SYN_REPORT ------------
Event: time 1393667786.731826, type 3 (EV_ABS), code 0 (ABS_X), value 2791
Event: time 1393667786.731826, type 3 (EV_ABS), code 1 (ABS_Y), value 2676
...
Event: time 1393667792.491831, -------------- SYN_REPORT ------------
Event: time 1393667792.501873, type 3 (EV_ABS), code 0 (ABS_X), value 1605
Event: time 1393667792.501873, -------------- SYN_REPORT ------------
Event: time 1393667792.611843, type 3 (EV_ABS), code 0 (ABS_X), value 2046
Event: time 1393667792.611843, type 3 (EV_ABS), code 1 (ABS_Y), value 2306
Event: time 1393667792.611843, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 674
...

So, the driver and the hardware seems OK.

Summary (so far):
- get a tsc2007.ko module (by building a new kernel (it takes hours - running mztx06a makes things worse - kill -stop/-cont helps); hint : use make xconfig; make; make modules_install; cp./arch/arm/boot/zImage /boot/kernel.img; reboot )
- get and modify tsc_raspi.c to use the second i2c bus ; somehow generate a tsc_raspi.ko module (along tsc2007.ko)
- use tsc_raspi.ko with penirq_pin=7 (modprobe/insmod; it is strange that it is 7 and not 4 but 4 doesn't work, 7 does)
- (use dmesg, xinput --list, xinput --list-props <id>, xev and evtest to check everything is fine)
- use xinput_calibrator to create /etc/X11/xorg.conf.d/99-calibration.conf (I use the mouse to 'click'...)
- add a TransformationMatrix to match touch XY with screen XY

There is just something missing... I can not click.
but I hope the page above will give the solution (?).
(always check the power (5V) first)

theimmc
Posts: 53
Joined: Tue Feb 05, 2013 10:31 pm

Re: Tontec 2.4-inch TFT LCD

Sat Mar 01, 2014 10:49 am

I was also reading up on Adafruit's piTFT tutorial. I will need to reproduce your results first as my environment now does not include X.

xof
Posts: 33
Joined: Thu Aug 29, 2013 10:35 am

Re: Tontec 2.4-inch TFT LCD

Sat Mar 01, 2014 11:11 am

theimmc wrote:I was also reading up on Adafruit's piTFT tutorial. I will need to reproduce your results first as my environment now does not include X.
Note : evtest doesn't require X (I think), it monitors /dev/input
(http://manpages.ubuntu.com/manpages/pre ... est.1.html)
* http://www.linuxjournal.com/article/6396 (Linux Journal - The Linux USB Input Subsystem, Part I)
* http://www.linuxjournal.com/article/6429 (Linux Journal - Using the Input Subsystem, Part II)
* https://www.kernel.org/doc/Documentatio ... /input.txt

stephenmhall
Posts: 1
Joined: Sat Mar 01, 2014 1:59 pm

Re: Tontec 2.4-inch TFT LCD

Sat Mar 01, 2014 2:15 pm

theimmc wrote:I haven't gotten the touchscreen to work (just stumbled onto this thread) but I fixed the CPU utilization on my display.

Essentially, mztx06a loops indefinitely, reading the frame buffer, looking for differences, and updating the LCD through I2C. It does this as quickly as it can, so it takes up all the idle CPU cycles on the Pi.

My workaround is twofold : add a delay loop to limit frame rate to 30 fps max, and change the makefile to turn on optimization.

Makefile change is easy - add -O3. This alone will not solve your CPU problem.

The changes in loadFrameBuffer_diff_320() :

Code: Select all

    while (1) {
+        struct timespec ts1, ts2;
+        long elapsed;

+        clock_gettime(CLOCK_MONOTONIC, &ts1);
        numdiff=0;

.....

            printf ("Read < %d chars when loading file %s\n", hsize*vsize*3, "ss");
+        clock_gettime(CLOCK_MONOTONIC, &ts2);
+        elapsed = ts2.tv_nsec - ts1.tv_nsec;
+        elapsed += (ts2.tv_sec - ts1.tv_sec) * 1000000000;
+        if (elapsed < 33333333) {
+            struct timespec et;
+            et.tv_sec = 0;
+            et. tv_nsec = 33333333 - elapsed;
+            nanosleep(&et, NULL);
+        }
    }
With this change, when screen is static, it only takes up about 15% CPU.
Hi theimmc I am new to C compiling having just dabbled in Python, could you expand your explanation a little, where in the makefile does the O3 go I have

all:
gcc -o mztx06a -l rt mztx06a.c bcm2835.c

init:
gcc -o lcdinit -l rt lcdinit.c bcm2835.c

new:
gcc -o lcdpi -l rt lcdpi.c bcm2835.c

I managed to make the edit to mztx06a.c ok.

theimmc
Posts: 53
Joined: Tue Feb 05, 2013 10:31 pm

Re: Tontec 2.4-inch TFT LCD

Sat Mar 01, 2014 5:03 pm

stephenmhall wrote:Hi theimmc I am new to C compiling having just dabbled in Python, could you expand your explanation a little, where in the makefile does the O3 go I have

all:
gcc -o mztx06a -l rt mztx06a.c bcm2835.c

init:
gcc -o lcdinit -l rt lcdinit.c bcm2835.c

new:
gcc -o lcdpi -l rt lcdpi.c bcm2835.c

I managed to make the edit to mztx06a.c ok.
Sorry, I should have made it a little clearer.

Change the line in the Makefile for mztx06a.c to read as follows :

gcc -o mztx06a -l rt -O3 mztx06a.c bcm2835.c

Return to “Beginners”

Who is online

Users browsing this forum: Baidu [Spider] and 45 guests