27
APPLICATION NOTE Atmel AVR3007: QTouch Composer with QT600- ATmega324 Training Guide Atmel QMatrix Features Knowledge level: Intermediate PC platform: Windows ® 2000, Windows XP, Windows Vista ® , Win7 Hardware requirements: Atmel ® QT™600 (entire kit) Software requirements: Atmel Studio 6.0.1843 or later QTouch ® Composer extension 5.0.407 or later for Atmel Studio 6 QTouch Library extension 5.0.1082 or later for Atmel Studio 6 Estimated time to complete all tasks in this guide: 4 hours 42044AAVR10/2012

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

APPLICATION NOTE

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide

Atmel QMatrix

Features

• Knowledge level: Intermediate

• PC platform: Windows® 2000, Windows XP, Windows Vista®, Win7

• Hardware requirements: • Atmel® QT™600 (entire kit)

• Software requirements: • Atmel Studio 6.0.1843 or later • QTouch® Composer extension 5.0.407 or later for Atmel Studio 6 • QTouch Library extension 5.0.1082 or later for Atmel Studio 6

• Estimated time to complete all tasks in this guide: 4 hours

42044A−AVR−10/2012

Page 2: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

2

Table of Contents

1.  Introduction .......................................................................................... 3 1.1  Atmel Studio 6 – debugger and programmer .................................................... 3 1.2  QTouch Composer ............................................................................................ 3 1.3  QTouch Library ................................................................................................. 3 1.4  QT600 – Touch Hardware Kit and Example Code ............................................ 3 

2.  Requirements ....................................................................................... 4 2.1  Software ............................................................................................................ 4 2.2  QT600 system ................................................................................................... 4 2.3  Block diagram ................................................................................................... 5 

2.3.2  Schematics ......................................................................................... 5 

3.  Assignment .......................................................................................... 6 3.1  Task1: Connect the Tools and Run a Test Application ..................................... 6 

3.1.1  Introduction ......................................................................................... 6 3.1.2  Programming Output File using Atmel Studio 6 .................................. 6 

3.2  Task2: Set up a new project ............................................................................ 12 3.2.1  Introduction ....................................................................................... 12 3.2.2  Setting up the project ........................................................................ 12 3.2.3  Further Explanation .......................................................................... 21 

3.3  Task 3: Analysis mode .................................................................................... 23 3.3.1  Introduction ....................................................................................... 23 3.3.2  Configuring the kit/sensors ............................................................... 23 

3.4  Logging the Data ............................................................................................. 25 

4.  Summary ............................................................................................ 25 

5.  Atmel Technical Support center ......................................................... 25 

6.  Revision History ................................................................................. 26 

Page 3: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

3

1. Introduction The purpose of this document is to get familiar with the Atmel QTouch Composer for developing touch projects. QTouch Composer is an extension of Atmel Studio 6. Atmel QTouch Suite includes the following core solutions: Atmel Studio 6, Atmel QTouch Composer, Atmel QTouch Library, and Atmel QT600 Development Kit. The hands-on training is split into four assignments. Each assignment is further divided into individual sections to simplify understanding.

1.1 Atmel Studio 6 – debugger and programmer Atmel Studio 6 is a professional Integrated Development Environment (IDE) for writing, simulating and debugging applications for AVR® and SAM microcontrollers. It also comprises the programming interface of all AVR and SAM tools.

Additional features:

• Supports all 8-bit and 32-bit Atmel AVR MCUs

• Supports SAM MCUs (No simulation) (the Atmel ARM®-based microcontrollers)

• Integrated QTouch Analyzer

• Integrated C Compiler

• New Project Wizard and Intelligent Editor

• ASF support

1.2 QTouch Composer QTouch Composer is an extension integrated into Atmel Studio 6 – which enables user to create touch projects with just a few clicks. QTouch Composer creates the project and adds necessary files based on the inputs provided through the wizard.

1.3 QTouch Library QTouch Library is a software library for developing touch applications on standard Atmel AVR and SAM microcontrollers. QTouch Composer adds the appropriate QTouch Library.

1.4 QT600 – Touch Hardware Kit and Example Code The QT600 is a complete touch development kit for buttons, sliders, and wheels. This advanced development platform allows designers to experiment with Atmel Touch technology, and provides the easiest way to analyze and validate touch products. It supports both Atmel QTouch and QMatrix acquisition methods. It comes with one USB-powered interface board, four MCU boards representing the Atmel tinyAVR®, megaAVR®, AVR XMEGA®, UC3L families of microcontroller, and three touch sensor boards which support 8, 16 and 64 channels.

The Atmel QT600 MCU boards can be connected to the Atmel STK®600 for easy access to unused IO pins. STK600, however, is not needed for the QT600 kit to function properly. QT600 is fully supported by Atmel Studio 6, AVR QTouch Studio, and Atmel QTouch Library.

This hands-on training consists of the following tasks: 1. Connect everything and ensure that your hardware is working properly. 2. Set up a touch project from scratch, by configuring sensors, configuring virtual kit and assigning ports using

QTouch Composer. 3. Use the QTouch Analyzer and review brief description of various parameters. 4. Use the QTouch Analyzer to log the data.

Page 4: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

4

2. Requirements

2.1 Software Make sure the latest version of the following are installed

• Atmel Studio 6

• QTouch Composer extension for Atmel Studio 6

• QTouch Library extension for Atmel Studio 6

Steps to download QTouch Composer and QTouch Library extensions are as follows: 1. Open Extension Manager by selecting Tools -> Extension Manager. The Extension Manager Window opens. 2. By default, it shows the installed extensions. 3. Click on the “Available Downloads” option. 4. Select “QTouch Library” and click Download Icon. 5. “Sign in to Extension Manager Dashboard” window opens and ask you to sign-in/register. 6. If you have not registered, kindly register and close the “Sign in to Extension Manager Dashboard” window.

Atmel will send you a confirmation email to your email-id. Please click on the link to confirm your mail-id. 7. Restart Atmel Studio. 8. Repeat steps 1-4. “Sign in to Extension Manager Dashboard” window opens. Sign-in using the email-id and

password used while registering. 9. “QTouch Library” extension will download and install automatically. 10. To install, QTouch Composer, repeat steps 1-4, select “QTouch Composer” in the “Available Downloads”

option and click Download button. 11. “QTouch Composer” extension will download and install automatically after signing in to Extension Manager

Dashboard.

Note: Steps 6 and 7 are required only if you are registering for the 1st time. If you have already registered, please provide your email-id and password. “Extension Manager Dashboard” Window closes and your download will automatically happen.

2.2 QT600 system

Figure 2-1. QT600 system.

Page 5: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

5

The MCU board and touch sensor boards together comprise the user touch system. The Atmel QT600 interface board is used to stream live touch data from the Atmel AVR MCU mounted on the MCU board. QTouch Analyzer in Atmel Studio is used as the PC front end to visualize the touch data.

In this hands-on training we are going to use

• Atmel QT600 – USB interface board

• Atmel QT600-ATMEGA324-QM64 – MCU board

• Atmel QMATRIX 8x8 – 64 Channel QMatrix Sensor Board

2.3 Block diagram

Figure 2-2. Block diagram.

2.3.2 Schematics

Figure 2-3. Pin schematics.

PORTD[0~7]

PORTC[0~7]

PORTA[0~7]

Rsmp

Rx

Cx

X

YB

SMP PORTB [3]

RY YA

Cs

Page 6: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

6

3. Assignment For the following tasks, please note:

• Start with all the cables disconnected (PC to QT600, QT600 to MCU boards, and MCU board to Sensor board)

• Ensure you have installed the latest versions of software listed in Section 2.1

• Download source code (AVR3007.zip) files associated with this application note

• The zip file consists of Completed task and Exercise folders. Completed task folder is for user reference, and it consists of the completed projects for user reference

• User can also create his own project by following the steps described in the Assignment section

3.1 Task1: Connect the Tools and Run a Test Application

3.1.1 Introduction This task is designed to ensure that all the tools are connected and working as intended. No code writing is needed for this task. You can load the QT600_ATMEGA324_qm64_gnu.hex file present in the following location.

..\Exercises\Task1\

This can be programmed directly into the flash of the MCU. Press and hold the button on the QT600 interface board and keep it pressed until the status LED changes from orange to red color (~5sec). This will switch the QT600 from Touch Debug mode to Programmer mode.

The Touch Data LED on the QT600 indicates mode:

• Touch Data LED green: Touch Debug mode (default mode after power-up)

• Touch Data LED off: Programmer mode

Make sure that the Touch Data LED is off before attempting to connect to the QT600 from the Atmel Studio programming dialog. Use Atmel Studio 6 or later.

Refer to the QT600 User Guide for more details. It can be accessed by launching Atmel Studio and then selecting Help View Help QT600 User Guide.

3.1.2 Programming Output File using Atmel Studio 6 .Hex file or .Elf file can be loaded into the target board by following the steps below:

• Disconnect if any connection was made previously

• Connect the USB cable to the QT600 interface board

• Make sure the VTG header is mounted on the QT600

• Connect a 10-wire flat cable between the JTAG header on the QT600 and the QT600-ATMEGA324-QM64 MCU board. Refer Figure 3-1

Figure 3-1. JTAG connection.

Page 7: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

7

• Press the button on the Atmel QT600 to switch to Programmer mode (~5s)

• Open Atmel Studio 6 and select Tools Device Programming or by clicking Device Programming icon as shown in Figure 3-2

Figure 3-2. Opening device programming.

• Select the tool as QT600, device as Atmel ATmega324PA, and interface as JTAG. Click Apply. Refer Figure 3-3

• Go to the board settings tab and set the target voltage as per device datasheet. Minimum voltage is 1.8V. Refer Figure 3-3

Page 8: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

8

Figure 3-3. Target voltage.

• Reconnect the USB plug

• Again press the button on the Atmel QT600 to switch to Programmer mode

• Select the tool as QT600, device as Atmel ATmega324PA, and interface as JTAG as shown in Figure 3-3. Click Apply

• Click Read. Ensure that Device Signature and Target Voltage are read by the IDE as shown in Figure 3-4. Also, ensure that the target voltage is as per the device datasheet. Minimum voltage is 1.8V

Page 9: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

9

Figure 3-4. Reading the device ID and voltage.

• Select Memories option, and click Erase now. Refer Figure 3-5

• Set the appropriate path for the output file (QT600_ATMEGA324_qm64_gnu.hex) and click Program. Programming should be successful

Figure 3-5. Erasing and writing file to the target device.

Page 10: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

10

• Disconnect the USB plug from the Atmel QT600

• Remove the flat cable between the programming headers, and mount a 10-wire cable between the Touch Data headers

• Connect the touch panel. For Atmel ATMEGA324, use QMATRIX 8x8 Panel

• Open QTouch Analyzer in Atmel Studio 6 as shown in Figure 3-6 or by clicking icon

Figure 3-6. Opening QTouch Analyzer.

• Plug the USB cable in to the QT600. QTouch Analyzer should now automatically connect to the kit. Touch data LED on USB interface board now starts blinking. This shows that touch data is being sent

• Click Start Reading button in the QTouch Analyzer

You should now be able to view the touch data signals and the state of each sensor. Refer Figure 3-7.

Page 11: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

11

Figure 3-7. QTouch Analyzer window.

• In Analysis mode, sensors displayed in a light grey color are inactive, and the kit will not respond to touches to these sensors. Sensors displayed in a light brown color are active sensors, and the kit will respond to touches to these sensors

• Whenever a touch to an active sensor is detected, a green filled circle can be seen indicating where the user touches the sensor

• When a touch to the active sensor is no longer detected, the color of the sensor will go back to light brown again

Figure 3-8. Sensor states.

Page 12: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

12

3.2 Task2: Set up a new project

3.2.1 Introduction In this task, we will create new project. We will see how to use the Atmel QTouch Composer to create project for touch application.

3.2.2 Setting up the project • Open Atmel Studio 6 and create a new project. If Atmel Studio is already running select File New Project.

Refer Figure 3-9

Figure 3-9. Create a new project.

• Select project type as “GCC C QTouch Executable Project” from the installed templates. Provide the project directory path and project name and click OK. Refer Figure 3-10

Figure 3-10. QTouch project selection.

• QTouch Project Builder wizard “Getting Started” window will open as shown in Figure 3-11. Click Next

Page 13: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

13

Figure 3-11. QTouch project builder - getting started.

• “Select Sensor, Technology and Device” window opens. Select number of Buttons as 1, number of wheel as 0, and number of slider as 0 in Sensors. Select QMatrix as Technology. Select device ATmega324PA shown in Figure 3-12 and click Next. We can add the remaining sensors later

Figure 3-12. QTouch project builder – sensor, technology and device selection.

Page 14: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

14

• Kit Design window opens. Click the Browse button in Kit image option. Browse to file “F003-QT600-PANEL-QM64-1-image” file available in ../Exercise/Taks2 folder and click OK. Refer Figure 3-13

Figure 3-13. Kit image selection.

• Configure physical parameters of kit and sensor global parameters as shown in Figure 3-14

