Measure Pulse Width

basically miscellaneous, if it doesn't fit another sub-forum enter it here, we might even promote it to its own sub-forum
danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: Measure Pulse Width

Post by danlee58 »

I have:

T1_PR = 0; //Set Prescale Register so TC will increment at the full clock rate
T1_CTCR = 0; //Set Timer Mode
T1_CCR = 0x38; //Set Capture Control Register1 for falling or rising edge and generate Interrupt.
T1_TCR = 2; //Reset Timer 1
T1_TCR = 1; //Enable Timer1

VICVectCntl0 = 0xf808f800; //Sets Timer1 Interrupt to the highest Priority
VICIntEnable = 0x00000004; //Enable Timer1 Interrupts

I don't get any interrupts.



danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: Measure Pulse Width

Post by danlee58 »

I found a problem with the PINSEL. Now I do get an Interrupt, with the following message.

FaultISR 0xFFFFFFF1 SCB->CFSR=0x00020000

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: Measure Pulse Width

Post by basicchip »

That is probably the default IRQ

Have you named your interrupt handler TIMER1_IRQHandler? Which points to the default handler in startup_cortex.S. But if your handler uses that name it takes precedence over the WEAK declaration there. In BASIC we copy that table into RAM and patch the vectors that way.

You usually don't need to change priorities.

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: Measure Pulse Width

Post by danlee58 »

I already have a file named TIMER1_IRQHandler.c. That's for another application.

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: Measure Pulse Width

Post by basicchip »

The interrupt subroutine MUST be named that, or you have to patch the IRQ table to use your interrupt subroutine.

As you got the FaultISR .... message, an interrupt actually occurred it just went to the default handler and not yours.

SO if you rename your fault handler to TIMER1_IRQHandler, the linker will use yours and you can proceed. It is much better to leave the startup_cortex.S alone rather than make a mistake there and break lots of things. That is the design of the WEAK declaration in gcc so there can be a place holder IRQ handler that will be overlaid with the user one.

Post Reply