This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2541: Disabling Scan in CC2541

Part Number: CC2541


I am working on a project using CC2541. Is there an API to  disable the scanning in CC2541 ? If not , what would be the alternative way to do this?

  • Hi,

    Could you please specify which example you are using?

    Generally speaking, scanning is enabled by calling the function  GAPObserverRole_StartDiscovery() which calls GAP_DeviceDiscoveryRequest(). Not calling these functions should not set the device in scanning mode.

    If not already done, make sure to review the documentation stored in the BLE stack (in BLE-CC254x-1.x.x.x\Documents).

    I hope this will help,

    Best regards,

  • Hi Clement,

    Yes, sure. I am using CC2541 in the  ECU for the pneumatic module. So the ECU gets advertisements from BLE enabled pressure sensors and ECU then advertises to the connected phone and the details will be displayed in app. Currently I am facing connection problem with the phone (some times it takes time(5-10s) to get connected (sometimes it doesn't bond in some devices)  and I wanted to test step by step and so first i want to disable the scanning from my ECU and check the connection (if the unit was overloaded by the scanning).

    So yes, I have already disabled GAPObserverRole_StartDiscovery() , but then it not only disables scanning, the unit itslef becomes non discoverable in the phone too, which is not what I wanted. I see in some BLE stack, the GAPROLE_Scan_Disable, which I cannot find my in my BLE stack.

    Best,

    Varun

  • Hi Varun,

    May I ask you where you have found the code example you have used as base for your project?

    When it comes to advertisement, they are enabled by the following code:

    uint8 new_adv_enabled_status = TRUE;
    GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &new_adv_enabled_status );

    Best regards,

  • Hi Clement,

    Thanks for your reply. Since this is a legacy project, we received the code from our counter part. But however, advertisements are already enabled like the way you suggested during initialization. 

    However, while testing with various android phones using sniffer apps, I observed with some devices it is working as intended but in some, it is not getting bonded and when I try to bond it with phone, the unit (ECU) goes undiscoverable. I killed the app and checked in other phones, but it is still undiscoverable and hence I need to restart the CC2541 again to be discoverable to devices. I am curious if anyone here faced such problems ?

    Best,

    Varun

  • Hi Varun,

    I haven't found any case with a similar issue. It may mean something wrong is going on with the application layer.

    With the details currently shared, I am not sure I can go further in the analyze of this issue. Maybe, some BLE sniffer logs could help.

    Best regards,

  • Hi Clement,

    Sorry for not getting back to you earlier. Infact I found out why I was not able to bond with new devices as in the SW, it was configured that maximum number of bonds CC2541 can have is 10, so when I clear all bonds through a predefined Gatt service, I can add more. Now this brings to a new question, 

    Is there any API which gives the info on least bonded devices so that next time it exceeds 10 devices I could automatically delete the least bonded device from the list and thus allow to bond with new device?

    Thank you in advance.

    Best,

    Varun

  • Hi Varun,

    There is no API do to this. You will be required to handle this at the application level.

    Best regards,