Serial output AT91SAM7S256-EK, Example from Warwick A. Smith

Discussion about SAM7 Series and ARM7TDMI based products.

Moderator: nferre

Posts: 5
Joined: Wed Apr 06, 2011 6:05 pm

Serial output AT91SAM7S256-EK, Example from Warwick A. Smith

Thu May 12, 2011 12:46 pm


Ich have bought the book "C Programming for embedded microcontrollers" from "Warwick A. Smith". All examples are working without any problems, but the tx-serial example on page 203 didn`t make the right output. The output have to be: "Hello from DBGU port!" But on my PC I only get the half text like : " DBGU port". I use absolutely the same board (AT91SAM7S256-EK) like in the description from Warwick A. Smith. The crystal oszillator is correct and I have tested it with many kinds of serial cables. Now I use a crossover "Nullmodem" cable, like the description in the book. But when I would use a wrong cable, then I wouldn`t have any kind of output, is this correct? Can someone tell what`s the problem? Do I something wrong or is it a hardware problem? I have changed the settings of the HyperTerminal to 115200, 8, none,1, none. I have tested an other PC, but there I get only a symbol in the Hyperterminal like "..).." , nothing else, with the same settings.
With an AT91SAM9260-EK and Eddy v2.5 DK the serial output works without any problems, thats the reason why I think to have a hardware problem with the AT91SAM7S256-EK.
Here is the code.

#include "at91sam7s.h"

#define DBGU_115200 26

void DBGUInit(unsigned int baud);
void DBGUTxMsg(char* msg);

int main(void)

DBGUTxMsg("Hello from DBGU port\r\n"); //Here I only get " DBGU port"
while (1) {

void DBGUInit(unsigned int baud)
/* connect the DBGU UART to PA9 & 10 */
PIO_ASR = 0x00000600; /* select the DBGU */
PIO_PDR = 0x00000600; /* DBGU controls the pins */
/* setup the DBGU UART */
DBGU_BRGR = baud; /* set baud rate */
DBGU_MR = 0x00000800; /* no parity, normal mode */
DBGU_CR = 0x00000050; /* enable tx and rx */

void DBGUTxMsg(char* msg)
int ch_num = 0;

/* send characters until null received */
while (msg[ch_num] != 0) {
while (!(DBGU_SR & 0x00000002));
DBGU_THR = (unsigned int)msg[ch_num];
Posts: 2
Joined: Thu Jul 03, 2014 10:39 am

Re: Serial output AT91SAM7S256-EK, Example from Warwick A. S

Thu Jul 03, 2014 11:51 am

can i get a copy/pdf of this book?
Posts: 2
Joined: Wed Jan 27, 2016 4:33 pm

Re: Serial output AT91SAM7S256-EK, Example from Warwick A. S

Wed Jan 27, 2016 5:25 pm

bharat wrote:can i get a copy/pdf of this book?
looking for a copy as well.

did you ever solve this?

Return to “SAM7 ARM7TDMI MCU”

Who is online

Users browsing this forum: No registered users and 2 guests