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

Thingy52 nrf52832 beacon scan sometimes drop for few seconds

Hi,

I have 2 or more Thingy52 [SDK13 SD s132 v4.0.4], both of them are sending beacon every 200ms.

They have also the scan active, so they are able to detect the other devices reading the beacons.

At the moment, I set the scan interval to 0xA0, 100ms and the scan interval to 90ms.

What I am seeing is that sometimes I am not able to receive the beacons for few seconds.

If I set the scan interval to 100ms as the scan window, I receive lot of NRF_EVT_RADIO_BLOCKED events. Not understood if it is something normal, but I don't think so.

Can you explain why I receive these events?

The major problem that I have, and I don't know if it is correlated to this, is that sometimes for 3/4 secs (even more sometimes) I am not able to receive any BLE_GAP_EVT_ADV_REPORT even if the beacon from the other devices are regularly sent.

Can you help to understand why?

Thanks

M.

Parents
  • Hello,

    What changes did you do to the thingy project?

    I haven't noticed whether this is a common event or not in the Thingy example, but if you have set the scan interval and the scan window to 100ms, then that may be the issue. It looks like the beaconing in the Thingy example uses timeslots, and if you basically request to use the radion 100% of the time for scanning, there is no time for the device to advertise. I guess the advertisements that you actually see are caused by the device not being able to schedule the next scan window, which may happen once every 3-4 seconds.

    Try to decrease the scan window compared to the scan interval, and see if that helps.

    Best regards,

    Edvin

  • Thanks Edvin for your reply,

    I used the thingy example with the eddystone beacon using the timeslot, changing the send interval to 200ms.

    The advertiser are sent every 560ms, but I don't care about them at the moment. My application first of all has to send continuously beacons and have to read all the beacon received. It makes some elaboration and when needed it will export these data with all the sensor data to the client that will be connected via BLE every hour or more.

    The important thing is that I am able to send and scan continuously the beacon try to loose the minimum possible number of beacons.

    At the original Thingy example, I added the start scan during the initialization of the main using the scan Interval=100ms and Scan Window=90ms.

    I have also tried scan Interval=100ms and Scan Window=50ms as reported on your example, but the problem randomly is present.

    What I noticed is that for some reason the scan is sometimes monumentally paused. I don't know how to check and verify this.

    In my application I have a periodic handler that runs every 1 sec to analyze the beacon collected in that interval. As temporary workaround, I put the scan stop at the handler begin and the scan start at the end of the handler ( it takes 4-15ms to be executed)

    This seems to mitigate the problem, but I'd like to better understand the issue.

    Let me know if any suggestion.

    Thanks

    M.

  • Hello,

    The thing is that the nRF52832 only has one radio, so it can either scan or advertise at one point in time. This is scheduled by the softdevice, so that both will be handled (if you do advertising and scanning). If you are in a connection, the softdevice will use the radio for this as well.

    The scheduler can only schedule full advertising windows, and the scheduler is dynamic. This means that if you are advertising or in a connection, so that you have conflicting radio usage, the softdevice has to decide whether or not to schedule the planned scan window. If it has to support a BLE connection, or many advertisements has not been prioritized due to scanning, then the scan window will not be prioritized. If your scan window is 90ms, then the entire scan window will be skipped. If your scan interval is 100ms, then the softdevice will try to schedule the next scan window the next time.

    This is quite complex, so I suggest that you study some of the scheduling priorities that the softdevice use. Check out these links:

    1: https://infocenter.nordicsemi.com/topic/sds_s132/SDS/s1xx/multilink_scheduling/suggested_intervals_windows_s132.html

    2: https://infocenter.nordicsemi.com/topic/sds_s132/SDS/s1xx/multilink_scheduling/priorities_and_events_intro.html 

    So what are you using the radio for? You are scanning, obviously. Are you in a connection? Are you advertising?

  • Thanks Edvin,

    I took sometime to read carefully the documentation you pointed me out.

    My application mainly is sending beacons, using the Radio Time slot, and scan continusly to collect the beacons sent by the other devices.

    It can be connected to a central station, so it is configured as Peripheral role. Sometimes during the day, once every couple of hours, the central station will connect to each device and collect the data. So it sends periodically the advertisers (interval = 380ms).

    It is not so easy to find the proper scan windows size or interval, also because I don't have any statistics about the dropped packets, the collisions, etc., in order to have a clear picture of what is happening on the radio scheduling.

    Summurizing I can work on different parameters:

    - beacon send interval (200ms)

    - scan window (80ms)

    - scan interval (100ms)

    - advertisement (380ms) can be increased without affecting the application functionalities

    I don't know if some statistics can be collected in some way, but probably can be useful in order to have a feedback on how the system is working when the different parameters ares tuned.

    Thanks again for the support.

    M.

  • Mimmo said:
    I don't know if some statistics can be collected in some way, but probably can be useful in order to have a feedback on how the system is working when the different parameters ares tuned.

     I am not sure what you mean here. But I guess you can try to log whenever you scan a packet. 

    You started this ticket saying:

     

    The major problem that I have, and I don't know if it is correlated to this, is that sometimes for 3/4 secs (even more sometimes) I am not able to receive any BLE_GAP_EVT_ADV_REPORT even if the beacon from the other devices are regularly sent.

     

    Is this when you try to scan with the thingy? Perhaps you are too slow to release the timeslots that you are using: 

    Mimmo said:
    My application mainly is sending beacons, using the Radio Time slot, and scan continusly to collect the beacons sent by the other devices.

     

    I suggest that you try to disable one or more things at the time. beaconing, advertising and scanning, on both the scanner and the advertiser you expect to get the advertisements from. Perhaps this can give you an answer on what part that you are using that is blocking. Perhaps the advertisements are never sent? Perhaps you are not able to scan because of your timeslots?

    Why do you use timeslots for beaconing, and not the advertising module itself?

Reply
  • Mimmo said:
    I don't know if some statistics can be collected in some way, but probably can be useful in order to have a feedback on how the system is working when the different parameters ares tuned.

     I am not sure what you mean here. But I guess you can try to log whenever you scan a packet. 

    You started this ticket saying:

     

    The major problem that I have, and I don't know if it is correlated to this, is that sometimes for 3/4 secs (even more sometimes) I am not able to receive any BLE_GAP_EVT_ADV_REPORT even if the beacon from the other devices are regularly sent.

     

    Is this when you try to scan with the thingy? Perhaps you are too slow to release the timeslots that you are using: 

    Mimmo said:
    My application mainly is sending beacons, using the Radio Time slot, and scan continusly to collect the beacons sent by the other devices.

     

    I suggest that you try to disable one or more things at the time. beaconing, advertising and scanning, on both the scanner and the advertiser you expect to get the advertisements from. Perhaps this can give you an answer on what part that you are using that is blocking. Perhaps the advertisements are never sent? Perhaps you are not able to scan because of your timeslots?

    Why do you use timeslots for beaconing, and not the advertising module itself?

Children
No Data
Related