Setting advertising transmission power

i have nrf52832 sdk vr 17.0.2. i want to set transmission power of advertising packet. pls assist

Parents
  • Hello,

    You can set this using the sd_ble_gap_tx_power_set function directly.
    As mentioned in the function API Reference you will need to enable include_tx_power for it to be included in your advertising packet.

    Best regards,
    Karl

  •  */
    static void advertising_init(){
        ret_code_t             err_code;
        ble_advertising_init_t init;
    
        memset(&init, 0, sizeof(init));
    
        init.advdata.name_type                = BLE_ADVDATA_FULL_NAME;
        init.advdata.include_appearance       = true;
        init.advdata.flags                    = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;
       
    		init.srdata.uuids_more_available.uuid_cnt=sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    		init.srdata.uuids_more_available.p_uuids =m_adv_uuids;
        init.config.ble_adv_whitelist_enabled = false;
        init.config.ble_adv_fast_enabled      = true;
        init.config.ble_adv_fast_interval     = APP_ADV_INTERVAL;
        init.config.ble_adv_fast_timeout      = APP_ADV_DURATION;
        
        init.evt_handler = on_adv_evt;
    
        err_code = ble_advertising_init(&m_advertising, &init);
        APP_ERROR_CHECK(err_code);
        uint32_t err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, m_advertising.adv_handle, 4); 
        APP_ERROR_CHECK(err_code);
        ble_advertising_conn_cfg_tag_set(&m_advertising, APP_BLE_CONN_CFG_TAG);
    		
    		
    		
    		
    		
    }

    is it how shall it work?? i have added

      uint32_t err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, m_advertising.adv_handle, 4);
    APP_ERROR_CHECK(err_code);

    pls chek

  • I am not entirely sure what you are asking about. Are you asking about how long it takes to perform a single advertising? If so, this will depend on the advertising payload and configuration. You could use the Online Power Profiler to see the effects of different configurations on the advertising length. It gives a good estimate for how long each advertising would take.

    Please also keep in mind that a random 0 - 10 ms delay is added before every advertising, as specified in the BLE specification. That means that even if you have set the advertising interval to be 100 ms, it could be anything between 100 and 110 ms that passes before the next advertising is sent. This delay is added for you by the SoftDevice.

    Best regards,
    Karl

  • i mean if adv interval is say 10s then it means every after 10 secs the adv packet is transmitted on each channel 37,38 and 39. i want to know min how much time does it take to send an advertising packet 

  • As mentioned this depends on the advertising configuration and data payload.
    Please check the Online Power Profiler for an estimate of how long an advertising will take.

    Best regards,
    Karl

  • i am asking about min time... like in specs 0.625ms is a value given does that mean atlest 0.625ms time is taken for ble to adv 

  • I do not understand you question, could you please elaborate?

    Are asking about the minimum time it takes to send an advertising packet? If so, like already mentioned, this depends on what type of advertising (connectable/scannable? non-connectable/non-scannable?) and the size of the advertising payload. The time it takes to send an advertising with different configurations can be visualized in the Online Power Profiler. If you have not already looked at it I urge you to give it a try.

    Please elaborate thoroughly on your question if this is still not what you are asking about. Please do not use any abbreviations or shorthands.

    Best regards,
    Karl

Reply
  • I do not understand you question, could you please elaborate?

    Are asking about the minimum time it takes to send an advertising packet? If so, like already mentioned, this depends on what type of advertising (connectable/scannable? non-connectable/non-scannable?) and the size of the advertising payload. The time it takes to send an advertising with different configurations can be visualized in the Online Power Profiler. If you have not already looked at it I urge you to give it a try.

    Please elaborate thoroughly on your question if this is still not what you are asking about. Please do not use any abbreviations or shorthands.

    Best regards,
    Karl

Children
Related