How to do the driver adaptation for a capacitive touch display with I2C interface on Colibri IMX6DL

We are working with an IMX6DL Colibri with WEC7, mounted on a Colibri Evaluation Board v3.2, and need to connect a 5" capacitive touch display with an I2C controller (GSL1680).
In this link http://developer.toradex.com/knowledge-base/supported-displays we saw that it is supported but that it requires an adaptation of the driver and connect it through the Generic RGB Display Adapter Board.
My question is What do I need to do the driver adaptation? And is there a tutorial to do this?

Hi @RamonM,
Please go through below articles for driver adaption.
http://developer.toradex.com/knowledge-base/capacitive-multi-touch-solution
http://developer.toradex.com/knowledge-base/capacitive-multi-touch-solution-source-code

Please let us know if you need any assistance.

Hi @raja.tx We are working on the drive adaption for the mentioned display. I have already reviewed the above information, but I have some questions about the source code, I understand that the IDE or toolchain is VS 2008 with the TORADEX SDK Windows CE.
In the webpage come codes for 4 different display, we are taking the one that is for the FUSION, My question is: once we download the code and compile it as it is in VS2008 does an .exe, a dll or an .obj file come up? And what is done with this generated file?

The Fusion application will generate a .exe file, which should be kept in AutoRun folder to run automatically after device boots. Prior to that Unified Multi touch driver should be installed. The Fusion application would interact with touch hardware and get touch coordinate points and it will pass to the Unified touch driver. Unified touch driver will pass these coordinates to GWES as touch inputs.

Please let us know if you need any help on this.

Hi @raja.tx I have a question, does the source code allow debugging directly from VS2008 or is the information only available through the messages sent by the application?

We are developing the driver adaptation, but we want to visualize the sequence of the .exe, from the initialization of the chip to how it sends the data packets, this to detect possible errors

You can debug the application using Actiev Sync or Ethernet. Please refer here for more information

Hi @raja.tx We made a first adaptation of the code to work with our touch controller. We do the debugging with VS2008 and we get an error in writing, we believe that the error is in how we implement the I2C communication, we do not really know the part of how the data should be sent or the structure of the buffer.
Do you have any Documentation that you can provide us about this? It could also be that we are doing wrong the calls of the functions.

Regards

Hi @RamonM,

  1. Did you check I2C Communication with touch controller works?

  2. Please focus on vGetControllerData function. The bReadInRegister(DATA_INFO_REG,TOUCHREGBLK_SIZE) function call reads touch controller data and updating mapped region on the application code.

  3. Please fill below parameters as per touch controlelr register placement.
    psI2CDat->u8NuFinger = ucNUMBER_OF_FINGERS(); // Number of Fingers

    psI2CDat->u16Px1 = uiTP0_Y0_POSITION(); // originaly, x and y are changed (no idea why)
    psI2CDat->u16Py1 = uiTP0_X0_POSITION();

    psI2CDat->bTipSwitch1 = bTEST_TP0_TIP_SWITCH(); // Tip Switch (TRUE = finger on touch)
    psI2CDat->u8TouchID1 = ucTP0_TOUCH_ID(); // Touch ID

    psI2CDat->u16Px2 = uiTP1_Y1_POSITION(); // originaly, x and y are changed (no idea why)
    psI2CDat->u16Py2 = uiTP1_X1_POSITION();

    psI2CDat->bTipSwitch2 = bTEST_TP1_TIP_SWITCH(); // Tip Switch
    psI2CDat->u8TouchID2 = ucTP1_TOUCH_ID(); // Touch ID

  4. Rest of the code would be common to fill the PTCHINPUT structure and pass to the UnfdMultiTchDrv driver.

Hello, Raja

My name is Luis, I am working with Ramon on the GSL1680 driver for Colibri iMX6 WEC7.

We already have the I2C interface to the touch controller working, we can see how many fingers are touching and the coordinates of the touch.

We also think we are filling the TCHINPUT data structure correctly, however we don´t see any changes on the screen.

We would expect to see the mouse move or something, but nothing happens and everything seems to be correctly setup.

We have an idea, we want to try a dummy driver with your UnfdMultiTchDrv driver, just so to know what output to expect from it.

We tried the following test code, but we also see no changes on the screen. We expected to see the mouse move to all four corners and then to the center.

If you help us get something that simple working, we will take care of the touch controller implementation, that is, we only need to see how does your unified driver handles input.

Thank you.

This is the sample code :

#ifdef TEST
struct touch {
	unsigned int	x;
	unsigned int	y;
};

const struct touch	TOUCHES[] = {
	{5,		5},
	{5,		394},
	{794,	5},
	{794,	394},
	{400,	200}
};
#endif

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
	HANDLE			hDS;
	CETCHINP_IOCTL	CeTchInp;
	DWORD			bytes		= 0;

	// Get a handle to the driver, which causes the driver's XXX_Open function to be called
	hDS = CreateFile(TEXT("TCH1:"), GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0);
	if (hDS == INVALID_HANDLE_VALUE) {
		RETAILMSG(TRUE, (TEXT("Touch controller -> Unified Touch Driver not found!\r\n")));
		RETAILMSG(TRUE, (TEXT("Touch controller -> Aborted!\r\n")));

		return -1;
	}

	RETAILMSG(TRUE, (TEXT("Touch controller -> Loading...\r\n")));

