Generate SAML1x Touch Project

The ATSAML11 is an Arm® Cortex®-M23 based MCU featuring Arm TrustZone® technology which provides additional security features. SAML11 flash can be partitioned as secure vs non-secure. The touch library can reside in either the secure flash area or the non-secure flash area. Even if the touch library has to reside and run from a non-secure flash area, the device still needs to boot up in the secure flash area and then the program execution will jump into a non-secure flash area.

SAM L11 Projects classification with respect to the security features is provided below.

  1. Non-Secure Project - By default, a SAM L11 project created in START comes without the TrustZone Manager middleware and it is considered a non-secure project. To import a non-secure project to the IDE, a secure linker script, a library, and a header file needs to be added.
  2. Secure Project - Add the TrustZone Manager middleware in START to convert a non-secure project to a secure project and then configure the TrustZone settings.

 Objective

The following lab shows you how to create ATSAML11 QTouch® secure and non-secure projects in START, and import them into Atmel Studio. This project is generated for the ATSAML11 Xplained Pro along with the QT7 Xplained Pro Extension Kit.

 Materials

Hardware Tools

Tool About Purchase
hwtool-50px.png
ATSAML11E16
ATSAML11E16
hwtool-50px.png
ATSAML11E16
XplainedPro
hwtool-50px.png
QT7 Xplained Pro
Extension Kit

Software Tools

Tool About Installers
Installation
Instructions
Windows Linux Mac OSX
swtool-28px.png
Atmel® Studio
Integrated Development Environment
Atmel® START (ASF4)
Integrated Software Framework
Web Based

 Procedure

1

Go to http://start.atmel.com and click on the CREATE NEW PROJECT button.

NewProject.png

2

Start typing saml11e in the Filter on device… box. Select 'ATSAML11E16A-A' and then:

a

Add the QTouch middleware.

b

Add the TrustZone Manager middleware for a Secure Project. Do not add the TrustZone middleware for Non-Secure Project.

c

Click on CREATE NEW PROJECT.

CreateNewProject.png

Additional secure elements such as trustzone_veneer.h, linker file, and libsecure_gateway_veneer.lib are to be linked from the secure project during non-secure project import to Atmel Studio.

3

After project creation, the project dashboard will open as follows. Click on TRUSTZONE_MANAGER_0 to configure the TrustZone settings.

Click_Trustzone.png

Configure the TrustZone Manager settings as shown in the figure below.

Trustzone_set1.png

The SERCOM1 fuse has to be checked in the TrustZone settings in order to configure PA18 and PA19 as touch lines. In addition, secure and non-secure stacks and other peripherals are to be configured either as secure or non-secure depending on your application.

Trustzone_set2.png

Based on the design files, the Y lines should be selected as follows:

L11_QT7.png

4

Refer to the link below to add buttons, slider sensors, configure the driven shield, debug pins, and generate the project from START as per the SAM11LE16 and QT7 design files.

SAML11 Non-Secure Project Import and Creation in Atmel Studio

1

First, download the 'QTouch SAM L11 Trustzone Settings Example Project' by clicking on 'BROWSE EXAMPLES' in http://start.atmel.com.

BrowseExamples.png

Note: You can set the peripherals needed for a Non-Secure project as non-secure in this step. All you have to do is select the 'QTouch SAM L11 Trustzone Project', click 'OPEN SELECTED EXAMPLE' in START and change the settings in the TrustZone Manager prior to downloading the example project.

2

Open Atmel Studio and import the QTouch SAML11 TrustZone Project.

ImportProject.png

3

The peripherals needed for a Non-Secure QTouch project can also be configured as non-secure by setting them as 1 in the trustzone_config.h file in the QTouch SAML11 Trustzone Project after downloading it. The list of the peripherals to be configured as non-secure for a QTouch project is given below. Other peripherals can also be configured in the trustzone_config.h file as needed in your application.

  • PTC
  • RTC
  • PORT
  • SERCOM used for UART (Data Visualizer Interface)
  • SERCOM1 (Linked with XY14 (PA18) and XY15 (PA19)
TrustZoneConfig.png

4

Build the project and keep it aside.

BuildProject.png

5

Now import the SAM L11 Non-Secure QTouch Project (without TrustZone) generated from START to the QTouch SAM L11 TrustZone solution.

Import.png

6

Browse for the Veneer Header File, libsecure_gateway_veneer.lib, and Non-Secure Project Linker Script from the created QTouch SAM L11 TrustZone Project and click OK.

BrowseFiles.png

7

Now the Secure and Non-Secure Projects are in a single solution as shown below.

SecureAndNonSecure.png

8

Build the L11-Non-Secure project and keep it aside. Now both projects have been created and built.

SAML11 Non-Secure Project Device Programming

1

Right click on the 'L11_Non-Secure_QT7 project' and choose 'Set as StartUp Project'.

StartupProject.png

2

Add the Secure QTouch SAML11 TrustZone Project generated elf file under Additional modules in the Non-Secure_QT7 project's 'Advanced Properties'.

AdditionalModules.png

Note: The QTouch SAML11 TrustZone Settings Project must be compiled if any modifications are made in trustzone_config.h after adding the elf file.

3

Choose 'Chip erase All (CE2)' from the L11_Non-Secure_QT7 Tool Program settings.

ChipErase.png

4

Click either the Start Debugging and Break or the Start Debugging buttons to flash the code and start debugging. Open the Data Visualizer, browse the scripts and connect it to see the touch status.

StartDebug.png

Note: Here both secure and non-secure codes are flashed to the device in a single shot.

Program Mode

1

Erase Secure Memory and Program Secure Code

  • Uncheck the 'Erase Flash before programming' option.
  • Choose the 'Chip Erase Secure (CE1)' option and erase the device by clicking the Erase now button.
  • Browse for the QTouch SAML11 TrustZone Project generated hex file and click the Program button.
ChipEraseSecure.png

2

Erase Non-Secure Memory and Program Non-Secure Code.

  • Uncheck the 'Erase Flash before programming' option.
  • Choose the 'Chip Erase Nonsecure (CE0)' option and erase the device by clicking the Erase now button.
  • Browse for the L11_Non-Secure_QT7 project generated hex file and click the Program button.
NonsecureChipErase.png

3

Read the fuse settings of the device.

FuseSettings.png

4

Program the 'USER_WORD_2' to 'USER_WORD_6' fuses with the settings shown below:

ProgramFuses.png

5

Now the device is ready with the QTouch code. Open the Data Visualizer, browse the scripts and connect it to see the touch status.

Note: These fuse settings are applicable only to this QTouch project with its required peripherals. These settings may vary if additional peripherals/other configurations are added.

SAM L11 Secure Project Import and Creation in Atmel Studio

1

Open Atmel Studio and now import the SAM L11 Secure QTouch Project (with TrustZone) generated from START.

2

Atmel Studio will not ask for any additional files while importing a secure project and the project will be created as usual in a standard procedure.

3

Now TrustZone is part of the QTouch project itself as marked below.

SAML11Secure.png

4

You can debug or program the Secure QTouch project generated hex file to the SAML11 as usual in a standard procedure.

Note: 'USER_WORD_6.NONSECC_SERCOM1' fuse has to be checked (ticked) in the fuse settings after flashing the hex file to the device in program mode in order to enable XY14 (PA18) and XY15 (PA19) as touchlines.

 Results

SAML11 Secure and Non-Secure projects were generated from START, created projects by importing to Atmel Studio, and programmed successfully.

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.