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.

CC2745R10-Q1: cc2745 re-broadcasting

Part Number: CC2745R10-Q1
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Hi, Ti

  I’m use TI\simplelink_lowpower_f3_sdk_8_40_00_61\examples\rtos\LP_EM_CC2745R10_Q1\ble5stack\basic_ble as Peripheral .

I’m want to run BLEAppUtil_advStop(peripheralAdvHandle_1); at timer callback to stop broadcast. And run  BLEAppUtil_advStart(peripheralAdvHandle_1, &advSetStartParamsSet_1); at case BLEAPPUTIL_ADV_END_AFTER_DISABLE: to make it Re-broadcast.

But it was not successfully achieved,the broadcast stop but can't re-start.I wonder if this is normal?If this is not normal, how can I make it stop then re-start broadcasting at regular intervals?

  • Hello,

    Do you mind providing the code for this?

    Best,

    Nima Behmanesh

  • Hello,

    This is my code.

    void ad_timeout_callback(TimerHandle_t xTimer)
    {
        BLEAppUtil_advStop(peripheralAdvHandle_1);
    }
    
    void Peripheral_AdvEventHandler(uint32 event, BLEAppUtil_msgHdr_t *pMsgData)
    {
        switch(event)
        {
            case BLEAPPUTIL_ADV_START_AFTER_ENABLE:
            {
                ad_timeout_handle = xTimerCreate("Timer all timeout", pdMS_TO_TICKS(3000), pdFALSE, (void *)1, &ad_timeout_callback);
                xTimerStart(ad_timeout_handle, 0);
    
                MenuModule_printf(APP_MENU_ADV_EVENT, 0, "Adv status: Started - handle: "
                                  MENU_MODULE_COLOR_YELLOW "%d" MENU_MODULE_COLOR_RESET,
                                  ((BLEAppUtil_AdvEventData_t *)pMsgData)->pBuf->advHandle);
    
                break;
            }
    
            case BLEAPPUTIL_ADV_END_AFTER_DISABLE:
            {
                if(linkDB_NumActive() < linkDB_NumConns())
                {
                    BLEAppUtil_advStart(peripheralAdvHandle_1, &advSetStartParamsSet_1);
                }
                MenuModule_printf(APP_MENU_ADV_EVENT, 0, "Adv status: Ended - handle: "
                                  MENU_MODULE_COLOR_YELLOW "%d" MENU_MODULE_COLOR_RESET,
                                  ((BLEAppUtil_AdvEventData_t *)pMsgData)->pBuf->advHandle);
    
                break;
            }
    
            default:
            {
                break;
            }
        }
    }
    
    void Peripheral_GAPConnEventHandler(uint32 event, BLEAppUtil_msgHdr_t *pMsgData)
    {
        switch(event)
        {
            case BLEAPPUTIL_LINK_ESTABLISHED_EVENT:
            {
                /* Check if we reach the maximum allowed number of connections */
                if(linkDB_NumActive() < linkDB_NumConns())
                {
                    /* Start advertising since there is room for more connections */
                    BLEAppUtil_advStart(peripheralAdvHandle_1, &advSetStartParamsSet_1);
                }
                else
                {
                    xTimerStop(ad_timeout_handle, 0);
                    /* Stop advertising since there is no room for more connections */
                    BLEAppUtil_advStop(peripheralAdvHandle_1);
                }
                break;
            }
        ...
    }

  • Hello,

    After reviewing the code this seems to be correct.

    Do you mind also sending me your sysconfig settings for the number of connections? 

    Additionally, something else to try is wrapping the advertising end code:

    void my_wrapper()
    {
        BLEAppUtil_advStop(peripheralAdvHandle_1);
    }
    
    void ad_timeout_callback(TimerHandle_t xTimer)
    {
        BLEAppUtil_invokeFunctionNoData(my_wrapper);
    }
    

    If this doesn't work please let me know. 

    Best,

    Nima Behmanesh

  • Hello,

      My settings for the number of connections is 1.

      I tried the code you gave and it solved my problem.Thank you Nima.