avr-gcc-list
[Top][All Lists]
Advanced

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

RE: [avr-gcc-list] UART transmitting problem


From: Rune Christensen
Subject: RE: [avr-gcc-list] UART transmitting problem
Date: Wed, 3 Dec 2003 12:16:39 +0100

Hi

Remember that the picoweb runs on ~8Mhz.

What testboard do you use?

What are the crystal frequency on your testboard?

What programmer do you use?

I have had problems with the picoweb that it resets randomly. I think it's
noise on the reset pin on the parallelport that i use to proram it with!

I have tried to make it keep sending the message with this code:

#include <avr/io.h>

char *message = "Testing, testing, 1-2-3";

int main(void)
{
        char c, *buf = message;

        // -- Enable transmitting, 115200bps (clock is 7.3728Mhz)
        // Always initialize UBRR before UCR
        UBRR = 3;
        UCR = _BV(TXEN); // same as UCR = 1 << TXEN;

        while(1)
        {
        buf = message;
        while ( ( c = *buf++ ) != '\0' ) {
                // check to see if the UDR is ready before
                // you use. Then you don't have to wait when
                // you have transmitted the last character.
                // Maybe use interrupts instead of polling.
                loop_until_bit_is_set( USR, UDRE );
                UDR = c;
        }
        }

        return 0;
}

The output from my terminal is:

g, 1-2-3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing, testing,
1-2-3Tes
ting, testing, 1-2-3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing,
testi
ng, 1-2-3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing, testing,
1-2-3Te
sting, testing, 1-2-3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing,
test
ing, 1-2-3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing, testing,
1-2-3T
esting, testing, 1-2-3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing,
tes
ting, 1-2-3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing, testing,
1-2-3
Testing, testing, 1-2-3Testing, testing, 1-2-3Testing, testing,
1-2-3Testing, te
sting, 1-2-3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing, testing,
1-2-
3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing, testing,
1-2-3Testing, t
esting, 1-2-3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing, testing,
1-2
-3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing, testing,
1-2-3Testing,
testing, 1-2-3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing,
testing, 1-
2-3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing, testing,
1-2-3Testing,
 testing, 1-2-3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing,
testing, 1
-2-3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing, testing,
1-2-3Testing
, testing, 1-2-3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing,
testing,
1-2-3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing, testing,
1-2-3Testin
g, testing, 1-2-3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing,
testing,
 1-2-3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing, testing,
1-2-3Testi
ng, testing, 1-2-3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing,
testing
, 1-2-3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing, testing,
1-2-3Test
ing, testing, 1-2-3Testing, testing, 1-2-3Testing, testing, 1-2-3Testing,
testin

Rune Christensen

-----Original Message-----
From: address@hidden
[mailto:address@hidden Behalf Of Laurence Anderson
Sent: Wednesday, December 03, 2003 1:48 AM
To: address@hidden
Subject: Re: [avr-gcc-list] UART transmitting problem


> First, make your transmission continuous.  You program (assuming it works)
> sends out a string, then halts in a tight loop.  Why not keep sending in a
> tight loop, so that you don't have to keep restarting the program?

I'm now using the picoweb code by Rune that works (adjusted UBRR to 25, and
loops to keep sending the message). I installed Terra Term Pro, and I see
random characters (but the correct number of them), however if I fiddle with
the settings to 7-bit data, I see the correct data! Then changing back to 8
it sometimes continues to work. Very weird.

Many thanks to everyone for their comments & suggestions,

Laurence

_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list



reply via email to

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