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

AltBeacon Advertising Error

Hello support team,

  1. Setup details
    1. Board: NRF52-DK (PCA10040);
    2. Chipset: N52832;
    3. Platform: Windows 8.1;
    4. IDE: SES;
    5. SDK: S132 15.2.0;
    6. SW code base: examples/ble_peripheral/ble_app_beacon;
  2. Issue
    1. I am trying to modify the "manufacturer specific advertising data" according to the AltBeacon protocol (AltBeacon Specs);
    2. The following changes have been made to the original code:
      #define ALT_BEACON_LENGTH               0x1B                                  /**< Length of the type and data portion of the Manufacturer Specific advertising data structure. */
      #define ALT_TYPE                        0xFF                                  /**< Type representing the Manufacturer Specific advertising data structure. */
      #define ALT_MFG_ID                      0xFF, 0xFF                            /**< The beacon device manufacturer's company identifier code. */
      #define ALT_BEACON_CODE                 0xBE, 0xAC                                /**< The AltBeacon advertisement code */
      #define ALT_BEACON_ID                   0x11, 0x11, 0x11, 0x11, \
                                              0x22, 0x22, 0x22, 0x22, \
                                              0x33, 0x33, 0x33, 0x33, \
                                              0x44, 0x44, 0x44, 0x44, \
                                              0x55, 0x55, 0x55, 0x55                /**< A 20-byte value uniquely identifying the beacon. */
      #define ALT_REFERENCE_RSSI              0xC3                                  /**< A 1-byte value representing the average received signal strength at 1m from the advertiser. */
      #define ALT_MFG_RESERVED                0x00                                  /**< Reserved for use by the manufacturer to implement special features. */
      
      static uint8_t m_beacon_info[ALT_BEACON_LENGTH + 1] =                    /**< Information advertised by the AltBeacon. */
      {
          ALT_BEACON_LENGTH,
          ALT_TYPE,
          ALT_MFG_ID,
          ALT_BEACON_CODE,
          ALT_BEACON_ID,
          ALT_REFERENCE_RSSI,
          ALT_MFG_RESERVED
      };
      
      static void advertising_init(void)
      {
          uint32_t      err_code;
          ble_advdata_t advdata;
          uint8_t       flags = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED;
      
          ble_advdata_manuf_data_t manuf_specific_data;
      
          manuf_specific_data.company_identifier = ALT_MFG_ID;
          manuf_specific_data.data.p_data = (uint8_t *) m_beacon_info;
          manuf_specific_data.data.size   = ALT_BEACON_LENGTH + 1;
      
          // Build and set advertising data.
          memset(&advdata, 0, sizeof(advdata));
      
          advdata.name_type             = BLE_ADVDATA_NO_NAME;
          advdata.flags                 = flags;
          advdata.p_manuf_specific_data = &manuf_specific_data;
      
          // Initialize advertising parameters (used when starting advertising).
          memset(&m_adv_params, 0, sizeof(m_adv_params));
      
          m_adv_params.properties.type = BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED;
          m_adv_params.p_peer_addr     = NULL;    // Undirected advertisement.
          m_adv_params.filter_policy   = BLE_GAP_ADV_FP_ANY;
          m_adv_params.interval        = NON_CONNECTABLE_ADV_INTERVAL;
          m_adv_params.duration        = 0;       // Never time out.
      
          err_code = ble_advdata_encode(&advdata, m_adv_data.adv_data.p_data, &m_adv_data.adv_data.len);
          APP_ERROR_CHECK(err_code);
      
          err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data, &m_adv_params);
          APP_ERROR_CHECK(err_code);
      }
    3. When I enable the NRF_LOG_BACKEND_RTT_ENABLED the Debug Terminal displays: <error> app: Fatal error (from: advertising_init());
    4. I am not sure if the AltBeacon Advertisement Package fits in the manufacturer specific adverising data (see link) or if some fields should be included in other data fields from the advertising PDU;
  3. What am I trying to accomplish
    1. Advertise using AltBeacon advertising format;

Please let me know if you need any more information about my setup.

Thank you,

Vlad

Related