This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Why doesn't my TIMER1 ISR work?

I am trying to use TIMER1, but it seems that my ISR isn't being linked in during the build.

uint32_t timer1_init(void)
{
   ...
   NVIC_SetPriority(TIMER1_IRQn, APP_IRQ_PRIORITY_LOW);	
   NVIC_ClearPendingIRQ(TIMER1_IRQn);
   NVIC_EnableIRQ(TIMER1_IRQn);		
   ...
   NRF_TIMER1->TASKS_START = 1;
   ...
}

void timer1_schedule(timer1_id_t id, uint16_t ticks)
{
    ...
    NRF_TIMER1->CC[..] = ticks;
    NRF_TIMER1->INTENSET = ..;
    ...
}

void Timer1_IRQHandler(void)
{
    ...
   // cannot set a breakpoint in here.
   // code not linked in?
  ...
}

Is there something else I need to do to declare an ISR?

Parents
  • You need to name the ISR correctly. It's TIMER1_IRQHandler, not Timer1_IRQHandler. Case matters. It not being linked in was the clue you'd probably spelled it incorrectly.

    The functions are all listed in the startup file compiled into your project (something with startup in the name and it's a .s file). I usually end up copying/pasting right out of there to ensure I get the name right.

  • Oops. I thought I had checked the spelling, but it seems I missed the capitalization. I will copy and paste from the startup .s file in future as suggested. Thanks.

Reply Children
No Data
Related