Generate User Board Touch Project

Last modified by Microchip on 2023/11/10 11:19

Objective

The following lab shows you how to create a QTouch® project in Atmel START where you can graphically add sensors and configure QTouch parameters. The resulting project supports GCC and IAR compilers. This project is generated to use ATmega324PB Xplained Pro along with QT5 Xplained Pro Extension Kit.

Reference Materials

Note: Atmel Studio is now Microchip Studio for AVR® and SAM devices.

Procedure

Open Atmel Start

Go to Microchip's Atmel START page and select the CREATE NEW PROJECT option.

Screenshot of the start.atmel.com site with Create New Project Button highlighted

Select Device and Create New Project

Start typing "atmega324pb" in the Filter on device box. Select ATmega324PB-MN then click on CREATE NEW PROJECT.

Screenshot of ATMEGA324PB-MN device being selected in the Create New Project window

Add Software Components

After project creation, the project dashboard will open as follows. Click Add software component to add the QTouch Library.

Screenshot of the Project Dashboard with "Add Software Components" Button highlighted

You can type "touch" in the Filter box to be able to find the library faster. Add the QTouch Library by clicking the + icon and then clicking on Add component(s).

Screenshot of selecting QTouch Library in "Add Software Components" window

QTouch Library Middleware will be added to the project.

Screenshot of Project Dashboard showing QTouch Library added

Add Sensors

The QT5 Xplained Pro has two mutual capacitance buttons and one mutual capacitance slider that will be added to the project, but to do so you must first open the QTouch Configurator.

Open the Configurator

  • First, in the Project Dashboard, click on the QTouch Library button under My Project which will open the Library setup panel.
  • Next, in the QTouch Library panel, click on Open QTouch Configurator to open the Configurator GUI.

Screenshot of the Project Dashboard with QTouch Library open and Open QTouch Configurator button highlighted

Adding Button

  • Select the QTouch tab and then click on the Button drop-down menu.
  • Select Mutualcap as the Technology and 2 as the Number of buttons.
  • Click Add button.

Screenshot of Configurator while adding two buttons

After adding the sensors (buttons/slider/wheel) for the first time, a warning pops up asking you to enter the CPU and peripheral (PTC, Timer, UART) default clock settings. For some of the devices, like the ATmega324PB, the QTouch clock settings are loaded by default and this warning pop-up does not appear.

  • Click Yes to load the QTouch default settings for the CPU and peripheral clocks.
  • Click No to configure the CPU and peripheral clocks manually.

Clock warning pop-up


 

Adding Slider

  • Click on the Slider drop-down menu.
  • Select Mutualcap as the Technology and 1 as the Number of sliders.
  • Enter the Number of Channels per slider.
  • Click Add button.

Configurator view of adding slider to project

Check Slider Button Count

The slider in QT5 is composed of four buttons.

  • Select the Slider and click on Settings gear icon and ensure that Number of Buttons is and if not, change it to 4 and click Apply.

Setting the number of buttons in the slider settings popup

Pin Assignment and Touch Data Debug Interface

Refer to the following ATmega324PB Xplained Pro EXT1 header and QT5 Xplained Pro documents for connection details.

Based on the design files, the X and Y lines should be selected as follows.

The required pin assignments for the project

Touch Pin Assignment

Select the Pins tab and select the correct X and Y lines for buttons and slider.

  • Drag and drop the channels to the required combination of X and Y.
  • Click on the channel displayed as X(Y) or Y(X) to toggle X to Y or Y to X.
  • The Matrix View is only provided in case of mutual cap in order to quickly drag and drop the sensors and configure the pins.

Pin selection tab in Matrix view mode

Click on Matrix View to switch to Table View and assign the X, Y pins from the drop-down list for each sensor. Click on Table View to switch back to Matrix View.

Pin selection tab in Table view mode

Driven Shield Pin Assignment
Click on the Driven Shield tab to configure the driven shield pin.

  • It is enabled for the supported devices.

This feature is not supported for ATmega324PB device.

The driven shield tab of Pins setup page, driven shield disabled for unsupported devices

For supported devices, the driven shield can be enabled and the driven shield pin can be selected from the drop-down list when dedicated shield pin is enabled.

The driven shield tab of Pins setup page, enabled for supported devices

Touch Data Debug Interface

Click on the Debug tab to configure the Data Streamer (UART) pins, which can be configured as shown in the accompanying image. Enable Data Streamer and modify the UART pins as shown.

Debug Interface tab of Pins setup page

Basic Parameters

 Select the Parameters tab.

Channel

The 'Channel' tab allows you to configure touch channel properties such as Oversamples (filter level), Digital Gain, Analog Gain, Series Resistor, CSD (additional cycles), Prescaler, Threshold, Hysteresis, and AKS_GROUP (adjacent key suppression).

The Channel tab of Parameters setup page

Sensor

Click on the Sensor tab to configure sensor parameters such as Detect Integration, Away from Touch Recal Count, Away from Touch Recalibration Threshold, Touch Drift Rate, Away from Touch Drift Rate, Drift Hold Time, Re-burst mode, Max on Duration, Scan Rate and Acquisition Frequency.

The Sensor tab of Parameters setup page
  

Scroll Down the sensor page to configure Noise Handling. Frequency Hop can be enabled by selecting the Enable Frequency Hop checkbox. You can select up to seven Frequency Steps and then configure the Hop Frequencies from the drop-down list. Hop Frequencies are fixed at compile time in Frequency Hop.
  

The auto-tune feature can be enabled by selecting the Enable Frequency Auto Tuning checkbox. Hop Frequencies are tuned by the library at runtime as per the Auto Tune Parameters thresholds configured during noisy conditions.

Frequency Hop Auto Tuning setup on the Sensors tab

Sliders

Click on the 'Sliders' tab to configure slider parameters such as Resolution, Dead Band, Position Hysteresis and Detect Threshold as shown below.

The Sliders setup tab on the Parameters page

The Sliders tab will be displayed as Sliders and Wheels if both sliders and wheels are configured, whereas it is displayed as Wheels when Wheels only are configured.

Notifications

Click on the Notifications tab to check if there are any warnings or guidelines from START.

The Notification tab, check for warning or error messages from START

Summary

Click on the Summary tab to review the project configuration and download the summary.

The Summary tab, to review the setup and download the summary documentation

Export

After completing the configuration, click the EXPORT PROJECT option.

After completion of configuration click on "Export Project" in the top toolbar

Microchip Studio is enabled by default. Select IAR Embedded Workbench if required for the project, enter the file name and click Download Package.

 

Results

Once you have finished configuring your project and are ready to export, you can either export to IAR or to Microchip Studio to start writing your application code.