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

S130_1.0.0 - Unstable scan

Hi. My app based on S130_1.0.0 and is run on DevKit with 51422 chip. App advertises and scans at the same time with next params:

  • adv interval = 20mS;

  • scan interval = 200mS;

  • scan window = 100mS;

  • scanner is started before advertiser in main();

This all is run on two DK boards so each nRF receives adv packets of the other. During testing app I have noticed that after some time (several minutes) both nRF receives less and less adv packets during ~1 min until stop receiving advs at all for ~1 min and then again receives more and more adv packets till receiving almost all adv. Such behavior looks like some wave of receiving adv. Using MCP on my PC I have verified than both nRF advertise all this time, so seems problem is with scanner.

Could you explain such behavior? Is it expected or it's unknown bug in SD? Can you advice anything to avoid losing adv packets during so long time? Thanks!

Parents
  • Advertising interval = 20ms Scan Interval = 200ms Scan Window = 100ms

    Both kits will be scanning for 100ms every 200ms. In between the scans there will be 3 advertising events, each event is 1 advertising packet on each of the three advertising channels, 37, 38 and 39. The scanner will round robin the advertising channels, one scan window on channel 37, then 38, then 39, then 37, and so on.

    If the kits scan at the same time they will not receive any packets. How much the scan windows overlap depends on when the scans are started. The scan interval does not drift so the overlap will be constant. It could be 100%, and no packets will be received (on either kit). It could be 0%, and "all" packets will be received.

    So how often can we expect to receive a packet? Assuming an ideal environment with no packet loss.

    Lets assume an overlap of 50%. So in 50%, 50ms, of the scan window no packets will be received, since the other kit is also scanning. In the other 50%, 50ms, of the scan window, 1-2 packets will be received. So you will receive 1-2 packets per 200ms.

    But what if the overlap is 75%? Then in 75%, 75ms, of the scan window no packets will be received, since the other kit is also scanning. In the other 25%, 25ms, most likely 1 packet will be received, but it could be 0.

    So with an overlap of 75%, there is a 25ms window every 200ms where a packet can be received. When are packets transmitted? Every advertising interval+random delay(0-10ms), when no scanning is happening.

    If the overlap is even bigger, the chance of receiving a packet will decrease even more. And it could be 1 minute without receiving anything. This could explain what you are seeing. But this is assuming that you have an overlap of 80-90%. I'll try to look into it some more.

    Advertising interval = 20ms Scan Interval = 100ms Scan Window = 90ms

    With this setup two things can happen.

    Either there is a scan window of 90ms, then an advertising event between 90ms and 100ms then a new scan window at 100ms.

    Or (more likely) there is scan window of 90 ms, then an advertising event after 100ms, then advertising events every advertising interval+random delay until(most likely 2 more) 200ms where a new scan window will start.

    Advertising interval = 20ms Scan Interval = 20ms Scan Window = 10ms

    With this setup two things can happen.

    Either there is a scan window of 10ms, then an advertising event between 10ms and 20ms then a new scan window at 20ms.

    Or (more likely) there is scan window of 10 ms, then an advertising event after 20ms, then a new scan window at 40ms.

    With this setup more advertising packets are sent out, and I believe that is why you the improvement. Also, if you have a high overlap, a drop of a scan window could improve the receive rate on the other kit because you send an advertising packet when you normally would overlap.

  • Yes, I've got it working after several days of playing with scan/adv interval. But it still is working not so fine.

Reply Children
No Data
Related