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.

default advertising as in simpleBLEperipheral project

Hello,

The project "simpleBLEperipheral" has below default settings.

    // For all hardware platforms, device starts advertising upon initialization
    uint8_t initialAdvertEnable = TRUE;

If it is turned off (initialAdvertEnable = FALSE), event SBP_PERIODIC_EVT does not get triggered at all.

[ therefore, SimpleBLEPeripheral_performPeriodicTask() is not getting called periodically ]

Event also does get triggered even Util_startClock(&periodicClock) is called during SimpleBLEPeripheral_init()

Is there any relation with this periodic event and advertisement enabling / disabling ?

Regards.

Rasikraj.

  • correction @
    Event also does "not" get triggered even Util_startClock(&periodicClock) is called during SimpleBLEPeripheral_init()
  • The periodic clock only starts upon entering a connection in SimpleBLEPeripheral_processStateChangeEvt, case GAPROLE_CONNECTED.
    If you don't advertise then you will never enter a connection.

    Changing this to call Util_startClock after Util_constructClock in _init works fine on my side at least and the breakpoint gets triggered within "if (events & SBP_PERIODIC_EVT)" every 5 seconds.

    .:Svend
  • Hi,

    Connection may not be required all the time.
    But, for me, periodic event does not get triggered even the clock is been started at _init.
    So, question here is again, if default advertising is made ON, how it has got relation with periodic event ?
    (if this default advertising is turned off, periodic event does not get triggered at all)

    Regards.
    Rasikraj
  • rasikraj deshmukh said:
    But, for me, periodic event does not get triggered even the clock is been started at _init.

    Hard to say. It works fine for me when testing. Can you post your code to show how you do it?

    rasikraj deshmukh said:
    So, question here is again, if default advertising is made ON, how it has got relation with periodic event ?
    (if this default advertising is turned off, periodic event does not get triggered at all)

    Because Clock_start for the periodic clock doesn't happen before you reach GAPROLE_CONNECTED in our example. Without advertising you cannot connect.

    Regards;
    Svend

  • Hello,

    Ya.. its well known, without advertising, device can not be connected.

    The purpose of 'GAPROLE_CONNECTED' you are describing might be useful when a device that is already connected and is now starting advertising, if 'PLUS_BROADCASTER' is enabled. So that, it still can 'broadcast'. This could be different application altogether, may be single slave & multiple masters.

    In my application, I should not start advertising until an external event happens e.g. a change on pin, a one slave & one master topology.

    Steps I am following can be described  as below. ('simpleBLEperipheral' project)

    If 'initialAdvertEnable' is made to 'TRUE', it hits the breakpoint & task function is getting called cyclically.

    If I turn OFF the advertising initially, I can not see task function is not getting called cyclically, which is possible if I made it ON.

    So wondering how initialAdvertEnable is linked with cyclic task.