Atmel Evaluation Board using the SAM7SE Microcontroller AT91SAM7SE-EK AT91SAM7SE-EK Data Sheet

Product codes
AT91SAM7SE-EK
Page of 24
2
6295A–ATARM–27-Mar-07
Application Note
3.
Getting Started with a Software Example
This section describes how to program a basic application that helps you to become familiar with
AT91SAM7SE microcontrollers. It is divided into two main sections: the first one covers the
specification of the example (what it does, what peripherals are used); the other details the pro-
gramming aspect.
3.1
Specification
3.1.1
Features
The demonstration program makes two LEDs on the board blink at a fixed rate. This rate is gen-
erated by using a timer for the first LED; the second one uses a Wait function based on a 1 ms
tick. The blinking can be stopped using two buttons (one for each LED).
While this software may look simple, it uses several peripherals which make up the basis of an
operating system. As such, it makes a good starting point for someone wanting to become famil-
iar with the AT91SAM microcontroller series.
3.1.2
Peripherals
In order to perform the operations described in the previous section, the software example uses
the following set of peripherals:
• Parallel Input/Output (PIO) controller
• Timer Counter (TC)
• Periodic Interval Timer (PIT)
• Advanced Interrupt Controller (AIC)
• Debug Unit (DBGU)
LEDs and buttons on the board are connected to standard input/output pins of the chip; those
are managed by a PIO controller. In addition, it is possible to have the controller generate an
interrupt when the status of one of its pins changes; buttons are configured to have this
behavior.
The TC and PIT are used to generate two time bases, in order to obtain the LED blinking rates.
They are both used in interrupt mode: the TC triggers an interrupt at a fixed rate, each time tog-
gling the LED state (on/off). The PIT triggers an interrupt every millisecond, incrementing a
variable by one tick; the Wait function monitors this variable to provide a precise delay for tog-
gling the second LED state.
Using the AIC is required to manage interrupts. It allows the configuration of a separate vector
for each source; three different functions are used to handle PIO, TC and PIT interrupts.
Finally, an additional peripheral is used to output debug traces on a serial line: the DBGU. Hav-
ing the firmware send debug traces at key points of the code can greatly help the debugging
process. 
3.1.3
Evaluation Kit
3.1.3.1
Booting
The AT91SAM7SE512 found on AT91SAM7SE-EK evaluation boards features two internal
memories: a 512 KB Flash and 32 KB SRAM. In addition, it provides an External Bus Interface
(EBI), enabling the connection of external memories; a 32MB SDRAM chip is present on the EK.