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: SAM9XE512 - can not return after ISR executed
PostPosted: Mon May 07, 2012 3:47 am 
Offline

Joined: Mon May 07, 2012 3:31 am
Posts: 3
Hi, I am a new user in this forum.
Now I am programming on a SAM9XE512 by using Keil uvision4. I wrote a program which adopts DBGU as UART communication channel and performed as an ISR. Besides, I use the "SAM9XE.s" and .sct generated by uvision4 instead of the files included in ATEML softpack.

Every time a char is received by DBUG, it will trigger a System Controller interrupt, and then I will compare the DBGU-IMR & DBGU_CSR to confirm the interrupt is issued by DBGU. After that, a get/put char routine will be performed until an "Enter" is pressed by the user. The codes bellow, are at the end of ISR,
AT91C_BASE_AIC->AIC_ICCR = 1 << AT91C_ID_SYS;
AT91C_BASE_AIC->AIC_EOICR = 1;

However, the ISR can be execute once; after the user pressed "Enter", the system is halt. Means I can not get the program return to normal operation after the ISR is carried out.

Could you figure out where may the error occur?
Thanks!!

John


Top
 Profile  
 
 Post subject: Re: SAM9XE512 - can not return after ISR executed
PostPosted: Mon May 07, 2012 12:41 pm 
Offline

Joined: Fri Mar 09, 2012 1:34 pm
Posts: 68
Hi!
Remember to read out the status register of DBGU to clear the interrupt, e.g:
AT91_REG DBGU_Status = AT91C_BASE_DBGU->DBGU_CSR

Change the last lines to:
// AT91C_BASE_AIC->AIC_ICCR = 1 << AT91C_ID_SYS;
AT91C_BASE_AIC->AIC_EOICR = 0;

Hope, this helps

_________________
Best regards
Przemyslaw Baranski


Top
 Profile  
 
 Post subject: Re: SAM9XE512 - can not return after ISR executed
PostPosted: Fri May 11, 2012 5:40 am 
Offline

Joined: Mon May 07, 2012 3:31 am
Posts: 3
Hi
Thanks for your kindly suggestion. The problem has been resolved.
I have modified the ISR as your suggestion, besides, the major problem is in the SAM9XE.s generated by Keil.
In that file, the code bellow is used for IRQ vector, which points to AIC_IVR for the entry point of ISR.
LDR PC, [PC,#-0xF20]
But I didn't write the code for handling the pointer stacks in the ISR. Therefore, after ISR has been excuted, the PC jumps to an address with invalid instruction. I modified the code as,
LDR PC, IRQ_Addr
and also added a irqHandler in that .s file for handling the pointer stack.
Then the problem has gone.

John


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: No registered users and 1 guest


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: