Atmel START: Using the SAM E54 Event System with RTC, ADC, USART and DMA - Overview

 Objective

Atmel START is a web-based software configuration platform that helps you to get started with developing your applications on Atmel 8-bit and SMART ARM®-based microcontrollers. It also supports a wide variety of embedded drivers, example projects, and middleware software.

This tutorial shows you how to add a Real-Time Counter (RTC), Analog-to-Digital Converter (ADC), Universal Synchronous and Asynchronous Receiver and Transmitter (USART), Direct Memory Access (DMA) and EVENT SYSTEM drivers to your Atmel START project. You will use the SAME54 Xplained Pro Evaluation Kit and I/O1 Xplained Pro Extension Kit extension board (sold separately).

There are two ways to use this tutorial:

  1. Create the project from scratch.
    • Use the provided source files and follow the step-by-step instructions given below.
  2. Use the solution project as an example.
    • Just build the solution project and download it to the SAME54 Xplained Pro Evaluation Kit to observe the expected behavior.

Lab Objectives

  1. Create an Atmel START project from scratch for the SAME54 microcontroller.
  2. Add RTC, ADC, USART and EVENT SYSTEM drivers to your project.
  3. Configure the clock.
  4. Open the project using Atmel Studio.
  5. Reconfigure existing project by configuring DMA driver.
  6. Add application code to the generated project.

 Materials

Hardware Tools

Tool About Purchase
board-50px.png
SAM E54 Xplained Pro
Evaluation Kit

The Xplained Pro series evaluation kits include an onboard Embedded Debugger (EDBG). No external tools are necessary to program or debug the ATSAME54P20A. The EDBG connects to the host PC through the USB micro-B connector on the SAME54 Xplained Pro Evaluation Kit for programming/debugging.

Software Tools

This project has been verified to work with the following versions of software tools:
Atmel Studio 7 (Version: 7.0.1645), ARM/GNU C Compiler :6.3.1, SAME54_DFP (Device Family Pack) :1.0.67, Atmel START and Atmel Studio Data Visualizer extension version 2.15.713 or later.

Because we regularly update our tools, occasionally, you may discover an issue while using newer versions. If you suspect that to be the case, we recommend that you double check using the same versions that the project was tested with.

Archived versions of our tools can be found on the following Microchip websites:
Atmel Studio 7

Note that you don't need to separately install the IDE, ARM GCC Compiler, and Data Visualizer. Installing Atmel Studio installs them all.

Tool About Installers
Installation
Instructions
Windows Linux Mac OSX
swtool-28px.png
Atmel® Studio
Integrated Development Environment

Overview:

This lab shows you how to create a project from scratch, add drivers, and use the event system to drive the events received from the peripherals without intervention from the CPU.

block.png

The application flow is as follows:

  • Device is operated in sleep mode.
  • RTC is configured as an Event Generator to generate periodic (every 1 s) event to trigger the ADC to start a conversion through the EVENT SYSTEM.
  • ADC acknowledges the event from the RTC and starts a conversion of the light sensor present in Atmel I/O1 Xplained Pro Kit.
  • DMA moves the conversion result from the ADC RESULT register to the USART DATA register and raises the DMA transfer complete event.
  • CPU wakes up and re-enables DMA for next transmission.

Figure 1.1 Application Flow Sequence
  • Configure Clock and Drivers: The function system_init initializes the SAM E54 system clock, drivers, and EVENT SYSTEM.
  • Enable ADC: The function adc_async_enable_channel enables the ADC module.
  • Configure and enable DMA: The function configure_dma configures the DMA transfer from the ADC RESULT register to USART DATA register and enables DMA transfer.
  • Enable USART: The function usart_sync_enable enables the USART module.
  • Start the timer: The function timer_start starts the timer.
  • The function sleep configures the device to sleep mode.
  • Observe light sensor values on TeraTerm.
  • Re-enable DMA for next transmission.
flowchart.png
Figure 1.1 shows the flow sequence of the application task.
Click image to enlarge.

Lab Source Files and Solutions:

This ZIP file contains the completed solution project for this lab. It also contains the source files needed to perform the lab as per the following step-by-step instructions (see the "Procedure" section on this page).

The contents of this ZIP file can be placed in a folder of your choice, preferably in a top level folder of a drive.


Extracting the ZIP file will create the following folders:

  • event_based_drivers contains the lab folder event_based_drivers_lab.
  • event_based_drivers_lab contains the complete lab solution (event_based_drivers_lab.atsln and related files under sub folder event_based_drivers_lab).
  • dev_files contains application source files and other support files (if any) required to perform the lab from scratch (see the "Procedure" section below).
  • event_based_drivers_lab.atsln is the completed lab solution project. It can be directly built and downloaded on the hardware to observe expected behaviour.

Procedure:

All steps must be completed before you build, download, and run the application.

Lab Index

Step 1: Create a project for the SAM E54 microcontroller

  • Step 1.1 – Create an Atmel START project using Atmel Studio IDE

Step 2: Configure drivers for the application

  • Step 2.1 - Configure TIMER(RTC) and ADC drivers
  • Step 2.2 - Configure USART and EVENT SYSTEM drivers
  • Step 2.3 - Configure clock system to run in standby mode
  • Step 2.4 - Generate and open the project in Atmel Studio

Step 3: Reconfiguring existing project

  • Step 3.1 - Reconfigure existing project by configuring DMA driver

Step 4: Add application code to the project

  • Step 4.1 - Add code to enable ADC
  • Step 4.2 - Add a function configure_dma to configure and enable DMA
  • Step 4.3 - Add code to enable USART and start timer
  • Step 4.4 - Add sleep implementation to the project

Step 5: Build, program and observe the outputs

  • Step 5.1 - Build and program the application
  • Step 5.2 - Observe current consumption on Data Visualizer
© 2018 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.