Arm7 Timer0 interrupt only works perfectly within the simulation

0

I am trying to get the OSEK-Alarm mechanism to run on an arm7 (lpc2292). When simulating my Demo application withing the uVision5 IDE everything works fine. But executing the code on the target plattform it seems like the Interrupt only occures once. Unfortunately I cant attach a serial interface to that plattform for debugging...

This function gets called from a toplevel Interrupthandler as I need to embed this functionality within context switching assembly code. As it can be seen the interruptflag will be reset on every Timer Interrupt which is configured to trigger on counter match with match Register 0;

void handleNonVectoredInterrupt()
{
  UINT32 src = VICRawIntr;
  if(src & ( 1 << TIMER0 ) ) 
  { 
    if( T0IR & 1 )              
    { 
      tickCounter(&systemCounter);    
      T0IR = 1;
    }
  }
}

As I said this code works perfectly within the simulation which confuses me even more. This is my Code how I initialize the counter as well as the Interrupts:

enabling the Interrupt in the VIC:

VICIntEnable |= (1 << TIMER0);

Setting up the counter:

void initializeHardwareCounter(UINT32 ticktime_ns)       // ticktime 10^6 ns
{
  T0PR    = (SYS_CLOCK / (2 * ticktime_ns / 1000)) - 1;  // SysClk = 36MHz 
  T0MCR  |= (1 << 0) | (1 << 1);                         // Match MR0 and reset
  T0TC    = 0xFFFFFFFF;                                  // reset counter  
  T0TCR  |= (1 << 0);                                    // enable as counter
  T0MR0   = 0;                                           // match value
}

Has anybody experienced similar behaviour and has any idea where I can expect the issue?

Thanks in advance

c
timer
interrupt
arm7
asked on Stack Overflow Jun 17, 2020 by UltraGeralt • edited Jun 18, 2020 by UltraGeralt

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0