- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have a running project where i have the PSoC 4 BLE run in what is called multi-role.
Peripheral or central role combined with observer/broadcaster.
My current issue is that the latency for updating advertisement data is quiet large > 1 minute sometimes. And it is not clear to me why that is.
I update advertisement data upon changes in the system. These are queued until they are broadcasted using the advertisement packet.
code snippet:
if ( CyBle_GetBleSsState() == CYBLE_BLESS_STATE_EVENT_CLOSE )
{
CYBLE_API_RESULT_T res = CyBle_GapUpdateAdvData(cyBle_discoveryModeInfo.advData, cyBle_discoveryModeInfo.scanRspData);
if ( res == CYBLE_ERROR_OK )
{
// Advertisement data updated
}
}
My problem is that res == CYBLE_ERROR_INVALID_OPERATION
The device is broadcasting advertisement data at that point, so advertisements are enabled and it is in the correct BLESS State, so why do I get this error ?
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you can attach your project that would be much easier for debugging, but otherwise most of our comments will be speculation I think 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
support case created for this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Update for future reference:
I used only fast scan to continuously scan for certain BLE advertisement events. The timing I used was the default values 30ms.
This meant that both scan window and scan interval was 30 ms. This caused my issue since there was almost no time where Rx/Tx were silent.
I changed the scan settings so that scan window < scan interval and this resolved the issue for me.
br,
Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm having a similar issue.
In my case changing the scan window did not help. I updated BLE settings to remove the central role and still get CYBLE_ERROR_INVALID_OPERATION. calling CyBle_GapUpdateAdvData. This used to work so I must have done something. I'm at a loss what could cause this.
I added an ISR and a WDT since last time this worked - not sure how this has any bearing,just throwing it out there .
The comment for the function CyBle_GapUpdateAdvData says that the CYBLE_ERROR_INVALID_OPERATION is returned in the following cases
CYBLE_ERROR_INVALID_OPERATION | ADV Event is not closed, BLESS is active or ADV is not enabled.
Since CyBle_GapUpdateAdvData is called only when CyBle_GetBleSsState() == CYBLE_BLESS_STATE_EVENT_CLOSE I don't think the first 2 conditions apply. However how do I check if ADV is enabled? I'm assuming it is since the device is advertising. I can verify that in CySmart ( RSSI changes )
What else can cause CyBle_GapUpdateAdvData to return this error?
Any suggestions? I cannot share the project in the open forum - too much proprietary stuff.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Update
Actually making scan window < than interval did work.
This thread helped a lot
https://electronics.stackexchange.com/questions/82098/ble-scan-interval-and-window
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Andy. Glad you made it work. The reason that the update fails if window = interval is that updates can only take place when Tx/Rx is idle... which is never the case when window == interval.
br,
Martin