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

timer event stops advertising

hi everyone. i have an issue with app timer. 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 but i don't know how to. . Can someone help me to fix this problem? Thanks in advance.

samet

edit: here is my code you see the code it is a beacon project, i update scan resp data at every half of hour.

main.c

Parents
  • Hi,

    I think I have the answer to your question regarding the pauses in the advertising. The problem is not the timers, but the interval at which you are advertising. In your code you have the following line:

    #define NON_CONNECTABLE_ADV_INTERVAL    MSEC_TO_UNITS(500, UNIT_0_625_MS)
    

    meaning, as I'm sure you know, that you are advertising every 500 ms. This is a relatively long interval and your scanners (your bluegiga and MCP) needs to take this into account if you want to capture every advertising packet. So I tried your code and I too saw what seemed to be a regular pause in the advertising using MCP, so I pulled out my sniffer from my drawer and was able to produce this graph:

    image description

    As you can see, even though it might not seem so in MCP the device is actually advertising every 500 ms all the time. So the issue is actually on your scanner side. Have a look at this image:

    image description

    Your scan intervals are probably too long and your scan window lengths are too short and this makes it hard for you scanner to "hit" the advertising packets. That is why you see the pauses. You get these regular pauses because for a certain amount of time the scan windows overlap with the advertising interval, but over time the window will drift in time compared to the advertising packet until the windows are not hitting the advertising packets at all. Then a couple of seconds later the windows have drifted even further and overlap the advertising packets again. So I adjusted the scan window and interval to 510 ms and 511 ms respectively in MCP (hit "File -> Options -> Scanning"). This means that MCP scans for 510 ms, stops for 1 ms, scans for 510, and so on, making it very likely to hit every advertising packet. Now I could see the device advertising regularly all the time.

  • hi martin,

    i have tested the firmware about 4 days. it seems it is ok. thanks .

Reply Children
No Data
Related