[En-Nut-Discussion] SAM7S128 UART0 / UART1 problem

SZABO Tamas sza2king at freemail.hu
Thu Jul 8 11:37:18 CEST 2010


> I put some LED blinking code to the very beginning of the application. 
> With DEV_DEBUG / DEV_DEBUG_NAME it is OK, LED blinks a few times after 
> reset.

> However, in case of DEV_UART (or DEV_UART0, DEV_UART1) and DEV_UART_NAME 
> (or DEV_UART0_NAME, DEV_UART1_NAME) - there is no activity et al.

So finally I found (even that a minor modification should be make on nut source as well) the real cause.

I used sam7_pgm (http://www.pjrc.com/arm/sam7_pgm/) to program my AT91SAM7S128. But the programmer only flashed the first 16kB, since the method for unlocking flash areas wasn't the right one and unlocked only the first region and the second remained locked. But with an extremely small modification it can be make working, by changing

r = write_word(MC_FCR, (region << 8 | 0x5A000004);
to
r = write_word(MC_FCR, ((region * 0x40) << 8) | 0x5A000004);

It was an unfortunate case that with DEV_DEBUG the size was a bit below 16kB and with DEV_UART it was somewhat larger than 16kB.

By the way, it was necessary to add MCU_AT91SAM7S128 to debug.h, irqreg.h and spimmc_at91.c, and

extern NUTDEVICE devUsartAt910;
extern NUTDEVICE devUsartAt911;

to debug.h

So now it works as expected:-)

/sza2



More information about the En-Nut-Discussion mailing list