Bluetooth help - invalid state

I’m porting an app from another Bluetooth stack (Broadcom/Cypress Wiced) to the standard SDK.
I need to be able to start and stop advertising during operation.

I’m calling le_adv_start() and le_adv_stop(), but I’m often getting the return code 2 (GAP_CAUSE_INVALID_STATE)
Can anyone provide some assistance as to what I’m doing wrong to cause this error code?

I also need to run passive scans whilst advertising is enabled. I’m calling le_scan_start() and le_scan_stop() but I can’t get it to work. Sometimes these functions also return code 2.

The BT application doc doesn’t seem to cover the case of advertising and scanning in the same app. Is it possible?


1 Like

help you tag someone @wyy who knows this matter better

you should refer to the BLE_Scatternet example for how to configure for Central + Peripheral operation.
BLE_Scatternet can be enabled with the ATBf command, after which it will begin advertising. You can then use the ATBS command to perform BLE scanning while the scatternet advertisement is still active.