Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: AT91SAM7S512
PostPosted: Wed Jul 13, 2011 1:13 pm 
Offline

Joined: Wed Jul 13, 2011 1:08 pm
Posts: 2
Hello,
Almost 1 week i trying to make uart work but half success.
in some case its work (low data amount ~50 bytes), but when i expect about ~1024 bytes, i receive only last 10 bytes.

here is my function :
size = 1024;
timeOut = 1000;

for (r=0;r<size;r++){
while (!(pUSART->US_CSR & AT91C_US_RXRDY)) {



if (timeOut == 0) {

break;

}
else
{
timeOut--;
}

}
buffer[i] = pUSART->US_RHR;
printf("%02x \n\r",buffer[i]);
i++;
timeOut--;

if (timeOut==0){break;}
}

can someone tell me if there is problem with high amount data with this way of uart read ?


Top
 Profile  
 
 Post subject: Re: AT91SAM7S512
PostPosted: Wed Jul 13, 2011 5:27 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 574
Perhaps it's the way you are sending it that's the problem?

Why do you have a "timeout--" when you successfully read a character, the timeout method you have will almost assuredly cause the loop to fail before it reads 1000 characters.

size = 1024;

i = 0;

for (r=0;r<size;r++)
{
timeOut = 100000; // Presumably your clocking at a few million cycles/second?

while (!(pUSART->US_CSR & AT91C_US_RXRDY))
{
if (timeOut == 0)
break;
else
timeOut--;
}

if (timeOut==0) // No Character detected
break;

buffer[i] = pUSART->US_RHR;
printf("%02x \n\r",buffer[i]);
i++;
}


Top
 Profile  
 
 Post subject: Re: AT91SAM7S512
PostPosted: Wed Jul 13, 2011 10:37 pm 
Offline

Joined: Wed Jul 13, 2011 1:08 pm
Posts: 2
hello,
thanks for your answer.

about timeout i do : 2400 x (timeout in miliseconds) to have ~1sec

and i decrement also if byte is readed to be sure function to in dedicated timeout time.

strange is that its work on low amount of bytes, but in case high, like 1024 waiting bytes, i received only 10 bytes (chipset handle only 10, but 1024 are send to chipset).

i was think they gone in pointer register than holding resited, so i deactivate pointer but result is still same.

i really dont know what can be problem.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: