1.1.1 Generate Touch Project with MCC Harmony

Objective

The following procedure shows how to create a Touch project with the MCC Harmony platform where touch sensors and their parameters can be graphically added and tuned. The resulting project supports the MPLAB® XC32 compiler in MPLAB®X IDE. This project uses the SAML10 Xplained Pro board along with the T10 Mutual Capacitance Xplained Pro Extension Kit.

Materials

Hardware Tools

Software Tools

MPLAB®X IDE with MCC plugin installed

Procedure

Step 1: Open MPLAB®X IDE

Click and select the File > New Project option in MPLAB®X IDE.

Step 2: Choose Project

Select 32-bit MCC Harmony Project in the Choose Project window and click Next.

Step 3: Content Path Selection

Choose the path where the Harmony content is downloaded and click Next.

Step 4: Project Settings

Enter the location, folder name, and path for the project and click Next.

Step 5: Configuration Settings

Type "SAML10-touch" as the configuration name and choose the device.

Type "L10E16" in the Device Filter box to find the device. Make sure the Target Device is ATSAML10E16 and click Finish.

Step 6: MCC Harmony with Touch Packages

MCC Content Manager Wizard is opened. Select MPLAB® Harmony and wait for the content manager to open.

Once the content type is selected, in Optional Content → Harmony 3 - Capacitive touch solutions, select touch and touch_apps and click Finish.

The touch package will be downloaded to the content path given earlier. Once the download is complete, MCC Harmony window opens with the Project Graph.

Step 7:From the Device Resources tab, select Touch Library.

A pop up window appears asking for PTC and RTC activation. click Yes.

Another pop-up asking for automatic connection activation. Click Yes.

Step 8:Launch Touch Configurator by selecting it from the drop down near Plugins.

Step 9:Choose Technology

The T10 Xplained Pro extension board consists of 4 mutual cap touch buttons and one slider sensor.

Choose Mutual Cap as the sensing technology from the drop down as shown.

Step 10: Add Buttons

Click Button icon and input 4 in the number of buttons.

A pop-up showing the information that clock for CPU and peripherals are set. Click Ok.

Step 11:Add Slider

Click Slider and input 1 in Sliders and 4 in Segments (if not already present)

Now 4 buttons and 4 channel slider sensor are added.

Step 12: Pin Assignment

A generalized pin assignemnt for a majority of the Xplained PROs and MCUs have been provided in a downloadable file titled "Curiosity Nano Touch Adapter Pin Configurattion" the Documentation section in this link as shown in the figure.

If the MCU or the XPRO board is not available then the user can assign the pins based on the datatsheet/userguide of that particular MCU/ XPRO. A snapshot of the pinout for SAML10 and T10 XPRO can be seen from the below figure.

Based on the documentation file, the X and Y lines should be selected as follows.

SensorChannel IDX LineY Line
Button 00143
Button 11153
Button 22163
Button 33173
Slider 04142
5152
6162
7172

The pin assignement can be done in Configure → Sensor Pins. With respect to the above table in touch configurator the pins were selected.

Note: It can be seen that when configuring the pins, we can drag and drop the sensor to modify the X and Y lines. For changing the multiplexed X or Y line the corresponding line should be clicked as shown below.

Parameters

Step 13: Sensor Parameters

For tuning the touch parameters, Config → Sensor Parameters and tune according to the application.

Note: All the parameters are tunable for buttons/Sliders/Wheels.

The Sensor Parameters Tab allows to configure touch sensor parameters such as:

  • Digital Filter Gain
  • Digital Filter Oversampling
  • Analog Gain
  • Series Resistor
  • Addition Charge Share Delay
  • PTC Clock
  • Sensor Detect Threshold
  • Sensor Hysteresis
  • Sensor AKS

Step 14: Common Parameters

For tuning the touch parameters, Config → Common Parameters and tune according to the application.

The Common Parameters Tab allows to configure touch sensor parameters such as:

  • Acquisition
    • Scan Rate
    • PTC Interrupt Priority
    • Acquisition Frequency
  • Sensor
    • Detect Integration
    • Away from Touch Recal Integration count
    • Away from Touch Recal Threshold
    • Touch Drift Rate
    • Away from touch Drit Rate
    • Drift Hold Time
    • Re-burst mode
    • Max ON Duration

Step 15: Frequency Hop

Frequency Hop can be enabled by navigating to ConfigFrequency Hop and then sliding the Enable Frequency Hop button. A maximum of 7 frequency steps can be selected which can be induvidually configured using the drop down. Hop Frequencies are fixed at compile time in Frequency Hop. The auto-tune feature can be enabled by sliding the Enable Frequency Auto Tuning button. A detailed description on how to configure the Frequency Hop and Frequency Hop Autotune is provided in the How to Enable Frequency Hop Auto tune page.

Step 16: Touch Tuning

Enable the datastreamer by selecting the Enable Touch tuning Data connection option. A detailed description on how to configure the datastreamer is provided in the Guide to view Touch Tune Data using MPLAB® Data Visualizer page.

Step 17: Summary

Click on the Summary Tab to review the project configuration and find versions of Library modules.

Step 18: Once the project is configured, click on Project Resources → Generate to generate the code.

Step 19: Include touch_process() to the main while(1) loop. Now the project is ready for testing on the kit.