apache / apache/mynewt-nimble

Extended Advertising: TX freezes after ~65535 seconds

Open
#1,105 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
893
Forks
512
Avg merge
13d 31m
Merged PRs (30d)
7

Description

We are debugging a strange behavior we encountered when doing some experiments with extended advertisements: we have 14 nodes periodically transmitting data to a central sink node via extended advertisements. The way we transmit the data is to write the data into an unused advertising instance (configured to use a total of 10), and then advertise the data exactly 3 times.

Now we wanted to run a 24h experiment, and everything went fine for the first ~18,1 hours. But after ~65500 seconds, all of our 14 nodes stop sending out data at the same time. What we can observe, is that NimBLE stops to trigger `BLE_GAP_EVENT_ADV_COMPLETE` events and the counters we put into the PHY code show that the node is not transmitting any packets anymore.

So far I don't have a lead on what could cause this behavior, but here are some thoughts we have collected so far:
- as 14 nodes show exactly the same behavior at the same time (in the order of the same second), my guess is that this is a systematic software bug somewhere in NimBLE
- the time between reboot (all nodes are rebooted at beginning of each experiment) and the faulty behavior is awfully close to `UINT16_MAX` -> does intuitively point to some kind of (timer?) overflow issue
- as the node stop to send out any packets on the radio, could this be related to the controller's scheduler?

Does anyone have experience running extended advertisements for longer periods of time? Or is there any idea what could be causing this? Due to a paper deadline approaching it would be great to have our setup stable ASAP :-)

Build/configuration context:
- NimBLE @ RIOT
- NimBLE version b9c20addd87f1692ea27600ede82f641c77315be
- Using the following configuration for extended advertisements:
```
MYNEWT_VAL_MSYS_1_BLOCK_SIZE=294
MYNEWT_VAL_MSYS_1_BLOCK_COUNT=32

MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES=9
MYNEWT_VAL_BLE_EXT_ADV=1
MYNEWT_VAL_BLE_EXT_ADV_MAX_SIZE=1650
MYNEWT_VAL_BLE_HCI_EVT_HI_BUF_COUNT=12
MYNEWT_VAL_BLE_HCI_EVT_BUF_SIZE=257
MYNEWT_VAL_BLE_LL_EXT_ADV_AUX_PTR_CNT=10
MYNEWT_VAL_BLE_LL_CFG_FEAT_LL_EXT_ADV=1
```

Contributor guide

No contributing guide indexed for this repository

Research direction

No source file or test is named. Start by reproducing the extended-advertising experiment on NimBLE @ RIOT while monitoring BLE_GAP_EVENT_ADV_COMPLETE and the PHY transmission counters around UINT16_MAX seconds; done means identifying the failure point and restoring continued advertising beyond that interval.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.