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: SAM7S256 PIT Interrupt
PostPosted: Wed Aug 18, 2010 11:25 pm 
Offline

Joined: Wed Aug 18, 2010 11:12 pm
Posts: 21
Hello,
I am having a hard time getting the PIT to work on my SAM7S256. I want it to tick every 100µs.
PIT_PERIOD is defined to 100.
It compiles fine.
The toggleIO Function works.

But there is nothing toggeling on BIT31.

Hope you can help me out.

Thanks

Code:
void ISR_PIT(void){
    toggleIO(AT91C_BASE_PIOA, BIT31);
    AT91F_PIO_ClearOutput(AT91C_BASE_PIOA, (1<<17)); //LED is low active
    int dummy =  AT91F_PITGetPIVR(AT91C_BASE_PITC);
    dummy = dummy;
    AT91F_AIC_AcknowledgeIt(AT91C_BASE_AIC);
}

int main(){
/**** Periodic Interval Timer - Interrupt every 100µs ****/


        AT91F_PITInit(AT91C_BASE_PITC, PIT_PERIOD, 48); //100 uSek, 48Mhz

        // Configure interrupt on PIT
        AT91F_AIC_DisableIt(AT91C_BASE_AIC, AT91C_ID_SYS);
        AT91F_AIC_ConfigureIt(AT91C_BASE_AIC, AT91C_ID_SYS, PIT_INT_LEVEL, AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, ISR_PIT);
        AT91F_PITC_CfgPMC();
        AT91F_AIC_EnableIt(AT91C_BASE_AIC, AT91C_ID_SYS);

        AT91F_PITEnableInt(AT91C_BASE_PITC);

return 0;
}


Top
 Profile  
 
 Post subject: Re: SAM7S256 PIT Interrupt
PostPosted: Thu Aug 19, 2010 5:23 pm 
Offline

Joined: Thu Feb 25, 2010 5:02 pm
Posts: 88
Hello -

In your main() it looks like your program ends after initializing the PIT. Did you forget to add a loop?

AT91F_PITEnableInt(AT91C_BASE_PITC);
while(1) {
;
}

return 0;

Regards,

_________________
Duane P. Fridley, IEEE CSDP
Viable Bytes, Inc.


Top
 Profile  
 
 Post subject: Re: SAM7S256 PIT Interrupt
PostPosted: Thu Aug 19, 2010 9:32 pm 
Offline

Joined: Wed Aug 18, 2010 11:12 pm
Posts: 21
No, its there. I just forgot to past it here. Sorry.

I have read, that my interrupt vector needs to be set to
Code:
ldr pc[pc,#-0xF20]
.

I am not sure where to put this information.
I use the OpenOCD Tool to flash the SAM7.
In my project I use some start upcode in Assembler, that was given in an example.
I wasn't to sure what this code was all about, so I just copied it.
Do I have to add this IRQ Vector somewhere in the Startup Code?

I tried the USART Receive Interrupt, too. It did not work as well.

Thanks for your reply.

Regards.


Top
 Profile  
 
 Post subject: Re: SAM7S256 PIT Interrupt
PostPosted: Fri Aug 20, 2010 2:39 pm 
Offline

Joined: Thu Feb 25, 2010 5:02 pm
Posts: 88
Quote:
In my project I use some start upcode in Assembler, that was given in an example.

I'm not sure what startup code you are using. Did this come from the Atmel software package?

If not, you might want to start with the getting-started-project located in the AT91 software package or at least compare it to what you are using. (see http://www.atmel.com/dyn/resources/prod_documents/at91sam7s-ek.zip)

There are two files you should use or look at:
- board_cstartup*.s
- board_lowlevel.c

Regards,

_________________
Duane P. Fridley, IEEE CSDP
Viable Bytes, Inc.


Top
 Profile  
 
 Post subject: Re: SAM7S256 PIT Interrupt
PostPosted: Sat Aug 21, 2010 12:55 am 
Offline

Joined: Wed Aug 18, 2010 11:12 pm
Posts: 21
I have compared the files.
I am not using the SAM7-EK. Therefore I use the startup-code given to my board.
It is written in assembler only. The IRQ Part is exactly the same. Also the low level init, that I am using is the same too. (Except for the "map to RAM" part).

Maybe I should try to use the "getting-started-project" to build my own project.
On the first glance it looks like a good starting point for a project.
The interrupt initialization in my first post is right?


Top
 Profile  
 
 Post subject: Re: SAM7S256 PIT Interrupt
PostPosted: Sat Aug 21, 2010 1:42 am 
Offline

Joined: Wed Aug 18, 2010 11:12 pm
Posts: 21
So I have adapted the getting started project for my board and with the given interrupt definition.
But it is still not working.
Now I compile with the SAM7-EK makefile and the startup code given with the EK.

Any other ideas?
That's real frustrating.


Top
 Profile  
 
 Post subject: Re: SAM7S256 PIT Interrupt
PostPosted: Sat Aug 21, 2010 2:08 am 
Offline

Joined: Wed Aug 18, 2010 11:12 pm
Posts: 21
Hello,
now it entered the ISR once.
The image was on the SRAM and it entered the ISR after a cpu reset initialized from OpenOCD.
But I am not able to replicate it?

Thats strange...


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