-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GitHub Periodic Advertising example hangs when calling setPeriodicAdvertisingParameters (5.13.1 and master branch) #11106
Comments
For anyone who is going to try the periodic advertising example, I had to modify the following line to get it run - otherwise there is an assertion failure due to configuration dependency: Change from |
Internal Jira reference: https://jira.arm.com/browse/MBOCUSTRIA-1512 |
Some more information from my debug session via gdb: Resetting target Program received signal SIGTRAP, Trace/breakpoint trap. Here is the serial print out from the board - with my own added debug message: Looks like something has triggered a reset/restart? |
I've traced the issue using gdb and found it is stuck where a function pointer is used to call a function but the target function is never called and the same function pointer is called recursively until the stack got overflow and system crashes (see the above stack backtrace). template setPeriodicAdvertisingParameters should call setPeriodicAdvertisingParameters_ via function pointer; actual result: instead of calling the function, the function setPeriodicAdvertisingParameters is calling itself recursively; Any ideas? |
cc @ARMmbed/mbed-os-pan |
@paul-szczepanek-arm I though this had been fixed . Could you confirm ? |
That has been fixed some time ago and continues to be fixed. |
Not sure if anyone has really tried with the GitHub periodic advertising example but I don't agree that the bug can be closed. As on 14th/Aug/2019, I tried it again using master branch and it remains the same hanging behaviour - and there is no update in 5.13 branch since it is released. Actually I found in the following file, there may be a cyclic reference: ble_error_t set_periodic_advertising_parameters( By changing that to the following code, it does not hang any more - note the tiny underline '__' before the '(': Even it runs after this change, the periodic adverting example still breaks so far - in my test, the two nodes can establish their roles (after a number of changes including to change the first advertising type [not the periodic one] to legacy true, otherwise it spells out system error and crashes), the scanner will always return at this line:
(From advertiser side, LE extended advs are happening but scanner can never detect the periodic interval !=0) Can someone please run the example and verify this? |
Apologies, you are right, there was the same exact error which has been fixed but different function. Was looking at setPeriodicAdvertisingParameters and not the pal version set_periodic_advertising_parameters. Will fix and rerun example. |
I could be wrong but likely the periodic interval field is always zero because when packets are constructed, it is always called isPeriodic false: The same is true for all the instances where lctrPackAdvExtIndPdu are called. pAdv->txAdvLen = lctrPackAdvExtIndPdu(pAdvSet, pAdvSet->advHdrBuf, FALSE); Maybe I should close this bug and report another one? As this is different from the original report. |
Yes, I can see there is already separated report. I'll close this issue. |
Description
I've tried on both release 5.13.1 and master branch, neither of them can pass the point when setPeriodicAdvertisingParameters is called.
I've also tried to debug and traced source code and seems only thing that matters are the WsfTaskLock call listed below. Any one bumped into similar issue? Any idea is this a bug of Mbed OS or a bug of the Periodical advertising example which I believe has been tested at some point? Anyone knows the version of the Mbed OS the exampled was tested with?
template
ble_error_t Gap::set_periodic_advertising_parameters_(
advertising_handle_t advertising_handle,
periodic_advertising_interval_t periodic_advertising_min,
periodic_advertising_interval_t periodic_advertising_max,
bool advertise_power
)
{
DmPerAdvIncTxPwr(advertising_handle, advertise_power);
DmPerAdvSetInterval(
advertising_handle,
periodic_advertising_min,
periodic_advertising_max
);
DmPerAdvConfig(advertising_handle);
}
/************************************************************************************************/
/!
/
/************************************************************************************************/
void DmPerAdvSetInterval(uint8_t advHandle, uint16_t intervalMin, uint16_t intervalMax)
{
WSF_ASSERT(advHandle < DM_NUM_ADV_SETS);
WsfTaskLock();
dmPerAdvCb[advHandle].intervalMin = intervalMin;
dmPerAdvCb[advHandle].intervalMax = intervalMax;
WsfTaskUnlock();
}
/************************************************************************************************/
/!
/
/************************************************************************************************/
void DmPerAdvIncTxPwr(uint8_t advHandle, bool_t incTxPwr)
{
WSF_ASSERT(advHandle < DM_NUM_ADV_SETS);
WsfTaskLock();
dmPerAdvCb[advHandle].incTxPwr = incTxPwr;
WsfTaskUnlock();
}
Issue request type
The text was updated successfully, but these errors were encountered: