This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Beacon Parameter Settings in NRF52840

Hi,

Actually i m new on this field.

I m making indoor navigation by using nrf52840 soc.And i m using sdk15.2.In that sdk i used beacon app code for advertising beacon values.

Now i set some parameters in listed below

APP_MEASURED_RSSI               0xC3

m_adv_params.properties.type = BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED

sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_SCAN_INIT(2), BLE_GAP_TX_POWER_ROLE_ADV(1), 4);

Please advise me.All these parameters m setting are right or wrong?

Thanks in advance

  • Hi.

     

    sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_SCAN_INIT(2), BLE_GAP_TX_POWER_ROLE_ADV(1), 4);

     This does not appear to be correct, if you look at the API definition:

    /**@brief Set the radio's transmit power.
     *
     * @param[in] role The role to set the transmit power for, see @ref BLE_GAP_TX_POWER_ROLES for
     *                 possible roles.
     * @param[in] handle   The handle parameter is interpreted depending on role:
     *                     - If role is @ref BLE_GAP_TX_POWER_ROLE_CONN, this value is the specific connection handle.
     *                     - If role is @ref BLE_GAP_TX_POWER_ROLE_ADV, the advertising set identified with the advertising handle,
     *                       will use the specified transmit power, and include it in the advertising packet headers if
     *                       @ref ble_gap_adv_properties_t::include_tx_power set.
     *                     - For all other roles handle is ignored.
     * @param[in] tx_power Radio transmit power in dBm (see note for accepted values).
     *
      * @note Supported tx_power values: -40dBm, -20dBm, -16dBm, -12dBm, -8dBm, -4dBm, 0dBm, +2dBm, +3dBm, +4dBm, +5dBm, +6dBm, +7dBm and +8dBm.
      * @note The initiator will have the same transmit power as the scanner.
     * @note When a connection is created it will inherit the transmit power from the initiator or
     *       advertiser leading to the connection.
     *
     * @retval ::NRF_SUCCESS Successfully changed the transmit power.
     * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
     * @retval ::BLE_ERROR_INVALID_ADV_HANDLE Advertising handle not found.
     * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
     */
    SVCALL(SD_BLE_GAP_TX_POWER_SET, uint32_t, sd_ble_gap_tx_power_set(uint8_t role, uint16_t handle, int8_t tx_power));

    If you look at the first parameter, uint8_t role, one of these three defines can be used:

    /**@brief GAP TX Power roles.
     */
    enum BLE_GAP_TX_POWER_ROLES
    {
      BLE_GAP_TX_POWER_ROLE_ADV       = 1,           /**< Advertiser role. */
      BLE_GAP_TX_POWER_ROLE_SCAN_INIT = 2,           /**< Scanner and initiator role. */
      BLE_GAP_TX_POWER_ROLE_CONN      = 3,           /**< Connection role. */
    };

    Looking at your code, you want BLE_GAP_TX_POWER_ROLE_SCAN_INIT. If you look at the API documentation for sd_ble_gap_tx_power_set, you see that by using this role, the next input should be NULL. The third input looks fine.

    To summarize, try:

    sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_SCAN_INIT, NULL, 4);

    Best regards,

    Andreas

  • Hi Andreas,

    I changed my arguments.

    sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, BLE_GAP_TX_POWER_ROLE_ADV, 4);

    what is the standard beacon configuration in nrf52840.

  • Hi.

    mayuri said:
    what is the standard beacon configuration in nrf52840.

     What do you mean by standard beacon configuration? Advertising interval? TX Power?

    Best regards,

    Andreas

  • Is there standard Ble configuration in location mapping? like major,minor,uuid,txpower....

  • Hi.

    There is nothing called standard BLE configuration that makes the contents of the beacon dependent on the variant of the device. If that is not what you are asking, maybe you are asking about the location in the file where you change these settings, in that case, my reply a month ago is still valid.

    Best regards,

    Andreas

Related