[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Problem with UART1 for Atmega128...

From: Marc Wetzel
Subject: Re: [avr-gcc-list] Problem with UART1 for Atmega128...
Date: Wed, 24 Apr 2002 15:47:01 +0200

The following code works fine for me...

void InitUarts(void) {

    // MOBILE
    outp(0, UBRR0H);
    outp((u_char)((u_long)cpu_clock/8736L/16L)-1, UBRR0L);

    outp((1<<RXEN) | (1<<TXEN), UCSR0B);
    while ( !( inp(UCSR0A) & (1<<UDRE)) );

    // SIM
    outp(0, UBRR1H);
    outp((u_char)((u_long)cpu_clock/8736L/16L)-1, UBRR1L);
    outp((1<<RXEN) | (1<<TXEN), UCSR1B);
    while ( !( inp(UCSR1A) & (1<<UDRE)) );

    NutRegisterInterrupt(IRQ_UART_RX0, RxComplete0, 0);
    NutRegisterInterrupt(IRQ_UART_RX1, RxComplete1, 0);
    outp(BV(RXCIE)| BV(RXEN) | BV(TXEN), UCSR0B);
    outp(BV(RXCIE)| BV(RXEN) | BV(TXEN), UCSR1B);

At 15:25 24.04.2002 +0200, =?iso-8859-2?Q?S=B3awomir_Kawa=B3ek?= wrote:


I have problem with UART1 for atmega128.


Does anybody use successfuly UART1 for atmega128 with interrupts???


My UART 0 works fine, but.... UART 1 works in strange way.

I have tested it on device and on the simulator.


Probably there is some problem durring initialization.

The best will be help with some examples.


Slawomir Kawalek


avr-gcc-list at http://avr1.org

Marc R. Wetzel
Oppenhoffallee 145
52066 Aachen
Tel:   +49 241 7014155
Mobil: +49 177 3903870

reply via email to

[Prev in Thread] Current Thread [Next in Thread]