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

Product codes
AT91SAM7SE-EK
Page of 24
17
6295A–ATARM–27-Mar-07
Application Note
only the normal mode is of interest. Setting the CHMODE field to a null-value selects the normal
mode.
It is also possible to configure a parity bit in the Mode Register. Even, odd, mark and space par-
ity calculations are supported. In the example, no parity bit is being used (PAR value of 1xx).
The DBGU features its own Peripheral DMA Controller. It enables faster transfer of data and
reduces the processor overhead by taking care of most of the transmission and reception opera-
tions. The PDC is not used in this example, so it should be disabled by setting bits RXTDIS and
TXTDIS in the PDC Transfer Control Register (PTCR) of the DBGU.
At this point the DBGU is fully configured. The last step is to enable the transmitter; the received
is not being used in this demo application, so it is useless (but not harmful) to enable it as well.
Transmitter enabling is done by setting bit TXEN in the Control Register.
3.2.7.3
Sending a Character
Transmitting a character on the DBGU line is simple: writing the character value in the Transmit
Holding Register (THR) starts the transfer. However, the transmitter must be ready at this time.
Two bits in the DBGU Status Register (SR) indicate the transmitter state. Bit TXEMPTY indi-
cates if the transmitter is enabled and sending characters. If it is set, no character is being
currently sent on the DBGU line.
The second meaningful bit is TXRDY. When this bit is set, the transmitter has finished copying
the value of THR in its internal shift register that it uses for sending the data. In practice, this
means that THR can be written when TXRDY is set, regardless of the value of TXEMPTY. When
TXEMPTY rises, the whole transfer is finished.
3.2.7.4
String Print Function
dbgu_print_ascii() function is defined in the example application. It takes a string pointer as an
argument, and sends it across the DBGU.
Its operation is quite simple. C-style strings are simple byte arrays terminated by a null (0) value.
Thus, the function just loops and outputs all the characters of the array until a zero is
encountered.
3.2.7.5
Hexadecimal Print Function
Another print function, dbgu_print_hex8(), outputs a word (32 bits) value in hexadecimal format.
This C function takes an unsigned int value as an argument. A loop displays each byte, starting
with the upper one. This is done by shifting the byte to the rightmost (lowest) position and mask-
ing it.
4.
Building the Project
The development environment for this getting started is a PC running Microsoft
®
 Windows
®
 OS.
The required software tools for building the project and loading the binary file are:
• an ARM cross-compiler toolchain 
• AT91-ISP v1.8 or later (available at 
The connection between the PC and the board is achieved with a USB cable.