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

  • The SoftDevice only uses timer 0, so it should not matter what you do with timer 1.

    Which version of the SDK are you using?

    I compiled your code with SDK 9 and used SoftDevice S110. I had to comment out line 223 (call to Base64encode) as base64.c is not part of the zipped project folder you supplied, but other then that I had no issues. When i flash the application to a nRF51 DK it starts to advertise and I do not see any problems.

    Have you double checked that your device does not advertise? If so, I would assume that the issue is somewhere within Base64encode as that is the only part of the code that I did not use.

  • i am using sdk 8. I checked it several times it is not advertising with timer but when i comment line 782 it works fine. And i have attached base64 header and C both files kindly add these to your project. i think the problem is some where else not in base64.

  • 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).

  • Hi Einar and Nomi, i have an issue with app timer too. i m using SDK 9 and softdevice v8.0. in my code i used ble_app_template project and changed something according to my goals (for example) i create timer and start as in the template project and every timer event handle i update my advertisement data (sequence: advertisement stop-->update adv data--> advertisemt start).

    my problem, sometimes, soft device stops advertising and at next timer handle it starts again. i think problem comes from not properly set up scheduler or interrupt priority. how can i fix this problem?

    thanks in advance,

    samet

Related