|
The timer appears to be running but I'm not getting any interrupts.
My hardware is very simple, I'm using a AT91SAM7X256 with an external 16Mhz Oscillator supplying the clock. I want the PLL bypassed so the core is only running at 16Mhz. I have 4 LEDS on PortB0-4 which are working fine. My build is strictly running in flash.
I'm using Rowley Crossworks and a Seggar J-Link. Adaptive Clocking:Yes Speed:2000khz After much futzing about boot and JTAG appear very stable. Relevant Start Script Bits (mimicked in Start Up Code); CKGR_MOR_VAL = 0x000FF002; CKGR_MCKR_VAL1 = 0x00000000; CKGR_MCKR_VAL2 = 0x00000001; TargetInterface.pokeWord(0xFFFFFC20, CKGR_MOR_VAL); TargetInterface.pokeWord(0xFFFFFC30, CKGR_MCKR_VAL1); TargetInterface.pokeWord(0xFFFFFC30, CKGR_MCKR_VAL2);
Relevant ISR stubs; (Don't laugh... this code works on many different platforms that's why its this way.) I am not doing anything else with the System interrupt. AIC_SVR1 = (unsigned int)SYS ; void SYS (void){Interrupt.ISR[INTERRUPT_VECTOR_SYS]();}
Timer Code: #ifdef PIT_TIMER // now bring up the hardware // NOTE that we're using the Core Timer that runs off CCLK DOS_Interrupt_Post(INTERRUPT_VECTOR_SYS,DOS_Timer_Interrupt);
// Enable the System Interrupt // We will need a more comprehensive system, interrupt // handler in the future AIC_IDCR = 0x00000002 ; // Disable SYS interrupt // AIC_SMR1 = 0x00000020; // system interrupt lowest priority negedge triggered AIC_SMR1 = 0x00000060; // system interrupt lowest priority posedge triggered // AIC_SMR1 = 0x00000000; // system interrupt lowest priority LowLevel triggered // AIC_SMR1 = 0x00000040; // system interrupt lowest priority HighLevel triggered
// Assume we're running with a 16Mhz/16 = 1Mhz clock = 1us // so 100us is 100 ticks PIT_MR = PIT_MR_PITEN|PIT_MR_PITIEN|100; AIC_ICCR = 0x00000002 ; AIC_IECR = 0x00000002 ; // enable system interrupt Timer.Status = PIT_PIVR ; // resets the timer and sets aside the status. #endif
void DOS_Timer_Interrupt( void ) { #ifdef PIT_TIMER // Timer.Status = PIT_PIVR ; // resets the timer and sets aside the status. AIC_EOICR = PIT_PIVR ; // clear the interrupt #endif DOS_Event_Handler_Post_Int(DOS_Timer_Interrupt_Handler, 0 ) ; Timer.Ticks++ ; }
After a while of running heres what I see in what I think are the relavent registers; PIT_MR 0x03000064 PIT_SR 0x00000001 PIT_PIVR 0xfdd0000e PIT_PIIR 0xfdd0000e
AIC_SMR1 0x000000020 // Prior 0, SRC 1 (Anyone else notice this is different from above? AIC_IPR 0x000000002 AIC_IMR 0x000000002
My main loop (main context) is running with the following CPSR: CPSR 0x600000df
Can anyone help with this?
|