This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Timer not working with soft device s110

When i added timer in my bluetooth code my board will not advertise.using pca10028 and nrftool box uart app on iphone 5s. here is my complete code. Using timer1 Final with timer.zip

Base 64 files.zip

Parents
  • The problem is that you do not clear all interrupts in TIMER1_IRQHandler. If I add the following line to the handler I do not see any problems:

    NRF_TIMER1->EVENTS_COMPARE[0] = 0;
    

    As the interrupt is not cleared, the IRQ is entered again as soon as it exits (only interrupted by higher priority interrupts). This causes the SoftDevice to loose its timing and will trigger a hard fault (which you see if you run the code in a debugger).

Reply
  • The problem is that you do not clear all interrupts in TIMER1_IRQHandler. If I add the following line to the handler I do not see any problems:

    NRF_TIMER1->EVENTS_COMPARE[0] = 0;
    

    As the interrupt is not cleared, the IRQ is entered again as soon as it exits (only interrupted by higher priority interrupts). This causes the SoftDevice to loose its timing and will trigger a hard fault (which you see if you run the code in a debugger).

Children
Related