Atmel Software Framework Tutorial – ARM Cortex

An Atmel Software Framework Tutorial series that shows how to use Atmel Software Framework (ASF) to program ARM Cortex microcontrollers using Atmel Studio and the C programming language.

About ASF

Atmel Software Framework (ASF) consists of a number of modules that can be added to a C language project in Atmel Studio. Adding ASF modules to a project makes various functions available for initializing and using hardware and software services, cutting down development time.

As an example, adding the IOPORT ASF module to a project allows pins and ports of a microcontroller to be initialized and accessed using functions from the IOPORT module. Functions from the IOPORT module can then be called to set up pins or ports as inputs or outputs and other functions allow the pins or ports to be read or written to without having to use the hardware at a register level.

Atmel Software Framework Tutorial Contents

The ASF tutorial series consists of the following parts thus far. More parts are being added to the tutorial series each week.

INTRODUCTION TO ASF

Introduces the Atmel software framework tutorial and shows how ASF is structured.

BLINKING AN LED ON AN ATMEL DEVELOPMENT BOARD

How to create a new ASF project for an Atmel Evaluation board. The example project blinks the on-board LED.

BLINKING AN LED ON A CUSTOM OR USER BOARD

How to create an ASF user board project. If you are going to use ASF on your own custom or user board, you will need to know how to write ASF user board projects from scratch. This type of project can still be created and tested on an Atmel evaluation board. Most of this tutorial series shows how to create various projects from scratch using an ASF user board project as this is what is needed in real world applications that use a custom board.

ADDING ASF TO AN EXISTING PROJECT

How to add ASF to an existing project that was not started as an ASF project.

COMPARING ATMEL BOARD AND USER BOARD ASF PROJECTS

There are slight differences between ASF projects created for Atmel evaluation boards and user board ASF projects. This part of the tutorial shows the differences between the project types such as which files are different and where to changes settings in the files.

USING EXTERNAL CRYSTALS IN AN ASF PROJECT

How to enable the on-chip oscillators of the microcontroller to use the external crystals instead of the internal R/C oscillators in ASF.

ASF PROJECT QUICK START CHECKLIST

A quick start checklist for creating new ASF user board projects. Where to add code and to change settings in a new ASF project.

READING AND WRITING PINS USING ASF

Using ASF functions to read and write individual microcontroller pins used for general purpose input/output.

WRITING TO A PORT USING ASF

How to write to a microcontroller port or group of pins from a port using ASF functions.

READING AND WRITING A PORT USING ASF

Reading and writing a port or group of port pins rather than individual port pins.

USING A UART FOR C STANDARD I/O FUNCTIONS

How to configure C standard input/output functions such as printf() and scanf() to use a UART for input/output.

Further Parts of the Tutorial Series

Further parts will be added to the tutorial series until it is complete. Check the index and menu of the tutorial for additional parts.

Unpacking a Atmel SAM4N Xplained Pro Evaluation Board

The Atmel SAM4N Xplained Pro evaluation board contains a ATSAM4N16C microcontroller. The board itself is rather basic with only one user programmable LED and one user programmable push-button switch (the second switch is a reset switch). Pins of the microcontroller are available on headers on the board.

An on-board Embedded Debugger is included on the board, so that no external tools are required to program or debug the ATSAM4N16C.

The video below shows the evaluation board being unpacked.

Some features of the ATSAM4N16C microcontroller are:

  • ARM Cortex-M4 that can run up to 100MHz
  • 3 USARTs and 4 UARTS
  • Real Time Clock (RTC) with calendar and alarm features
  • 10 bit ADC and DAC
  • 1Mb Flash memory
  • 80kb SRAM
  • The usual SPI, TWI, timers, PWM, etc.

The ATSAM4N16C does not contain any USB ports, Ethernet or external bus.

Resources from Atmel

Installing the SAM-BA Driver for Atmel SAM Microcontrollers

The USB CDC driver for Atmel SAM ARM microcontrollers allows a USB microcontroller that is running the SAM-BA software to be configured as a virtual COM port on a PC.

This allows user software to be loaded to the microcontroller via a USB cable using the SAM-BA PC application software.

The article on Installing the SAM-BA USB CDC Driver for Atmel ARM Microcontroller in Windows shows how to install and test the driver.

Terminal emulator software is used to communicate with the embedded SAM-BA software on the microcontroller and request the SAM-BA software version number. This is done to test that the driver and connections are working properly.

Large PLC – Open Source Hardware

The large brick-type open source PLC has 22 digital inputs, 6 analog inputs and 16 transistor outputs. It also features a SD card socket, 2 RS-232 ports, 1 RS-485 port, 1 USB device port and a JTAG port for programming and debugging.

Large Open Source PLC

Large Open Source PLC

All the source files including circuit diagrams for building the large open source PLC are available for download at the above link.

Installing JTAGkey Drivers in Windows

This article on how to install Windows 7 drivers for the Amontec JTAG key shows how to install drivers for the Amontec JTAGkey USB JTAG tool on a Windows 7 computer.

Once the drivers have been installed, the JTAGkey can be accessed by application software such as FPGA / CPLD programming software or ARM microcontroller programming and debugging software.