Figure 3-14. Kit physical and touch global parameters.

• Right-click on the button and select Delete Sensor to delete the same

• Add the sensors to kit as follows

Page 15: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

15

a. Add 1 wheel by clicking icon. Refer to Figure 3-13.

b. Add 1 Slider by clicking icon.

c. Add 8 buttons by clicking 8 times icon. d. Repeat the steps a, b and c for four times. So, totally, four wheels, four sliders, 32 buttons will be added to

the kit.

Note: The order of adding sensor should be same as mentioned above.

• Ensure that the sensors are added and the channel numbers are as follows: • Channel 0-3 = Wheel0 • Channel 4-7 = Slider0 • Channel 8-15 = Button0 to Button7 • Channel 16-19 = Wheel1 • Channel 20-23 = Slider1 • Channel 24-31 = Button8 to Button15 • Channel 32-35 = Wheel2 • Channel 36-39 = Slider2 • Channel 40-47 = Button16 to Button23 • Channel 48-51 = Wheel3 • Channel 52-55 = Slider3 • Channel 56-63 = Button24 to Button31

• Arrange the sensors as shown in the Figure 3-15

Figure 3-15. Kit image after adding sensors.

• Select button 0 from drop-down menu and set the physical and sensor specific parameter as shown in Figure 3-16

Page 16: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

16

Figure 3-16. Button physical and firmware parameters.

• Similarly, configure other buttons

• Select slider0 from drop-down menu and set the physical and sensor specific parameter as shown in Figure 3-17

Figure 3-17. Slider physical and firmware parameters.

• Similarly configure other sliders

• Select wheel0 from drop-down menu and set the physical and sensor specific parameter as shown in Figure 3-18

Page 17: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

17

Figure 3-18. Wheel physical and firmware parameters.

• After configuring all the sensors physical and sensor specific parameters, click Next. “Assign sensors to X & Y lines” opens

• Configure Y0 to Y7 as follows. Refer Figure 3-19 a. X[0:3], Y[0] = Wheel0; b. X[4:7], Y[0] = Slider0; c. X[0:8], Y[1] = Button[0:7]; d. X[0:3], Y[2] = Wheel1; e. X[4:7], Y[2] = Slider1; f. X[0:8], Y[3] = Button[8:15]; g. X[0:3], Y[4] = Wheel2; h. X[4:7], Y[4] = Slider2; i. X[0:8], Y[5] = Button[16:23]; j. X[0:3], Y[6] = Wheel3; k. X[4:7], Y[6] = Slider3; l. X[0:8], Y[7] = Button[24:31];

• Click Next

Page 18: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

18

Figure 3-19. Assigning ports.

• Assign X, Y, SMP and AIN0 port pins as follows a. X[0:7] = Port D[0:7] b. YA[0:7] = Port C[0:7] c. YB[0:7] = Port A[0:7] d. SMP Port Pin = Port B[3] e. AIN0 Port Pin = Port B[2]

• Refer Figure 3-20. Then Click Next

Page 19: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

19

Figure 3-20. Pin assignment.

• Advance Options window opens. Click Enable QDebug Interface option and select the interface as “SW implemented SPI”. Select the ports PORTB4 for SPI_BB_SS, PORTB5 for SPI_BB_MOSI, and PORTB6 for SPI_BB_MISO, and PORTB7 for SPI_BB_SCK as shown in Figure 3-21 and Click Next. Note that Delay Cycles can be configured in this window

Figure 3-21. Advanced options.

Page 20: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

20

• Summary page shows the summary of the touch configuration as shown in Figure 3-22. Ensure that the summary is as per our inputs given in this wizard. Click Finish if everything is proper

Figure 3-22. Summary.

• While the new project is getting created, you will see the progress window as follows:

• After that progress window, the project will get created as shown in the following figure:

Page 21: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

21

• Build the project. Press F7 or select Build Build Solution. It should build without any errors

• Now connect the kit and program the hex file generated as mentioned in Task1

• Launch Atmel QTouch Analyzer in Atmel Studio

• Disconnect and connect the USB cable connected to the kit

• Check if your kit gets connected in QTouch Analyzer

• Click Start Reading and check whether you are able to detect touch and see it on QTouch Analyzer window. In the Sensor Data window, you can see the values of reference, signal, and delta and the state of each sensor

3.2.3 Further Explanation “touch.c” file This is an auto-generated file which contains the periodic function calls to various touch related functions defined in QTouch Library.

“touch.h” file This is an auto-generated file which contains the various symbol definitions used by touch library, QDebug protocol, ports etc. To make any changes to the global or sensor specific parameter, you have to open QTouch Project Builder wizard and change the corresponding parameters. To open the wizard by doing double-click on the “.qtdgn” file in your project as shown in the following figure:

• The QTouch Project Builder wizard opens

• Do the necessary changes

• Build your project

• Check for the modified changes

Note: Editing the parameters in the file directly is not recommended, because any further changes done through QTouch Project Builder wizard will remove the changes done directly to these files.

Page 22: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

22

Most of the function calls used in this task are quite simple and self explanatory. The most complex line is the qt_enable_key() function. So make a closer look at this.

Void qt_enable_key(channel_t channel, aks_group_t aks_group, threshold_t detect_threshold, hysteresis_t detect_hysteresis);

The parameters are as follows:

channel - which touch channel the key sensor uses.

aks_group - which AKS® group (if any) the sensor is in.

detect_threshold - minimum delta required to report a touch.

detect_hysteresis - Once a sensor goes into detect, its threshold level is reduced by hysteresis value in order to avoid the sensor dither in and out of detect if the signal value is close to the detect_threshold value.

The slider and wheel declarations have similar parameters:

Void qt_enable_slider( void qt_enable_rotor( channel_t from_channel channel_t from_channel, channel_t to_channel, channel_t to_channel, aks_group_t aks_group, aks_group_t aks_group threshold_t detect_threshold, threshold_t detect_threshold, hysteresis_t detect_hysteresis, hysteresis_t detect_hysteresis, resolution_t position_resolution, resolution_t angle_resolution, uint8_t position_hysteresis); uint8_t angle_hysteresis);

The slider and wheel declarations have a few more parameters:

from_channel - the first channel in the rotor sensor.

to_channel - the last channel in the rotor sensor.

aks_group - which AKS group (if any) the sensor is in.

detect_threshold - minimum delta required to report a touch.

detect_hysteresis - Once a sensor goes into detect, its threshold level is reduced by hysteresis value in order to avoid the sensor dither in and out of detect if the signal value is close to the detect_threshold value.

position_resolution - the resolution of the reported position value.

angle_resolution - the resolution of the reported angle value.

position_hysteresis - the hysteresis of the reported position value.

angle_hysteresis - the hysteresis of the reported angle value.

Page 23: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

23

3.3 Task 3: Analysis mode

3.3.1 Introduction • Analysis mode has a scalable image of the connected kit. It will show touch events such as button presses,

wheel use, and slider use

• The Analysis mode of the Atmel QTouch Analyzer reads out the channel to sensor mapping for a kit when it is connected to the PC. Using this information, the image of the kit will be updated

• As explained in Task1, sensors displayed in light grey color are inactive, and the sensors displayed in a light brown color are active sensor. When the user touches an active sensor, a filled circle is drawn indicating touch. The size of the filled circle is proportional to delta value, and change color when the threshold is reached

• When a touch to the active sensor is no longer detected, the color of the sensor will go back to light brown again. The user shall be able to edit sensor configuration options like detect threshold, AKS, etc., and kit configuration options like MAX ON duration, detect integration etc., during Analysis

3.3.2 Configuring the kit/sensors

3.3.2.1 Modify sensor specific parameters AKS group

• Open QTouch Analyzer in Atmel Studio

• In Kit/Sensor Properties window, select Button0 and configure the AKS group as AKS_GROUP_1. Click Write to kit

• Similarly, configure Button5 and Button9 as AKS_GROUP_1

• Now, if you touch all three buttons at the same time, only one will go into detect

• In designs where the sensors are close together or set for high sensitivity, multiple sensors might report detect simultaneously if touch is near them. To allow applications to determine the intended single touch, the touch library provides the user the ability to configure a certain number of sensors in an AKS group

• When a group of sensors are in the same AKS group, only the first, strongest sensor will report detection. The sensor reporting detection will continue to report detection even if another sensor’s delta becomes stronger. The sensor stays in detect until its delta falls below its detection threshold, and then, if any more sensors in the AKS group are still in detect, the strongest will report detection

• And so at any given time, only one sensor from each AKS group will be reported to be in detect

Page 24: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

24

Detect Threshold

• Open the Kit/Sensor Configuration window, select any sensor and change the values of the detect threshold. Click on Write to kit

• Observe how sensitivity of that sensor changes with different values

• The lower the value, the more sensitive is the sensor

• A sensor’s detect threshold defines how much its signal must drop below its reference level to qualify as a potential touch detect. It has a range of between 3 and 255

For more details on all the configuration parameters, please refer to the QTouch Library User Guide

3.3.2.2 Modify Global Sensor Parameters Max ON Duration

• Click icon on Graph window of QTouch Analyzer

• Select signal and reference value of channel 4 to view them on graph

• The graph window plots the signal and reference values of channel 4. Observe them during touch and non-touch

• In Kit/Sensor Properties window, select kit from drop-down menu and change MAX ON duration parameter to 30. Click Write to kit

• Now touch the key and see that sensor re-calibrates after 6 seconds

• In Kit/Sensor Properties window, select kit from drop-down menu and change MAX ON duration parameter to 0. Click Write to kit

• Touch happens for prolonged time if MAX ON duration is set to zero

MAX ON duration = 30

MAX ON duration = 0

If an object unintentionally contacts a sensor and results in touch detection for a prolonged interval, it is usually desirable to recalibrate the sensor in order to restore its function, perhaps after a time delay of some seconds. The Maximum ON Duration timer monitors such detections.

Page 25: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

25

3.4 Logging the Data • Connect the kit and open the Atmel QTouch Analyzer

• Select Trace tab in Sensor Data Window

• Click save button as shown below and save the file in desired location:

• Click Start Reading button

• After the desired duration or touch operations click Stop Reading button

• Now open the saved “.csv” file in MS Office Excel

• You can create charts, graph etc, and analyze the touch data in any spreadsheet tool

4. Summary The main goal with this hands-on training was to learn how to use Atmel Studio 6 and Atmel QTouch Composer with the Atmel QT600 kit.

• Set up the hardware

• Create a project from scratch

• Configure kit and touch parameters using “QTouch Project Builder” wizard

• Configure global options and sensor specific parameters

• Analyze sensor data using QTouch Analyzer

• Use Design Validation Wizard

• Log and Analyze data

In addition, you have learned how to use Atmel Studio 6 to program the code into the device.

5. Atmel Technical Support center Atmel has several support channels available:

Web portal: http://support.atmel.no/ All Atmel microcontrollers

Email: [email protected] All touch products

Email: [email protected] All AVR products

Email: [email protected] All AVR32 products

Please register on the web portal to gain access to the following services:

• A rich FAQ database

• Easy submission of technical support requests

• A history of all your past support requests

• Atmel microcontrollers’ newsletters

• Information about available trainings and training material

Page 26: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training Guide [APPLICATION NOTE] 42044A−AVR−10/2012

26

6. Revision History Doc. Rev. Date Comments

42044A 10/2012 Initial document release

Page 27: Atmel AVR3007: QTouch Composer with QT600-ATmega324 Training …ww1.microchip.com › downloads › en › AppNotes › doc42044.pdf · Atmel AVR3007: QTouch Composer with QT600-ATmega324

Atmel Corporation 1600 Technology Drive San Jose, CA 95110 USA Tel: (+1)(408) 441-0311 Fax: (+1)(408) 487-2600 www.atmel.com

Atmel Asia Limited Unit 01-5 & 16, 19F BEA Tower, Millennium City 5 418 Kwun Tong Road Kwun Tong, Kowloon HONG KONG Tel: (+852) 2245-6100 Fax: (+852) 2722-1369

Atmel Munich GmbHBusiness Campus Parkring 4 D-85748 Garching b. Munich GERMANY Tel: (+49) 89-31970-0 Fax: (+49) 89-3194621

Atmel Japan G.K.16F Shin-Osaki Kangyo Bldg. 1-6-4 Osaki, Shinagawa-ku Tokyo 141-0032 JAPAN Tel: (+81)(3) 6417-0300 Fax: (+81)(3) 6417-0370

© 2012 Atmel Corporation. All rights reserved. / Rev.: 42044A−AVR−10/2012

Atmel®, Atmel logo and combinations thereof, AKS®, AVR®, Enabling Unlimited Possibilities®, megaAVR®, QTouch®, STK®, tinyAVR®, XMEGA®, and others are registered trademarks or trademarks of Atmel Corporation or its subsidiaries. Windows® is a registered trademark of Microsoft Corporation in U.S. and or other countries. ARM® is a registered trademark of ARM Ltd. Other terms and product names may be trademarks of others.

Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL TERMS AND CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS AND PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and products descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life.