CC2340R5: Regarding hard fault event when tried to restart BLE advertisement

Part Number: CC2340R5

Dear support team,

I am trying to restart the BLE advertainment when the BLE link is terminated.

But it seems, it ends up at hard fault as shown below. 

Regards.

Rasikraj.

  • Hi Rasikraj,

    Thank you for reaching out.

    Could you please specify the SDK version you are using?

    Best regards,

  • It is simplelink_lowpower_f3_sdk_7_40_00_64

  • Hi,

    Thank you for telling me.

    Have you already checked gAdvertisingHandle is not NULL?

    Have you reviewed the list of build warnings for your project?

    Regards,

  • Hi,

    I think, handle seems ok as it attempts to start the advertisement and about build warnings, it is almost none. (only redefined switches to bypass Eclipse issue)

    Because, creation of Advertising set goes ok (Blestatus = SUCCESS) and it could set event masks.

    Regards,

    Rasikraj.

  • Hi Rasikraj,

    For sanity check could you remove the defines you added and see if you still have the issue?

    Could you also share a list of steps to follow to reproduce the issue?

    Regards,
    Tanguy.

  • Hello Baltazart,

    I don't think removing switches will help. It is redefined just to allow placing breakpoints within sections. (otherwise, it would not)

    Steps:

    1. Start Advertising.

    2. BLE connect to the demo board (e.g. using nRF connect smart phone app)

    3. smart phone app will connect and available service can be seen.

    4. BLE disconnect and when debugging is suspended, it would end up at while(1) hard fault.

    Regards.

    Rasikraj.

  • Hi Rasikraj,

    Are you using an out of the box example? If so, could you describe the modifications you have done so I can reproduce the issue.

    Regards,

    Tanguy

  • Hello Tanguy,

    It is not any out of the box. As mentioned before, it is based on simplelink_lowpower_f3_sdk_7_40_00_64.

    I started to make some changes to build our application on this example.

    Attaching some screenshots of changes made.

    One observation:

    Advertising event handler (Peripheral_GAPConnEventHandler) does not gets called unless its event mask is not set.

    (In BLE example project, this setting of event masks is not done though)

    Is there any way to debug this? How I can see call trace or some internal system states?

    Regards.

    Rasikraj.

  • Hi Rasikraj,

    Thank you for providing more details, Peripheral_AdvEventHandler shouldn't be used as the advertising set callback function. Can you replace Peripheral_AdvEventHandler by BLEAppUtil_advCB in GapAdv_create (you can find this function in BLEAppUtil_stack_callbacks.c)?

    Finally, BLEAPPUTIL_ADV_SET_TERMINATED is not a valid GAP adv event, please check the GapAdv_eventMaskFlags_t enum in the documentation for all possible values.

    Regards,
    Tanguy

  • Hello Tanguay,

    Thanks for update. 

    It seems now, I can replace now the callback  BLEAppUtil_advCB.

    But, how to handle GAP events within these callbacks, like BLEAPPUTIL_ADV_START_AFTER_ENABLE,  BLEAPPUTIL_ADV_END_AFTER_DISABLE?

    I tried use these events within switch case as like before in BLEAppUtil_advCB(), but this seems causing issue to Advertising, it is not starting e.g.

    Regards.

    Rasikraj.

  • Hello Tanguay,

    I could now use the GAP adv events within BLEAppUtil_advCB() like as below and it seems it is working like this.

    Is this correct way to use them?

    Regards.

    Rasikraj.

  • Hi Rasikraj,

    These events should be used inside the EventHandler functions, those functions should be registered with BLEAppUtil_registerEventHandler.

    Please take a look at app_peripheral.c in the basic_ble example, pay special attention to the Peripheral_AdvEventHandler (line 143) and BLEAppUtil_EventHandler_t peripheralAdvHandler (line 94).

    Regards,

    Tanguy

  • Hello Tanguy,

    For now, I could use these events as mentioned before, but I got confused because of this statement as below.

    So, effectively we need to use Peripheral_AdvEventHandler() from example but as per your earlier reply, we should not.

    Also, it was not required to register CB event handler for ADV but it seems only for connections.

    ADV CB is referenced at Gap_Create() function and this seems sufficient then.

    Regards.

    Rasikraj.

  • Hi Rasikraj,

    Excuse me for the confusion,

    Peripheral_AdvEventHandler is an event handler and should be registered as such by using the BLEAppUtil_registerEventHandler function.

    The role of the GapAdv_create callback is to transfer the events to the BLE5-Stack so they will be handled by a registered event handler.

    Regards,
    Tanguy