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  [ 7 posts ] 
Author Message
 Post subject: AT91SAM7X software interrupt for PIT
PostPosted: Fri Jul 10, 2009 8:33 pm 
Offline

Joined: Fri Jul 10, 2009 8:16 pm
Posts: 15
Device: AT91SAM7X256-EK
Problematic peripheral: PIT (Periodic Interval Timer)

I'm trying to set an interrupt that will execute an handler when CPIV (in PIT_PIIR register) reach PIV (in PIT_MR register).

The interrupt executes as expected, but that happens only once. The interrupt isn't executed more than once.

I enabled & configured the interrupt in AIC for SYSC (System Controller). Afterwards I initialized PIT and enabled interrupt for it.

I have no idea what to do...
I read the datasheet and couldn't figure out what's wrong.

Someone have any idea...?

Thanks in advance.

Best regards,
Dor.


Top
 Profile  
 
 Post subject: Re: AT91SAM7X software interrupt for PIT
PostPosted: Sat Jul 11, 2009 8:09 am 
Offline

Joined: Thu Dec 02, 2004 2:28 pm
Posts: 454
hello,
does your software acknowledge the interrupt like this:
Code:
dwStatus = AT91C_BASE_PITC->PITC_PIVR;


regards
gerhard


Top
 Profile  
 
 Post subject: Re: AT91SAM7X software interrupt for PIT
PostPosted: Tue Jul 14, 2009 8:02 am 
Offline

Joined: Fri Jul 10, 2009 8:16 pm
Posts: 15
Hi gerhardf,

Yes, but now after I tried several ways I almost made it:

The interrupt works infinitely (which is what I tried to do, at least for now) but it seems that there is no interval between each interrupt, even though I set PIV to be 0xFFFFF (top value).

I'm using an about 18 MHZ oscillator.

Thus the interval must take about 0.91 sec to be executed again (when PIV=0xfffff).

I'm using the user interface (Leds) to indicate the proper work of PIT.

So in my case, the interrupts take ALL CPU time, while the rest of the program isn't being executed.


I think that maybe I didn't quite understand how to configure the interrupt to work well.
A working example would be much appreciated! If it's not possible, a list of action that I need to do would help as well.

Additional 2 questions:

  1. Should I define a handler as such:
    Code:
    __irq void interrupt_handler_name_here() { /*...*/ }

    ?
    I think that my develop environment (and compiler...) is RealView. I'm using EDGE as IDE.
  2. What action should I execute in the interrupt's handler function?
    As you said, I must read PITC_PIVR. That's all?

Sorry for all these questions, I'm new at this.

Thanks :)

Regards,
Dor.


Top
 Profile  
 
 Post subject: Re: AT91SAM7X software interrupt for PIT
PostPosted: Tue Jul 14, 2009 9:52 am 
Offline

Joined: Thu Dec 02, 2004 2:28 pm
Posts: 454
hello,
attached you can find one of the older atmel-examples for the pit.
It's using iar workbench, but should be portable to keil/arm.

regards
gerhard


Attachments:
AT91SAM7S64-PeriodicIntervalTimer-IAR4_30A-1_21.zip [354.89 KiB]
Downloaded 178 times
Top
 Profile  
 
 Post subject: Re: AT91SAM7X software interrupt for PIT
PostPosted: Tue Jul 14, 2009 3:54 pm 
Offline

Joined: Fri Jul 10, 2009 8:16 pm
Posts: 15
I saw the code and will be able to try it tomorrow.

Is the debug (called "DBGU") essential for the PIT to work?


Top
 Profile  
 
 Post subject: Re: AT91SAM7X software interrupt for PIT
PostPosted: Wed Jul 15, 2009 2:28 pm 
Offline

Joined: Thu Dec 02, 2004 2:28 pm
Posts: 454
neo444 wrote:
Is the debug (called "DBGU") essential for the PIT to work?

no!


Top
 Profile  
 
 Post subject: Re: AT91SAM7X software interrupt for PIT
PostPosted: Thu Jul 16, 2009 10:42 pm 
Offline

Joined: Fri Jul 10, 2009 8:16 pm
Posts: 15
It works :)

I also cleared the interrupt before it was called, and read the PIVR register.

In addition, I prefixed the handler function with "__irq" as such:

Code:
__irq void handler_name(void) { ... }


And changed the Master clock to be the oscillator clock (instead of the PLL clock which was the initial configuration)

Thanks :)


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

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 2 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: