LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 04-19-2011, 03:43 PM   #1
yhu
LQ Newbie
 
Registered: Feb 2010
Posts: 1

Rep: Reputation: 0
AT91RM9200 UART interrupt latency problem


I use USART0 and USART1 of AT91RM9200 to send and receive data packets of variable length (typical 513 bytes). Each USART is set to 485 mode and baud rate is 250K. Between the data packets is a break of approximately 112 microseconds. USART is set to interrupt on receiving breaks. DMA is used for data transfer. When USART interrupts on receiving a break (RXBRK), the ISR reads DMA data counter to mark the beginning of a new packet in the DMA buffer, and then transfers the data of the packet just received from DMA buffer to device buffer.

The problem I have now is that from time to time when RXBRK interrupt comes and the ISR reads DMA counter ATMEL_PDC_RCR, the counter value is already 1 byte beyond the beginning of the packet. It looks like the RXBRK interrupt is not serviced quickly enough and the DMA already transfer the byte following the break into the DMA buffer when the ISR is invoked.

When both USART0 and USART1 are receiving packets, the problem gets worse than when only one port is receiving. Adding system load (like running a web server) also causes more packets missing their first byte.

Would you please give some pointers on what might cause the delay and how to correct it? Thank you!

Susan
 
Old 04-21-2011, 03:24 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,138

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Always one byte? That's strange. A bit is 4 microseconds, so a byte is 32-40 depending on your settings.

Sounds to me like you are getting the break interrupt at the end of the break, after the first character of the next packet has already started coming in. Then you only have one byte time to process it and sometimes you don't make it. Just a guess, and no idea how to fix it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
UART Polling/Interrupt jdhar Linux - Software 1 06-10-2010 02:55 PM
how to measure interrupt latency using c in linux? vanu Linux - Newbie 2 04-22-2010 11:33 PM
UART Interrupt Handler devajyotibarman Linux - Hardware 2 01-02-2009 11:12 PM
interrupt latency wwwrabbit Linux - Newbie 1 11-10-2006 07:29 AM
Problem in interrupt handler for uart 16550 mrinal mishra Linux - Kernel 3 05-05-2006 12:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 12:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration