MZTX-PI-EXT



The MZTX-PI-EXT board (also known as Tontec) is an add-on board with a 2.4 inch 240x320 tft color touchscreen with extention hooks.

==Display == A user process (mztx06a) watches changes in the frame buffer and sends them through the SPI bus to the screen. The refresh rate is not intended to display video but is correct for classical GUI. The source code is available on Github with some forks and in various archive files. The version described in the blog works; it seems that the original Github is different and does not work. The original version spent a lot of time in the while(1) loop of loadFrameBuffer_diff_320; theimmc proposed the introduction of µsleeps in the loop. Other optimisations are possible.

Touch
The 'touch' part is handled by a TSC2003 chip on the I2C bus and uses the J1-Pin7 (GPIO-04) for the /PenIRQ signal. Two kernel modules are required : tsc2007.ko (compatible TSC2003) and (a modified) tsc_raspi.ko. Pull-up can be setup with WiringPi's gpio(1) command.

Two/three changes are needed to the original tsc_raspi.c :
 * i2c_get_adapter(1); /* '1' in place of '0' : the I2C bus on the J1 connector is the second one */
 * gpio_request_one(tsc2007_penirq_pin, GPIOF_IN, "PENIRQ"); /* without '| GPIOF_OUT_INIT_HIGH'; the pin is 'IN' with a pull-up */
 * tsc2007_penirq_pin = 4; /* J1-Pin7 is GPIO-04; this can also be specified while insmod'ing */

To enable the driver,
 * $ sudo insmod tsc_raspi penirq_pin=4
 * $ sudo gpio mode 7 up

Tests, Calibration and orientation
To test the touchscreen, commands like  (tests the Linux input driver mechanism) and   (test the touchscreen in the 'X' environment) are usefull. could be used to calibrate the touchscreen but the result does not seem correct when used with an  option in. Mine looks like Section "InputClass" Identifier     "calibration" MatchProduct   "TSC2007 Touchscreen" Option "Calibration"   "0 4000 0 4000" Option "TransformationMatrix" "0 -1 1 -1 0 1 0 0 1" EndSection The 'handmade' quick and dirty 'calibration' is not perfect but usable in the center of the screen (xinput-calibrator makes things worse; I'll have to make it by hand, checking left/righ top/bottom and deduce some linear combination. The 'TransformationMattrix' is for the original mztx06 code (like a 'TV set' with the connectors below and on the left).

Simple GUI
The simplest way (on Raspbian) to get some interaction is to launch a tcl/tk script at startup by adding a line to. Something like : with menu.tcl being a simple applet with a couple of buttons to launch some simple shell scripts : The shell scripts contain lines like ' '/home/pi/bin/dump1090 > dump1090.`/usr/local/bin/now`' (now is 'date "+%g%m%d.%H%M%S"' to give a time stamped suffix to the file); 'pkill dump1090' and 'sudo shutdown -h now'.

Extensions
The board uses the J1 'GPIO' connector but offers header pins for extensions :
 * An alternate power 5 volts connector (unprotected like the Pi's micro-USB one : 5 volts no more - no less )
 * UART (from J1)
 * SPI bus (from J1)
 * I2C bus (from J1)
 * LP3943, '16-LED Fun Light Driver'