<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/22224/urgent-problem-in-timer-interrupt-program-using-at91sam7se512-ek</link><description> 
Dear Friends, 
I am using the Keil uvision3 ARM version,I have developed a new
project Timer interrupt program.(downloaded from Atmel website). 
In compilation of the code has no problem,after i downloaded into the
Flash using ULink2 ARM debugger. </description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/157269?ContentTypeID=1</link><pubDate>Sun, 14 Oct 2007 21:20:47 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ea28cb89-198f-43fb-933a-86931cdebb99</guid><dc:creator>Murthy r</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi friends,&lt;/p&gt;

&lt;p&gt;
Please give me any example code for USART receiver interrupt
function(for KEIL uversion 3.53).&lt;/p&gt;

&lt;p&gt;
Please help me.&lt;/p&gt;

&lt;p&gt;
with regards,&lt;br /&gt;
Murthy.R&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/157187?ContentTypeID=1</link><pubDate>Fri, 12 Oct 2007 05:31:36 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0049f3e7-9fb7-4c94-baaf-dfeb6eac23ff</guid><dc:creator>Murthy r</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi friend,&lt;/p&gt;

&lt;p&gt;
I have taken the first example(US0),&lt;br /&gt;
the second one is Debug port.&lt;/p&gt;

&lt;p&gt;
In the ISR i have included this lines(at the end).&lt;br /&gt;
The result is same(No receving).&lt;/p&gt;

&lt;pre&gt;
        AT91C_BASE_AIC-&amp;gt;AIC_EOICR = AT91C_BASE_US0-&amp;gt;US_CSR;               /*  Interrupt Ack*/
        AT91C_BASE_AIC-&amp;gt;AIC_ICCR  = (1 &amp;lt;&amp;lt; AT91C_ID_US0);                       /*  Interrupt Ack*/
        AT91C_BASE_AIC-&amp;gt;AIC_EOICR = 0;


        AT91C_BASE_US0-&amp;gt;US_CR = AT91C_US_RSTSTA;

&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
With regards,&lt;br /&gt;
Murthy.R&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/157097?ContentTypeID=1</link><pubDate>Fri, 12 Oct 2007 05:07:59 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:526ded0a-2dbe-461a-8386-443e669b4278</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Your code is not identical to the one you quotes.&lt;br /&gt;
This is the code on the Atmel site:&lt;/p&gt;

&lt;pre&gt;
void Usart_c_irq_handler(void)
{
        AT91PS_USART USART_pt = AT91C_BASE_US0;
        unsigned int status;
        //* get Usart status register
        status = USART_pt-&amp;gt;US_CSR;
        if ( status &amp;amp; AT91C_US_RXRDY){
                //* Get byte and send
                AT91F_US_PutChar (USART_pt, AT91F_US_GetChar(USART_pt));
        }

        if ( status &amp;amp; AT91C_US_OVRE) {
                //* clear US_RXRDY
                 AT91F_US_GetChar(USART_pt);
                 AT91F_US_PutChar (USART_pt, &amp;#39;O&amp;#39;);
        }

        //* Check error
        if ( status &amp;amp; AT91C_US_PARE) {
                 AT91F_US_PutChar (USART_pt, &amp;#39;P&amp;#39;);
        }

        if ( status &amp;amp; AT91C_US_FRAME) {
                 AT91F_US_PutChar (USART_pt, &amp;#39;F&amp;#39;);
        }

        if ( status &amp;amp; AT91C_US_TIMEOUT){
                USART_pt-&amp;gt;US_CR = AT91C_US_STTTO;
                 AT91F_US_PutChar (USART_pt, &amp;#39;T&amp;#39;);
        }

        //* Reset the satus bit
         USART_pt-&amp;gt;US_CR = AT91C_US_RSTSTA;
}
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
It uses a USART_pt pointer, and doesn&amp;#39;t have any acknowledge code for
the interrupt. Also, maybe you should reset the status bit before
acknowledning the interrupt?&lt;/p&gt;

&lt;p&gt;
Another thing - there is different example code for the UART in
the USART_USB sample project. That ISR code looks like:&lt;/p&gt;

&lt;pre&gt;
void Usart_c_irq_handler(void)
{
        AT91PS_USART USART_pt = COM0;
        unsigned int status;

        //* get Usart status register and active interrupt
        status = USART_pt-&amp;gt;US_CSR ;
        status &amp;amp;= USART_pt-&amp;gt;US_IMR;

        if ( status &amp;amp; AT91C_US_RXBUFF){
        //* Toggel LED
        Trace_Toggel_LED( AT91B_LED1) ;
        //* transfert the char to DBGU
         if ( first == 0){
             COM0-&amp;gt;US_RPR = (unsigned int) buff_rx1;
             COM0-&amp;gt;US_RCR = 100;
             pCDC.Write(&amp;amp;pCDC, buff_rx,100);
             first =1;
           }else{
             COM0-&amp;gt;US_RPR = (unsigned int) buff_rx;
             COM0-&amp;gt;US_RCR = 100;
             pCDC.Write(&amp;amp;pCDC, buff_rx1,100);
             first=0;
           }
        }
//* Check error

        if ( status &amp;amp; AT91C_US_TIMEOUT){
         Trace_Toggel_LED( AT91B_LED2) ;
         status = 100 - COM0-&amp;gt;US_RCR;
         if  (status !=0){
           if ( first == 0){
                COM0-&amp;gt;US_RPR = (unsigned int) buff_rx1;
                COM0-&amp;gt;US_RCR = 100;
                pCDC.Write(&amp;amp;pCDC, buff_rx,status);
                first =1;
           }else{
                COM0-&amp;gt;US_RPR = (unsigned int) buff_rx;
                COM0-&amp;gt;US_RCR = 100;
                pCDC.Write(&amp;amp;pCDC, buff_rx1,status);
                first=0;
            }
            COM0-&amp;gt;US_CR = AT91C_US_STTTO;
          }
        }
        //* Reset the satus bit for error
         USART_pt-&amp;gt;US_CR = AT91C_US_RSTSTA;
}
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/156978?ContentTypeID=1</link><pubDate>Fri, 12 Oct 2007 04:45:57 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0c877e0f-6094-456e-8d34-a87e9a69cb31</guid><dc:creator>Murthy r</dc:creator><description>&lt;p&gt;&lt;p&gt;
hi,&lt;br /&gt;
i have downloaded the &amp;quot;AT91SAM7SE512_KEIL.zip&amp;quot;code.&lt;br /&gt;
i took a &amp;quot;AT91SAM7SE-Interrupt&amp;quot; as a example code and created a new
project(using keil version 3.53).&lt;br /&gt;
Then I tried that code,the transmission has no problem,&lt;br /&gt;
but RXD is not working.&lt;/p&gt;

&lt;p&gt;
Those putchar and getchar are used ISR in that example code.&lt;/p&gt;

&lt;p&gt;
After that i have developed a new code without using the APIs(what
i posted here).&lt;/p&gt;

&lt;p&gt;
Please advise me on this.&lt;/p&gt;

&lt;p&gt;
With regards,&lt;br /&gt;
Murthy.R&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/156836?ContentTypeID=1</link><pubDate>Fri, 12 Oct 2007 04:12:31 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c2b3a7d4-afdb-47a3-902c-e48be2955e1d</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
You posted a link to the Atmel site, but haven&amp;#39;t mentioned exactly
what code you decided to try to use.&lt;/p&gt;

&lt;p&gt;
Your posted code for the UART ISR does not look anything like the
example code available - neither for IAR nor for Keil.&lt;/p&gt;

&lt;p&gt;
Where did you get it?&lt;/p&gt;

&lt;p&gt;
How have you modified it?&lt;/p&gt;

&lt;p&gt;
I did look at the code in &amp;quot;AT91SAM7SE512_IAR.zip&amp;quot; and
&amp;quot;AT91SAM7SE512_KEIL.zip&amp;quot;, and both contains UART ISR code that looks
like I would expect them to. Your posted code looks very much like a
criss/cross between polled and interrupt-driven operation with their
GetChar and PutChar references.&lt;/p&gt;

&lt;p&gt;
I commented on it earlier, but didn&amp;#39;t get a response about it.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/156702?ContentTypeID=1</link><pubDate>Fri, 12 Oct 2007 03:48:12 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f85064ad-8432-4654-a4d9-b37599046934</guid><dc:creator>Murthy r</dc:creator><description>&lt;p&gt;&lt;p&gt;
Please help me to rectify this problem&lt;/p&gt;

&lt;p&gt;
With regards&lt;br /&gt;
Murthy.R&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/156552?ContentTypeID=1</link><pubDate>Fri, 12 Oct 2007 00:32:20 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ea327aff-bd2c-45f3-b0ec-ddf18c432d35</guid><dc:creator>Christoph Franck</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;Because if i give this line &amp;quot;AT91C_BASE_AIC-&amp;gt;AIC_IECR = 0x1
&amp;lt;&amp;lt; AT91C_ID_US0;&amp;quot;the program(blink one LED) is not
working.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
This line actually &amp;quot;enables&amp;quot; the USART0 interrupt. If your program
does not work when you do that, then your USART0 interrupt service
routine is the most likely culprit.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/156378?ContentTypeID=1</link><pubDate>Thu, 11 Oct 2007 23:00:06 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:99296117-8e36-442b-b4e0-a72f0fcfe836</guid><dc:creator>Murthy r</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi friend,&lt;br /&gt;
Thanks for your Reply.&lt;br /&gt;
I am new to this AT91SAM7SE512.So please help me on this UART RXD
interrupt problem.&lt;br /&gt;
This is my UART0 initialization code.&lt;br /&gt;
Do i have to modify anything in this code.Because if i give this line
&amp;quot;AT91C_BASE_AIC-&amp;gt;AIC_IECR = 0x1 &amp;lt;&amp;lt; AT91C_ID_US0;&amp;quot;the
program(blink one LED) is not working.When i disable this line the
LED blinking is working.And also the Transmission is working
good.&lt;/p&gt;

&lt;p&gt;
Please advise me on this.&lt;/p&gt;

&lt;pre&gt;
#define AT91C_US_ASYNC_MODE ( AT91C_US_USMODE_NORMAL + \ 
                        AT91C_US_NBSTOP_1_BIT + \ 
                        AT91C_US_PAR_NONE + \ 
                        AT91C_US_CHRL_8_BITS + \ 
                        AT91C_US_CLKS_CLOCK )
#define BAUD_VALUE(baud_rate) (((( MCK  / (baud_rate * 16)) * 10) % 10) &amp;lt; 5 ? \ 
                                                                                                        (MCK / (baud_rate * 16)) : \ 
                                                                                                        (MCK / (baud_rate * 16)) + 1  )



void uart0Init(void)
{
     // enable the clock of UART0
     AT91C_BASE_PMC-&amp;gt;PMC_PCER = (1&amp;lt;&amp;lt;AT91C_ID_US0);
     // enable uart pins on PIO
     *AT91C_PIOA_PDR = AT91C_PA5_RXD0 | AT91C_PA6_TXD0;
     // select peripheral connection
     *AT91C_PIOA_ASR = AT91C_PA5_RXD0 | AT91C_PA6_TXD0;
     // disable I/O pullup
      *AT91C_PIOA_PPUDR = AT91C_PA5_RXD0;
     // reset the UART
     AT91C_BASE_US0-&amp;gt;US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RXDIS |AT91C_US_TXDIS;
     // set serial line mode
     AT91C_BASE_US0-&amp;gt;US_MR = AT91C_US_ASYNC_MODE;
     // set the baud rate
     AT91C_BASE_US0-&amp;gt;US_BRGR = BAUD_VALUE(9600);
     // enable the uart
    AT91C_BASE_US0-&amp;gt;US_CR = AT91C_US_RXEN | AT91C_US_TXEN;

        // enable reaction on different interrupt sources
        AT91C_BASE_US0-&amp;gt;US_IDR = 0xFFFFFFFF;
        AT91C_BASE_US0-&amp;gt;US_IER = AT91C_US_RXRDY;

        // configure USART0 interrupt
        AT91C_BASE_AIC-&amp;gt;AIC_IDCR = 0x1 &amp;lt;&amp;lt; AT91C_ID_US0;
        AT91C_BASE_AIC-&amp;gt;AIC_SVR[AT91C_ID_US0] = (unsigned long) Usart0Int;
        AT91C_BASE_AIC-&amp;gt;AIC_SMR[AT91C_ID_US0] = AT91C_AIC_SRCTYPE_HIGH_LEVEL |2;
        AT91C_BASE_AIC-&amp;gt;AIC_IECR = 0x1 &amp;lt;&amp;lt; AT91C_ID_US0;


}

&lt;/pre&gt;

&lt;p&gt;
With Regards and Thanks&lt;/p&gt;

&lt;p&gt;
Murthy.R&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/156169?ContentTypeID=1</link><pubDate>Tue, 09 Oct 2007 11:35:00 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:dc6bdde0-027e-4f34-9988-b031b518784d</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Why looking for IAR examples instead of Keil examples?&lt;/p&gt;

&lt;p&gt;
Also, the code did not match the contents of the
AT91SAM7SE512_IAR.zip file - that ISR do look as expected for a UART
ISR.&lt;/p&gt;

&lt;p&gt;
In a UART ISR, you send characters by putting them in the transmit
register of the UART - you don&amp;#39;t call a PutChar function, unless the
PutChar function specifically inserts a character into &lt;b&gt;another&lt;/b&gt;
UART&amp;#39;s transmit queue, for that UART&amp;#39;s ISR to later pick up and
send.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/155937?ContentTypeID=1</link><pubDate>Tue, 09 Oct 2007 05:37:09 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7d5af74e-1755-485d-bd59-1e9229b44de3</guid><dc:creator>Murthy r</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi friend,&lt;/p&gt;

&lt;p&gt;
Thanks for your reply,&lt;br /&gt;
Actually this same source code is working prperly in IAR workbench
Tool.&lt;br /&gt;
In keil tool only giving the problem.&lt;br /&gt;
i have downloaded this example source code from &lt;a target="_blank" href="http://www.atmel.com/dyn/products/product_card.asp?part_id=3940"&gt;www.atmel.com/.../product_card.asp&lt;/a&gt;&lt;br /&gt;

website.&lt;/p&gt;

&lt;p&gt;
The problem is when i give the input to board,the receiver
interrupt receive the data and transmit to the USART0.&lt;br /&gt;
After that the program is getting hang.&lt;br /&gt;
Means the control goes to receiver interrupt function only once and
should not return from it.&lt;/p&gt;

&lt;p&gt;
Please help me to rectify this problem.&lt;/p&gt;

&lt;p&gt;
With regards,&lt;br /&gt;
Murthy.R&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/155673?ContentTypeID=1</link><pubDate>Tue, 09 Oct 2007 04:05:26 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:46cdd29b-6dff-4f5c-977b-9907e0450d4e</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
You seem to have mixed polled and interrupt-driven handling of the
UART.&lt;/p&gt;

&lt;p&gt;
Are you really, really sure that you are expected to use
AT91F_US_PutChar and AT91F_US_GetChar in an interrupt-driven
solution?&lt;/p&gt;

&lt;p&gt;
And the ISR should get characters to send from a send buffer, not
invent characters to send based on state of flags.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/155381?ContentTypeID=1</link><pubDate>Tue, 09 Oct 2007 03:17:49 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f33f32b6-5f1f-433f-8a3c-40ce9cb1c93c</guid><dc:creator>Murthy r</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi Martin,&lt;br /&gt;
Thanks for your reply.The timer interrupt is working fine.&lt;br /&gt;
Now i have a problem in the USART interrupt.&lt;br /&gt;
There is no problem in transmission.I using the Interrupt for
Receiver.&lt;/p&gt;

&lt;p&gt;
hereby i have attached my source code..please check the receiver
part and interrupt initialization and help me...&lt;/p&gt;

&lt;pre&gt;
// Include Standard LIB  files
#include &amp;quot;Board.h&amp;quot;

extern void delay ( int );      /*Delay function*/

#define AT91_BAUD_RATE                  9600
#define USART_INTERRUPT_LEVEL           5


//* Standard Asynchronous Mode : 8 bits , 1 stop , no parity
#define AT91C_US_ASYNC_MODE ( AT91C_US_USMODE_NORMAL + \ 
                        AT91C_US_NBSTOP_1_BIT + \ 
                        AT91C_US_PAR_NONE + \ 
                        AT91C_US_CHRL_8_BITS + \ 
                        AT91C_US_CLKS_CLOCK )

extern char display_data[30]= &amp;quot;new usart 0 \r\n&amp;quot;;
extern void senddata_US0(char *);

void usart0_isr (void)
{
        unsigned int status_reg;
        status_reg = AT91C_BASE_US0-&amp;gt;US_CSR;

        if ( status_reg &amp;amp; AT91C_US_RXRDY)
        {
                //* Get byte and send
                AT91F_US_PutChar (AT91C_BASE_US0, AT91F_US_GetChar(AT91C_BASE_US0));
        }

        if ( status_reg &amp;amp; AT91C_US_OVRE) {
                //* clear US_RXRDY
                 AT91F_US_GetChar(AT91C_BASE_US0);
                 AT91F_US_PutChar (AT91C_BASE_US0, &amp;#39;O&amp;#39;);
        }

        //* Check error
        if ( status_reg &amp;amp; AT91C_US_PARE) {
                 AT91F_US_PutChar (AT91C_BASE_US0, &amp;#39;P&amp;#39;);
        }

        if ( status_reg &amp;amp; AT91C_US_FRAME) {
                 AT91F_US_PutChar (AT91C_BASE_US0, &amp;#39;F&amp;#39;);
        }

        if ( status_reg &amp;amp; AT91C_US_TIMEOUT){
                AT91C_BASE_US0-&amp;gt;US_CR = AT91C_US_STTTO;
                 AT91F_US_PutChar (AT91C_BASE_US0, &amp;#39;T&amp;#39;);
        }

        AT91C_BASE_AIC-&amp;gt;AIC_EOICR = AT91C_BASE_US0-&amp;gt;US_CSR;      //  Interrupt Ack
        AT91C_BASE_AIC-&amp;gt;AIC_ICCR  = (1 &amp;lt;&amp;lt; AT91C_ID_US0);        //  Interrupt Ack

        *AT91C_AIC_EOICR = 0;                                   // End of Interrupt

        //* Reset the satus bit
         AT91C_BASE_US0-&amp;gt;US_CR = AT91C_US_RSTSTA;


}


void serial_Usart0_init(void)
{
        AT91PS_USART COM0 = AT91C_BASE_US0;

        //* Configure PIO controllers to periph mode
        AT91C_BASE_PIOA-&amp;gt;PIO_ASR = (((unsigned int) AT91C_PA5_RXD0 ) |((unsigned int) AT91C_PA6_TXD0));
        AT91C_BASE_PIOA-&amp;gt;PIO_BSR = 0;
        AT91C_BASE_PIOA-&amp;gt;PIO_PDR = ((((unsigned int) AT91C_PA5_RXD0 ) |((unsigned int) AT91C_PA6_TXD0)) | 0); // Set in Periph mode

        //* First, enable the clock of the USART
        AT91C_BASE_PMC-&amp;gt;PMC_PCER = (1 &amp;lt;&amp;lt; AT91C_ID_US0);

        //* Usart Configure
        AT91F_US_Configure (AT91C_BASE_US0, AT91B_MCK, AT91C_US_ASYNC_MODE, AT91_BAUD_RATE, 0);

        //* Enable usart
        COM0-&amp;gt;US_CR = AT91C_US_RXEN | AT91C_US_TXEN;

        //* Enable USART IT error and RXRDY
        AT91F_US_EnableIt(COM0, AT91C_US_TIMEOUT |
                                AT91C_US_FRAME   |
                                AT91C_US_OVRE    |
                                AT91C_US_RXRDY);
        // open Usart 1 interrupt
        AT91F_AIC_ConfigureIt ( AT91C_BASE_AIC, AT91C_ID_US0, USART_INTERRUPT_LEVEL,AT91C_AIC_SRCTYPE_HIGH_LEVEL,usart0_isr );
        AT91F_AIC_EnableIt (AT91C_BASE_AIC, AT91C_ID_US0);


        while(1)
        {
        senddata_US0(display_data);

        delay(50);

        }
}
&lt;/pre&gt;

&lt;p&gt;
Please advise me on this..&lt;br /&gt;
with regards,&lt;br /&gt;
Murthy.R&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/154979?ContentTypeID=1</link><pubDate>Thu, 27 Sep 2007 06:13:12 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:e6aef885-5f7f-4799-80a8-f5d3469cc9ac</guid><dc:creator>Martin G&amp;#195;&amp;#188;nther</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hello Murthy,&lt;/p&gt;

&lt;p&gt;
You are right. I should have enabled peripheral clock for PIOA but
it worked on my board so I did not check the code twice.&lt;br /&gt;
I do not know why the LED works although the peripheral clock was not
enabled.&lt;/p&gt;

&lt;p&gt;
Best regards,&lt;br /&gt;
Martin&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/148649?ContentTypeID=1</link><pubDate>Thu, 27 Sep 2007 03:35:29 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:30cefd53-e453-4870-859e-afc8da3afb8f</guid><dc:creator>Murthy r</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi Martin,&lt;/p&gt;

&lt;p&gt;
i am not getting anyhing..just blank Message.&lt;/p&gt;

&lt;p&gt;
with regards&lt;br /&gt;
Murthy.R&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/148539?ContentTypeID=1</link><pubDate>Thu, 27 Sep 2007 00:05:53 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f9c37b1f-cc0c-4a77-bd16-93f647c3c795</guid><dc:creator>Murthy r</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi Martin,&lt;/p&gt;

&lt;p&gt;
Lot of thanks for your example code.&lt;/p&gt;

&lt;p&gt;
I have checked the code in the blinky project,the timer interrupt
is working.&lt;/p&gt;

&lt;p&gt;
I have one doubt,&lt;/p&gt;

&lt;p&gt;
In your code you did&amp;#39;t enable the Peripheral Clock for PIOA, But
you are using the PIOA for LED.&lt;/p&gt;

&lt;p&gt;
Q1.Without Enable the Peripheral Clock for PIOA how it is
working?&lt;/p&gt;

&lt;p&gt;
Please advise me on this.&lt;/p&gt;

&lt;p&gt;
With regards&amp;amp;Thanks&lt;br /&gt;
Murthy.R&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/148355?ContentTypeID=1</link><pubDate>Wed, 26 Sep 2007 06:03:46 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:467fa3ba-8887-47d3-a093-26603bd573e5</guid><dc:creator>Martin G&amp;#195;&amp;#188;nther</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hello Murthy,&lt;/p&gt;

&lt;p&gt;
I do not know which patch file you mean.&lt;/p&gt;

&lt;p&gt;
Take the example
&lt;i&gt;C:\Keil\ARM\Boards\Atmel\AT91SAM7SE-EK\Blinky&lt;/i&gt; and replace
&lt;i&gt;Blinky.c&lt;/i&gt;&lt;br /&gt;
with the following code and you have a Timer0 interrupt which ticks
every 10ms.&lt;/p&gt;

&lt;pre&gt;
#include &amp;lt;AT91SAM7SE512.H&amp;gt;              // AT91SAM7SE512 definitions
#include &amp;lt;lib_AT91SAM7SE512.h&amp;gt;          // AT91SAM7SE512 library functions
#include &amp;quot;../AT91SAM7SE-EK.h&amp;quot;           // AT91SAM7SE-EK board definitions

unsigned int led = 0;

// Timer0 ISR
void tim0_isr (void) __irq {
static int msCnt = 0;

  if (msCnt++ &amp;gt; 10) {                                     // switch LED every 100ms
    msCnt = 0;
    if ((led ^=1) == 0)
      AT91F_PIO_ClearOutput(AT91C_BASE_PIOA, AT91B_LED1); // LED on
    else
      AT91F_PIO_SetOutput  (AT91C_BASE_PIOA, AT91B_LED1); // LED off
    }

  AT91C_BASE_AIC-&amp;gt;AIC_EOICR = AT91C_BASE_TC0-&amp;gt;TC_SR;      //  Interrupt Ack
  AT91C_BASE_AIC-&amp;gt;AIC_ICCR  = (1 &amp;lt;&amp;lt; AT91C_ID_TC0);        //  Interrupt Ack

  *AT91C_AIC_EOICR = 0;                                   // End of Interrupt
}

// Main Program
int main (void) {

  AT91F_PMC_EnablePeriphClock(AT91C_BASE_PMC, 1 &amp;lt;&amp;lt; AT91C_ID_PIOB); // Enable Clock for PIO
  AT91F_PIO_CfgOutput(AT91C_BASE_PIOA, AT91B_LED_MASK);            // PIO for LEDs as Output
  AT91F_PIO_SetOutput(AT91C_BASE_PIOA, AT91B_LED_MASK);            // turn off LEDs

  AT91F_PMC_EnablePeriphClock(AT91C_BASE_PMC, 1 &amp;lt;&amp;lt; AT91C_ID_TC0);  // Enable Clock for TIM0
  AT91C_BASE_TC0-&amp;gt;TC_CCR    = AT91C_TC_CLKEN | AT91C_TC_SWTRG;
  AT91C_BASE_TC0-&amp;gt;TC_CMR    = 2 | AT91C_TC_CPCTRG;
  AT91C_BASE_TC0-&amp;gt;TC_RC     = 14975;                                        // period is 10ms
  AT91C_BASE_TC0-&amp;gt;TC_IER    = AT91C_TC_CPCS;

  // TIM0 Interrupt: Mode and Vector with Lowest Priority and Enable */
  AT91C_BASE_AIC-&amp;gt;AIC_SMR[AT91C_ID_TC0] = AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE | AT91C_AIC_PRIOR_HIGHEST;
  AT91C_BASE_AIC-&amp;gt;AIC_SVR[AT91C_ID_TC0] = (unsigned long) tim0_isr;
  AT91C_BASE_AIC-&amp;gt;AIC_IECR = (1 &amp;lt;&amp;lt; AT91C_ID_TC0);

  while (1);                                                       // Loop forever
}
&lt;/pre&gt;

&lt;p&gt;
Best Regards,&lt;br /&gt;
Martin&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/148012?ContentTypeID=1</link><pubDate>Wed, 26 Sep 2007 01:43:37 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:57b53ef9-b84b-4369-868d-661e216cf5a9</guid><dc:creator>Murthy r</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi Martin,&lt;br /&gt;
i have checked the PMC for timer,that is enabled.&lt;/p&gt;

&lt;p&gt;
I have a startup code &amp;quot;SAM7.s&amp;quot;&lt;br /&gt;
In this file some configuration settings are there.&lt;/p&gt;

&lt;p&gt;
Q1.Do i have to make any changes on this STACK settings?&lt;/p&gt;

&lt;p&gt;
I have installed the KEIL in &amp;quot;C:/KEIL&amp;quot;folder.&lt;br /&gt;
and also installed the patch file in the same folder.&lt;/p&gt;

&lt;p&gt;
Q2.Is this installation procedure correct?&lt;/p&gt;

&lt;p&gt;
Please advise me on this.&lt;/p&gt;

&lt;p&gt;
with regards,&lt;br /&gt;
Murthy.R&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/147364?ContentTypeID=1</link><pubDate>Thu, 20 Sep 2007 05:59:30 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0f8d17f1-ce64-416b-be58-f3bde38c2d17</guid><dc:creator>Martin G&amp;#195;&amp;#188;nther</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hello Murthy,&lt;/p&gt;

&lt;p&gt;
I think you do not need the IRQ0.s file for you Timer
Interrupt.&lt;br /&gt;
Is the peripheral clock for the timer enabled?&lt;br /&gt;
Check PMC_PCER register (see AT91SAM7SE512 user manuel chapter &amp;quot;Power
Management Controller (PMC) User Interface&amp;quot;).&lt;/p&gt;

&lt;p&gt;
You wrote that the timer interrupt occurs only once. That means,
that the interrupt is not acknowledged anyhow.&lt;/p&gt;

&lt;p&gt;
Please check your interrupt service routine that the following
things are done:&lt;br /&gt;
- clear interrupt in AIC Interrupt Clear command register&lt;br /&gt;
- read Timer Status register (clearing interrupt reason)&lt;br /&gt;
- acknowledge interrupt by writing to AIC End of Interrupt Command
Register&lt;/p&gt;

&lt;p&gt;
Best Regards,&lt;br /&gt;
Martin&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/146122?ContentTypeID=1</link><pubDate>Wed, 19 Sep 2007 22:43:28 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:861d6ba4-5f5e-4544-8ade-6383e0177f12</guid><dc:creator>Murthy r</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi Martin,&lt;/p&gt;

&lt;p&gt;
Thanks for your suggestion.&lt;/p&gt;

&lt;p&gt;
I have tested the timer in polling mode.&lt;br /&gt;
without enable the interrupt and checked.&lt;br /&gt;
The TC Status register the compare flag is set.&lt;br /&gt;
The clock for the Timer enabled and working.&lt;/p&gt;

&lt;p&gt;
I have one doubt&lt;br /&gt;
&amp;quot;should i include any IRQ0.s files in my project?&amp;quot;&lt;/p&gt;

&lt;p&gt;
If necessary means please give me the downloaded links.&lt;/p&gt;

&lt;p&gt;
Please advise me on this.&lt;/p&gt;

&lt;p&gt;
with regards,&lt;br /&gt;
Murthy.R&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/144294?ContentTypeID=1</link><pubDate>Wed, 19 Sep 2007 02:11:56 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3486606d-e500-45cd-8167-605186aa1faf</guid><dc:creator>Martin G&amp;#195;&amp;#188;nther</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hello Murthy,&lt;/p&gt;

&lt;p&gt;
I have no idea what is going wrong.&lt;/p&gt;

&lt;p&gt;
Did you test the timer in polling mode?&lt;br /&gt;
Do not enable the interrupt and check the TC Status register in a
loop to see whether the compare flag is set.&lt;br /&gt;
Is the clock for the Timer enabled and working?&lt;br /&gt;
Check the CLKSTA bit in the TC Status register.&lt;br /&gt;
Maybe it is a good idea to check the ATMEL website to see if there is
an example for a timer using interrupts.&lt;/p&gt;

&lt;p&gt;
Best Regards,&lt;br /&gt;
Martin&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/141869?ContentTypeID=1</link><pubDate>Tue, 18 Sep 2007 08:05:00 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:29b18fb7-bcdb-42b0-addb-1cdda6006aba</guid><dc:creator>Murthy r</dc:creator><description>&lt;p&gt;&lt;p&gt;
HI Martin,&lt;br /&gt;
I have tried this volatile also the result is same.&lt;br /&gt;
here by i have enclosed the initialization code.&lt;br /&gt;
Is there any wrong please check and advise me.&lt;/p&gt;

&lt;pre&gt;
void timer_init ( void )
{
AT91F_TC_Open(AT91C_BASE_TC0,TC_CLKS_MCK1024,AT91C_ID_TC0);

AT91F_AIC_ConfigureIt ( AT91C_BASE_AIC,
                                AT91C_ID_TC0,
                                TIMER0_INTERRUPT_LEVEL,
                                AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL,
                                timer0_c_irq_handler);

     AT91C_BASE_TC0-&amp;gt;TC_IER = AT91C_TC_CPCS;
     AT91F_AIC_EnableIt (AT91C_BASE_AIC, AT91C_ID_TC0);


     AT91C_BASE_TC0-&amp;gt;TC_CCR = AT91C_TC_SWTRG ;


}
&lt;/pre&gt;

&lt;p&gt;
With regards,&lt;br /&gt;
Murthy.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/138551?ContentTypeID=1</link><pubDate>Tue, 18 Sep 2007 07:17:45 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:40ef5dc5-9625-4600-aa48-eceab4f393ed</guid><dc:creator>Martin G&amp;#195;&amp;#188;nther</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hello Nanju Murthy,&lt;/p&gt;

&lt;p&gt;
Please use the keyword &lt;i&gt;volatile&lt;/i&gt; for the definition of your
dummy variable.&lt;/p&gt;

&lt;pre&gt;
 volatile unsigned int dummy;
 dummy = TC_pt-&amp;gt;TC_SR;
 dummy = dummy;
&lt;/pre&gt;

&lt;p&gt;
&lt;i&gt;volatile&lt;/i&gt; tells the compiler that the varible can be
modified externally to the implementation.&lt;/p&gt;

&lt;p&gt;
Best Regards,&lt;br /&gt;
Martin&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/149284?ContentTypeID=1</link><pubDate>Tue, 18 Sep 2007 05:30:55 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:96dc346f-a8f5-434f-a7e9-1838cc0b1891</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Is that how you actually write your code?&lt;/p&gt;

&lt;p&gt;
Do you find it clear and easy to read?&lt;/p&gt;

&lt;p&gt;
Most people find it helps to use indentation and whitespace to
lay-out their code for easier reading; eg,&lt;/p&gt;

&lt;pre&gt;
void timer0_c_irq_handler(void)
{
   AT91PS_TC    TC_pt = AT91C_BASE_TC0;
   unsigned int dummy;

   dummy = TC_pt-&amp;gt;TC_SR;
   dummy = dummy;

   if( ( AT91F_PIO_GetInput(AT91D_BASE_PIO_LED) &amp;amp; AT91B_LED1 )
       == AT91B_LED1 )
   {
      AT91F_PIO_ClearOutput( AT91D_BASE_PIO_LED, AT91B_LED1|AT91B_LED2 );
   }
   else
   {
      AT91F_PIO_SetOutput( AT91D_BASE_PIO_LED, AT91B_LED1|AT91B_LED2 );
   }

   AT91F_AIC_AcknowledgeIt( AT91C_BASE_AIC );
}
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
Doing complex operations inside the &amp;#39;if&amp;#39; like that doesn&amp;#39;t help
readability, and making a separate assignment is unlikely to affect
performance...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/130201?ContentTypeID=1</link><pubDate>Tue, 18 Sep 2007 04:02:50 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:af553bf4-8f5f-4552-9dc6-82cf7039e8ae</guid><dc:creator>Murthy r</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi Martin,&lt;/p&gt;

&lt;p&gt;
This is what i did in the code&lt;/p&gt;

&lt;pre&gt;
void timer0_c_irq_handler(void)
{
AT91PS_TC TC_pt = AT91C_BASE_TC0;
 unsigned int dummy;
 dummy = TC_pt-&amp;gt;TC_SR;
 dummy = dummy;
if ( (AT91F_PIO_GetInput(AT91D_BASE_PIO_LED) &amp;amp; AT91B_LED1 ) == AT91B_LED1 )
{
 AT91F_PIO_ClearOutput( AT91D_BASE_PIO_LED, AT91B_LED1|AT91B_LED2 );
}
else
{
AT91F_PIO_SetOutput( AT91D_BASE_PIO_LED, AT91B_LED1|AT91B_LED2 );
}

AT91F_AIC_AcknowledgeIt (AT91C_BASE_AIC);
}

&lt;/pre&gt;

&lt;p&gt;
With regards,&lt;br /&gt;
Murthy.R&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Urgent: Problem in Timer interrupt program using AT91SAM7SE512-EK]</title><link>https://community.arm.com/thread/148831?ContentTypeID=1</link><pubDate>Tue, 18 Sep 2007 03:27:58 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0fc63734-1ef9-4926-ac8d-61b3bf29f790</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;I think you have commented out this line in your ISR.&lt;br /&gt;
--&amp;gt; //* AcknowAT91B_LEDge interrupt status dummy =
TC_pt-&amp;gt;TC_SR;&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
I think that&amp;#39;s just a result of his failure to read the
instructions on posting source code...&lt;/p&gt;

&lt;p&gt;
&lt;a href="http://www.danlhenry.com/caps/keil_code.png"&gt;www.danlhenry.com/.../keil_code.png&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
See: &lt;a href="http://www.keil.com/forum/docs/thread10699.asp"&gt;http://www.keil.com/forum/docs/thread10699.asp&lt;/a&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>