Touch Host Driver

Last modified by Microchip on 2023/11/09 09:09

Getting Started with the Touch Host Driver

Create a New 32-bit MCC Harmony Project

Screenshot of the New Project Wizard in MPLAB X

Upon clicking the Finish button of the New Project Wizard, the MCC Content Manager will open along with the newly created project.  

Refer to the "Create a New MPLAB® Harmony v3 Project" page for more details on how to create your project.

Back to Top


Add the Touch Host Driver to the MCC content

From the Content Manager, click the Select MPLAB Harmony button.

Screenshot of the MCC Content Manager window in MPLAB X with MPLAB Harmony button highlighted

Select Touch Host Driver from the optional content and click Finish.

Screenshot of the Contact Manager wizard with 'Touch Host Driver' content selected

This will close the Content Manager and open the MCC Resource Management and Project Graph windows.

 

Back to Top


Add the Touch Host Driver to the project

In the Device Resources pane of the Resource Management tab, expand the Touch Turnkey library to find the Touch Host Interface component.

Screenshot of Touch Turnkey Library in Device Resources

Click on the Add button (green square with white cross) next to Touch Host Interface to add it to the Project Graph. The configuration options are shown in the right-hand pane.

Screen shot of Touch Host Interface component in the Project Graph

Back to Top


Choose a Turnkey device

Select the turnkey device from the supported list of devices. AT42QT2120 is selected in this example.

Screenshot of selecting AT42QT2120 as the 'Turnkey Device' in the Touch Host Interface Configuration Options tab

Back to Top


Add the SERCOM module

I2C is the only interface for the host driver and the selected AT42QT2120 turnkey device. Serial Peripheral Interface (SPI) is supported for AT42QT1110. Choose a satisfying Serial Communication (SERCOM) and select the corresponding pins from the PIN configurator.

Screenshot of SERCOM2 added for I2C port of Touch Host Interface

Screenshot showing how to open the pin manager from the menu bar: Window>MPLAB Code Configurator v5>Harmony>Pin Configuration.

Back to Top


Add Tuning Option

Check Enable Tuning option and select a SERCOM for Universal Asynchronous Receiver Transmitter (UART) and choose the corresponding pins from the pin manager.

Enabling Tuning and adding SERCOM1 for the tuning UART interface

Back to Top


Generate the files

Click on the Generate button to start generating the MCC files for the project.

Screenshot showing Generate button and MMC generating files

Back to Top


Add code and compile

Add code (touchDeviceProcess() and touchTuneProcess()) to main.c. Refer to host_example.c file for reference and compile the project.

Screenshot showing touchDeviceProcess() and touchTuneProcess() added to main.c

Back to Top


How to Connect to Data Visualizer

Flash the project and open Data Visualizer.

Screenshot of Data Visualizer

Back to Top


Select the COM port, set the Baud rate and click Connect.

Selecting the COM port in the 'Serial Port Control Panel' of Data Visualizer

Back to Top


When data starts streaming, under Touch Session, choose the same COM port and click Connect.

Connecting the touch session in Data Visualizer

Back to Top


See the streaming data in the Touch window.

View the streaming data in the touch window of Data Visualizer

Back to Top


Error codes are shown in the General Status window. Go to common and individual parameters to tune them accordingly.

View the error codes in the General Status pane of the touch window

Back to Top