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

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

RE: [avr-gcc-list] Software UART receiver first byte as NULL / empty


From: Rune Christensen
Subject: RE: [avr-gcc-list] Software UART receiver first byte as NULL / empty
Date: Fri, 12 Mar 2004 10:49:55 +0100

Hello

If the handshaking uses the rx and tx signals maybe it will trigger a false
start bit.
Normally handshaking uses other dedicated pins for that purpose.

If you don't have enough pins then maybe consider software handshaking
instead of hardware handshaking.

Have you voltage level conversion between the two devices?

Cheers
Rune Christensen

-----Original Message-----
From: address@hidden
[mailto:address@hidden Behalf Of harshit suri
Sent: Friday, March 12, 2004 10:21 AM
To: address@hidden
Subject: [avr-gcc-list] Software UART receiver first byte as NULL /
empty


I am using the Software Uart Code from
http://hubbard.engr.scu.edu/embedded/avr/avrlib/ . I
am using a basic stamp to send data to the atmega128.
I uses a handshaking protocol to communicate. The
stamp sends 16 bytes
"HowdyAtmega01234"
and the software uart(its interrupt based) listens for
16 bytes at once.

The problem is that the atmega reads a NULL byte first
before reading the 'H' in Howdy . So when i print it
out it prints:

Byte[0] =
Byte[1] =H
Byte[2] = o
Byte[3] = w
Byte[4] = d
Byte[5] = y
Byte[6] = A
Byte[7] = t
Byte[8] = m
Byte[9] = e
Byte[10] = g
Byte[11] = a
Byte[12] = 0
Byte[13] = 1
Byte[14] = 2
Byte[15] = 3

If i increase the buffer length to 17 it recieves the
character '4' too. But somehow it always manages to
receive a blank character. I thouroughly checked the
waveform by back annotating the compelete waveform .
its perfect. Also i checked if there was any spike
coming before the letter 'H'(the spike could have
triggered the start bit ISR) but No... the line was
not noisy and was maintaining Low.
I tried a version in which no handshaking was taking
place and the stamp was continously sending the string
and the atmega was listening it was Ok. no blank
characters. I have no idea what to test now. The
uartsw receive bit interrupt routine is activated only
after the handhaking is completed. and the waveform is
clean.

here is the code. Should i post the complete code if
needed?

heres main loop:
while(1)
{
while(!(inb(PIND) & (1<<UartswRxPin))); //wait for
stamp to ask for a request to send
//acknowledge the stamp
sbi(PORTD,UartswTxPin);
while(inb(PIND) & (1<<UartswRxPin)); //wait for stamp
to say that its going to send data in a while
//get ure receiver ready
uartswInitRx();
temp = uartswGetRxBuffer();
// tell the stamp ure UART has been set up to receive
and the stamp should send
cbi(PORTD,UartswTxPin);
while((temp->datalength) < UARTSW_RX_BUFFER_SIZE);
//wait till 16 bytes are recieved
uartswOff();
i = 0;
while(i < UARTSW_RX_BUFFER_SIZE) //print out the 16
bytes. Print to the PC host using hardware UART at
9600 8N1
{
printf("Byte[%u] =
%c\n\r",i,bufferGetAtIndex(temp,i));
i++;
}

}

__________________________________
Do you Yahoo!?
Yahoo! Search - Find what youre looking for faster
http://search.yahoo.com

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


_______________________________________________
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]