Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
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.


  Search this Thread
Old 04-19-2011, 03:43 PM   #1
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!

Old 04-21-2011, 03:24 PM   #2
Senior Member
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 (pre-systemd)
Posts: 2,798

Rep: Reputation: 749Reputation: 749Reputation: 749Reputation: 749Reputation: 749Reputation: 749Reputation: 749
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

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

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