Helpful ReplyHot!Focaltech FT5316 capacitive touch

Page: 12 > Showing page 1 of 2
Author
jiggoly
Junior Member
  • Total Posts : 97
  • Reward points : 0
  • Joined: 2016/01/19 15:02:48
  • Location: Spain
  • Status: offline
2018/01/25 12:46:28 (permalink)
0

Focaltech FT5316 capacitive touch

Hi, first of all the background:
 
- Custom board with PIC32MZ2064DAG176
- 800x480 WVGA display with FT5316 touch panel attached.
- Touch panel connected to I2C_ID_1 (RA14, RA15).
- INT connected to RD7 (INT4).
 
I´m trying to port the FT5316 using the MTCH6301 driver as reference but now I´m stuck because it doesn´t work. I think everything is integrated into harmony 2.05 to generate all code using MHC. Checked with scope if INT is happening and it´s working but nothing is on the I2C bus.
 
Attached is the driver, beware if you have custom drivers because it overwrites system_definitions.h and sys_touch.c.
The touch panel has been tested using an arduino and works perfect.
 
Best regards. Francisco.
post edited by jiggoly - 2018/01/25 13:41:42

Attached Image(s)

#1
Michael.W.Mann
Super Member
  • Total Posts : 291
  • Reward points : 0
  • Joined: 2011/01/24 09:58:24
  • Location: Chandler, Arizona
  • Status: offline
Re: Focaltech FT5316 capacitive touch 2018/01/26 15:00:17 (permalink) ☄ Helpfulby MikeinAZ 2018/03/13 08:53:23
0
In our experience in helping customers support displays mounting FT5XX6 series we've found that the best way to get it working is to start from the driver of the MTCH6303 (not the MTCH6301) since the request of process is very similar: It requires first a write action to a register then the read message. In MTCH6301 only a read message is sent out.
The other thing to be aware is the data order coming from the chip. Basically once you change the data pointers to the correct data to get the result should be very easy.
 
Comparing the FT53x6 to the MTCH6303:
FT53X6
MTCH6303
 See Attachment One See Attachment Two
 
 
Start out with the MTCH6303 touch driver and modify one routine with a hack enabled by a #define FT_SUPPORT.
The example below is scaled for QVGA (320x230) support, but can be easily modified for other screen sizes.

void _DRV_TOUCH_MTCH6303_BufferQueueTasks(DRV_TOUCH_MTCH6303_STATIC_OBJ * hDriver)
{
    DRV_TOUCH_MTCH6303_BUFFER_OBJ * bufferObj = ( DRV_TOUCH_MTCH6303_BUFFER_OBJ * ) NULL;

    bufferObj = hDriver->queue;

    if( DRV_HANDLE_INVALID != hDriver->drvBusHandle &&
        NULL != bufferObj )
    {
        if( 0 == bufferObj->size )
        {
            hDriver->queue = bufferObj->next;
            bufferObj->inUse = false;
            hDriver->queueSizeCurrent--;
#ifdef FT_SUPPORT
            touch_x=(unsigned int)(hDriver->touchData.touch[0].X_Msb)<<8;
            touch_y=(unsigned int)(hDriver->touchData.touch[0].Y_Msb)<<8;
            
            touch_x=touch_x+(unsigned int)(hDriver->touchData.touch[0].X_Lsb);
            touch_y=touch_y+(unsigned int)(hDriver->touchData.touch[0].Y_Lsb);
            
            if( hDriver->touchData.status.nTouch != 0 &&
                /*hDriver->touchData.touch[0].nibble_0.inRange != 0 &&*/
                /*hDriver->touchData.touch[0].x*/ touch_x != 0 &&
                /*hDriver->touchData.touch[0].y*/touch_y != 0 )
            {
// //Translate the touch data to X/Y coordinates
                hDriver->mostRecentTouchX =touch_x;// (int16_t)DRV_TOUCH_MTCH6303_TouchInputMap(/*hDriver->touchData.touch[0].x*/ touch_x<<4 , 240);
                hDriver->mostRecentTouchY =touch_y;// (int16_t)DRV_TOUCH_MTCH6303_TouchInputMap(/*hDriver->touchData.touch[0].y*/touch_y<<4, 320);
                //Translate the touch data to X/Y coordinates
// hDriver->mostRecentTouchX =touch_y;// (int16_t)DRV_TOUCH_MTCH6303_TouchInputMap(/*hDriver->touchData.touch[0].x*/ touch_x<<4 , 240);
// hDriver->mostRecentTouchY =240-touch_x;// (int16_t)DRV_TOUCH_MTCH6303_TouchInputMap(/*hDriver->touchData.touch[0].y*/touch_y<<4, 320);

            }
            else
            {
                hDriver->mostRecentTouchX = -1;
                hDriver->mostRecentTouchY = -1;
            }
#else
            if( hDriver->touchData.status.nTouch != 0 &&
                hDriver->touchData.touch[0].nibble_0.inRange != 0 &&
                hDriver->touchData.touch[0].x != 0 &&
                hDriver->touchData.touch[0].y != 0 )
            {
                //Translate the touch data to X/Y coordinates
                hDriver->mostRecentTouchX = (int16_t)DRV_TOUCH_MTCH6303_TouchInputMap(hDriver->touchData.touch[0].x, 240);
                hDriver->mostRecentTouchY = (int16_t)DRV_TOUCH_MTCH6303_TouchInputMap(hDriver->touchData.touch[0].y, 320);
            }
            else
            {
                hDriver->mostRecentTouchX = -1;
                hDriver->mostRecentTouchY = -1;
            }
#endif
            hDriver->touchStatus = DRV_TOUCH_POSITION_SINGLE;

            if( NULL != hDriver->queue )
            {
                bufferObj = hDriver->queue;

                switch( bufferObj->flags )
                {
                    case DRV_TOUCH_MTCH6303_BUFFER_OBJ_FLAG_REG_READ:
                    {
                        bufferObj->hBusBuffer =
                                DRV_I2C_BufferAddWriteRead( hDriver->drvBusHandle,
                                                            (uint8_t *)&hDriver->deviceAddress,
                                                            ( void *)&bufferObj->regAddress,
                                                            1,
                                                            ( void * )bufferObj->readBuffer,
                                                            bufferObj->size,
                                                            (void *)NULL );

                        break;
                    }

                    case DRV_TOUCH_MTCH6303_BUFFER_OBJ_FLAG_REG_WRITE:
                    {
                        bufferObj->hBusBuffer =
                                    DRV_I2C_BufferAddWrite( hDriver->drvBusHandle,
                                                            (uint8_t *)&hDriver->deviceAddress,
                                                            (uint8_t *)bufferObj->writeBuffer,
                                                            bufferObj->size,
                                                            (void *) NULL);
                        break;
                    }

                }
            }
        }
    }

    return;
}

 
Michael W. Mann
Principal Applications Engineer
MCU32 Applications

Attached Image(s)


Michael W. Mann
Principal Applications Engineer
MCU32 Applications, Microchip
#2
jiggoly
Junior Member
  • Total Posts : 97
  • Reward points : 0
  • Joined: 2016/01/19 15:02:48
  • Location: Spain
  • Status: offline
Re: Focaltech FT5316 capacitive touch 2018/01/27 00:58:33 (permalink)
0
Thank you so much Michael, gettings hands on it.
 
Best regards.Francisco.
#3
Vargoth
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2018/02/26 17:18:02
  • Location: 0
  • Status: offline
Re: Focaltech FT5316 capacitive touch 2018/03/11 11:16:26 (permalink)
0
Hi Francisco (Jiggoly)!
 
Did you ever get your FT5316 driver working? I will be wanting to start something similar for a FT5306.
 
Thanks!
Patrick
#4
jiggoly
Junior Member
  • Total Posts : 97
  • Reward points : 0
  • Joined: 2016/01/19 15:02:48
  • Location: Spain
  • Status: offline
Re: Focaltech FT5316 capacitive touch 2018/03/12 08:45:50 (permalink)
0
Hi Patrick, I got it working using a hack that Michael W. Mann from microchip posted in another thread. I'm creating a custom driver for all FT5xx6 series that will be posted here (if it works).
#5
Skaptor
Super Member
  • Total Posts : 221
  • Reward points : 0
  • Joined: 2012/07/25 11:18:48
  • Location: Chih, Mex. CUU
  • Status: offline
Re: Focaltech FT5316 capacitive touch 2018/03/12 08:52:42 (permalink)
0
jiggoly
Hi Patrick, I got it working using a hack that Michael W. Mann from microchip posted in another thread. I'm creating a custom driver for all FT5xx6 series that will be posted here (if it works).



It would be so nice if you shared that code!

Try adding more delay, see if it fixes it
#6
Michael.W.Mann
Super Member
  • Total Posts : 291
  • Reward points : 0
  • Joined: 2011/01/24 09:58:24
  • Location: Chandler, Arizona
  • Status: offline
Re: Focaltech FT5316 capacitive touch 2018/03/12 09:31:25 (permalink) ☄ Helpfulby MikeinAZ 2018/03/13 08:53:36
5 (1)
I've come up with a tutorial that covers how to add a Mikroe display to an EF starter kit using some adapter boards.  The Mikroe display uses a SSD1963 graphics controller and a Focal Tech FT5x06 capacitive touch controller.
Attached are two files:
1) CreatingAGraphicsAppWithA3rdPartyDisplay.zip - tutorial documentation
2) 3rd_party_display.zip - resulting project , should be installed in ./apps/examples.

Michael W. Mann
Principal Applications Engineer
MCU32 Applications, Microchip
#7
Michael.W.Mann
Super Member
  • Total Posts : 291
  • Reward points : 0
  • Joined: 2011/01/24 09:58:24
  • Location: Chandler, Arizona
  • Status: offline
Re: Focaltech FT5316 capacitive touch 2018/03/12 09:37:48 (permalink)
0
The attachments in the prior post are bad.  I'll provide the files in a separate post.
 

Michael W. Mann
Principal Applications Engineer
MCU32 Applications, Microchip
#8
Jim Nickerson
User 452 _
  • Total Posts : 4841
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: online
Re: Focaltech FT5316 capacitive touch 2018/03/12 09:42:18 (permalink)
0
Michael,
I seem to be having some problems extracting the tutorial documentation zip on my windows 10 machine
Edit: and so you noted.
#9
Michael.W.Mann
Super Member
  • Total Posts : 291
  • Reward points : 0
  • Joined: 2011/01/24 09:58:24
  • Location: Chandler, Arizona
  • Status: offline
Re: Focaltech FT5316 capacitive touch 2018/03/12 09:49:15 (permalink)
5 (1)
Here are two links using TransferBigFiles:
3rd_party_display.zip: https://www.transferbigfiles.com/12fca2da-6ae1-4c8c-a8dc-e6aa3b49b433/SdzujdbxF8F5A20puZ6HMw2
CreatingAGraphicsAppWithA3rdPartyDisplay: https://www.transferbigfiles.com/f958b2fa-3df5-4e55-9a4e-b3cfb3e8f15a/fZwn-DGp8GRo7GREiWtEmw2
 
These links will work through 6/1/2018.  After that I will provide additional instructions on how to get these files.

Michael W. Mann
Principal Applications Engineer
MCU32 Applications, Microchip
#10
Jim Nickerson
User 452 _
  • Total Posts : 4841
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: online
Re: Focaltech FT5316 capacitive touch 2018/03/12 09:57:22 (permalink)
0
Thank you Michael
These files extract fine
#11
Skaptor
Super Member
  • Total Posts : 221
  • Reward points : 0
  • Joined: 2012/07/25 11:18:48
  • Location: Chih, Mex. CUU
  • Status: offline
Re: Focaltech FT5316 capacitive touch 2018/03/12 10:03:25 (permalink)
0
Thanks Michael,
 
BTW why does the driver need a bitbanged I2C?

Try adding more delay, see if it fixes it
#12
Michael.W.Mann
Super Member
  • Total Posts : 291
  • Reward points : 0
  • Joined: 2011/01/24 09:58:24
  • Location: Chandler, Arizona
  • Status: offline
Re: Focaltech FT5316 capacitive touch 2018/03/12 10:04:52 (permalink)
0
One additional warning.  The example project will build and run, but it probably won't run under the MHC in Harmony 2.05.01, since it was built under a prototype for Harmony 2.06.  Attempting to reconfigure it will probably not work.  

Michael W. Mann
Principal Applications Engineer
MCU32 Applications, Microchip
#13
Michael.W.Mann
Super Member
  • Total Posts : 291
  • Reward points : 0
  • Joined: 2011/01/24 09:58:24
  • Location: Chandler, Arizona
  • Status: offline
Re: Focaltech FT5316 capacitive touch 2018/03/12 10:05:42 (permalink)
0
We use a bit-banged I2C driver to be compatible with all versions of the EF starter kit.

Michael W. Mann
Principal Applications Engineer
MCU32 Applications, Microchip
#14
jiggoly
Junior Member
  • Total Posts : 97
  • Reward points : 0
  • Joined: 2016/01/19 15:02:48
  • Location: Spain
  • Status: offline
Re: Focaltech FT5316 capacitive touch 2018/03/13 03:15:58 (permalink) ☄ Helpfulby obberer 2018/03/21 22:16:22
5 (1)
Well, using the code Michael provided I created a standalone FT5XX6 driver. Attached are the files that adds the driver to the MHC tree config under touch section. Just config the parameters and ready to go.
Unzip folders and overwrite to /harmony/v2_05_01
 
Best regards.
Francisco.
#15
Skaptor
Super Member
  • Total Posts : 221
  • Reward points : 0
  • Joined: 2012/07/25 11:18:48
  • Location: Chih, Mex. CUU
  • Status: offline
Re: Focaltech FT5316 capacitive touch 2018/03/13 08:54:54 (permalink)
0
Hi,
 
I haven't had an in depth look at the code but I am missing the DRV_TOUCH_FT5XX6_TOUCH_BUFFER_EVENT_HANDLER definition. So it does not compile
 
 

Try adding more delay, see if it fixes it
#16
Jim Nickerson
User 452 _
  • Total Posts : 4841
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: online
Re: Focaltech FT5316 capacitive touch 2018/03/13 08:57:27 (permalink)
0
maybe Michael's comments in post 13 are relevant 
#17
Skaptor
Super Member
  • Total Posts : 221
  • Reward points : 0
  • Joined: 2012/07/25 11:18:48
  • Location: Chih, Mex. CUU
  • Status: offline
Re: Focaltech FT5316 capacitive touch 2018/03/13 09:17:22 (permalink)
0
I meant jiggoly's code, but maybe I'll take a look at it later today wink: wink

Try adding more delay, see if it fixes it
#18
obberer
Starting Member
  • Total Posts : 24
  • Reward points : 0
  • Joined: 2012/09/04 10:19:26
  • Location: 0
  • Status: offline
Re: Focaltech FT5316 capacitive touch 2018/03/21 22:17:27 (permalink)
0
I owe you a carton of beer. Big thanks!
post edited by obberer - 2018/03/21 22:18:30
#19
jiggoly
Junior Member
  • Total Posts : 97
  • Reward points : 0
  • Joined: 2016/01/19 15:02:48
  • Location: Spain
  • Status: offline
Re: Focaltech FT5316 capacitive touch 2018/03/22 09:03:21 (permalink)
0
I owe you a carton of beer. Big thanks!

 
Great!!  grin: grin
 
I hope it works for you. Checked it with Harmony 2.05 and 2.05.01.
#20
Page: 12 > Showing page 1 of 2
Jump to:
© 2018 APG vNext Commercial Version 4.5