#ifdef TEST
	RETAILMSG(TRUE,(TEXT("Touch controller -> Initialized\r\n")));

	while (1 == 1) {
		int	len	= sizeof(TOUCHES)/sizeof(TOUCHES[0]);
		int i	= 0;

		for (i = 0; i < len; i++) {
			CeTchInp.TchInp[0].dwID	= 1;
			CeTchInp.TchInp[0].x	= TOUCHES[i].x;
			CeTchInp.TchInp[0].y	= TOUCHES[i].y;
			CeTchInp.iCnt			= 1;

			DeviceIoControl(hDS, IOCTL_SET_TOUCH_EVENT, &CeTchInp, sizeof(CeTchInp), NULL, 0, &bytes, NULL );

			Sleep(2000);
		}
	}
#else
	if (!i2c_init()) {
		RETAILMSG(TRUE, (TEXT("Touch controller -> Aborted!\r\n")));

		return -1;
	}

	gsl1680_init();

	RETAILMSG(TRUE,(TEXT("Touch controller -> Initialized\r\n")));

	while (1 == 1) {
		gsl1680_irq();

		if (gsl1680_touch(&CeTchInp.TchInp[0], &CeTchInp.iCnt))
			DeviceIoControl(hDS, IOCTL_SET_TOUCH_EVENT, &CeTchInp, sizeof(CeTchInp), NULL, 0, &bytes, NULL );
	}
#endif

Hi @luiso

Could you please try sample code and let me know touch emulation works.

Following registry must set as per your number of touch inputs
[HKEY_LOCAL_MACHINE\Drivers\Touch]
“MaxTouchPoints”=dword:00000002

You must do the Calibration(Start->Settings->ControlPanel->Stylus) for an actual touch device to work properly.

Hi @raja.tx

We tried the sample code, the effect we see on the screen is the equivalent of pressing the cursor, drag it and release it, so we need to include in our project the flags that indicate the type of touch event and test it.

We also want to ask you about the mapping of the coordinates. In the description of the source code it´s indicated that the coordinates of the touch point must be sent in in 4ths of a pixel.

In the same sample code, we test by varying the values of x and y considering this condition of 4ths of a pixel, and the positions of the cursor movements did not correspond to the set values.

Could you tell us how to convert the values delivered by the touch controller to the values that should be sent to the Unified Multi-Touch Driver?

Hi @RamonM,

If you are passing correct flags and actual touch controller returned values then you must do one-time touch calibration(run start->Settings->ControlPanel->Stylus using a mouse and calibrate it using touch hardware). Please save registry and reboot. After that touch would work properly.

We can manually calculate touch calibrate points based on touch resolution and orientation it is placed on the display. Could you please share that, let me manually calculate it and share with you.

Hi @raja.tx, thank you

The resolution of the screen is 800x480 pixels, and placed horizontally

Hi @RamonM,

Please import this registry using RegEdit tool and Save Registry and then Reboot.
You can verify the touch resolution using this feature as well.

How to do calculate manual calibration points:

Whenever we do the calibration, the Crossline will be drawn on the display on following positions (x1,y1), (x2,y2), (x3,y3), (x4,y4) and (x5,y5) as shown in above picture to take calibration parameters. We should touch on that crossline and the returning calibration points will be stored in CalibrationData registry. These values will be used to map the uncalibrated touch points to calibrated touch points. Please see below for cross line position calculation and corresponding touch mapping values.

DivFactX = TouchWidth/10;
DivFactY = TouchHeight/10;
(X1,y1) = (DivFactX5, DivFactY5) = (750,450)
(x2,y2) = (DivFactX2, DivFactY2) = (300,180)
(x3,y3) = (DivFactX2, DivFactY8) = (300,720)
(x4,y4) = (DivFactX8, DivFactY8) = (1200,720)
(x5,y5) = (DivFactX8, DivFactY2) = (1200,180)

So, resultant touch calibration woule be [HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\TOUCH]
“CalibrationData”=“750,450,300,180,300,720,1200,720,1200,180”

Hi @raja.tx

We already have the implementation of the flags working. We send the data packet to the “Unified Multi-Touch Driver” and watch the cursor move. We tested with the app “Ce7TouchDemo” and noticed that the touches are not so accurate. We are trying to perform the calibration, we define the data calibration as you told us, but in the calibration screen we touch the center point and nothing happens, in the messages of debug we see the coordinates of the touch.

Could you help us with this?

Hi @raja.tx

We were testing all day with the application “Ce7TouchDemo”. We can already differentiate between “select”, “double-select” “Hold” and “Pan”.
The touch functions work correctly, we just need to solve the calibration issue.

What we do is access to “run start-> Settings-> ControlPanel-> Stylus” and when touching the first point the mark does not move, this is the log where touch coordinates are seen. I attach a text: “log1.txt” where you see the coordinates of the touches on the center of the screen.

We realized that if you make a small shift on the mark this moves to the next point, in the log already appears the “move” flag. I attach the text: “log2.txt” where you see these coordinates
By doing this you can complete the calibration process, but for obvious reasons the accuracy of the touches is not correct.

Do you have any idea how we can solve this?

We already verified the data calibration with the equations that you provided us.

link text

Hi @RamonM,

The touch points seem to be correct. Could you please share your latest code and Touch controller data sheet. Let me look through it and get some details.

Hi @raja.tx thanks for your help

I attached the datasheet of the touch controller, it is a GSL1680 from Silead.
Where can we send you the code?
link text

There is no information in the datasheet about touch down and up flags.
You can share the code through https://share.toradex.com/ or
support@toradex.com.