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

Experimental Eddystone from SDK 11

nRF5_SDK_11.0.0_new\examples\ble_peripheral\experimental_ble_app_eddystone\pca10028\s130\arm5_no_packs

Using the above mentioned example on a custom board with nf51822. i want to transmit both eddystone uid and tlm frames at the same time is this possible?

Also is there any system call that can be used to load the instance id with the mac id in the main.c code itself. 

if yes, please guide me to do the above mentioned tasks.

Parents
  • Hi,

    The experimental Eddystone example in SDK 11 does not support multiple frames, but you can upgrade to SDK 12.3.0 which support up to 5 frames (Eddystone Beacon Application).  

    Also is there any system call that can be used to load the instance id with the mac id in the main.c code itself. 

     Yes, you can use sd_ble_gap_address_get() for this. 

  • Please help me out on where can i use this statement ?

    Can i use it along with the define statements in the main.c in the definition of instance id? If i am using this statement is there any other parameters i need to consider. I am new to the nordic development environment, thank you.

  • static void advertising_init(void)
    {
    uint32_t err_code;
    ble_advdata_t advdata;
    uint8_t flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    ble_uuid_t adv_uuids[] = {{APP_EDDYSTONE_UUID, BLE_UUID_TYPE_BLE}};

    ble_gap_addr_t *p_mac1;
    sd_ble_gap_address_get(p_mac1);
    eddystone_uid_data[3] = (uint8_t) p_mac1;

    uint8_array_t eddystone_data_array; // Array for Service Data structure.
    /** @snippet [Eddystone data array] */
    eddystone_data_array.p_data = (uint8_t *) eddystone_uid_data; // Pointer to the data to advertise.
    eddystone_data_array.size = sizeof(eddystone_uid_data); // Size of the data to advertise.
    /** @snippet [Eddystone data array] */

    ble_advdata_service_data_t service_data; // Structure to hold Service Data.
    service_data.service_uuid = APP_EDDYSTONE_UUID; // Eddystone UUID to allow discoverability on iOS devices.
    service_data.data = eddystone_data_array; // Array for service advertisement data.

    // Build and set advertising data.
    memset(&advdata, 0, sizeof(advdata));

    advdata.name_type = BLE_ADVDATA_NO_NAME;
    advdata.flags = flags;
    advdata.uuids_complete.uuid_cnt = sizeof(adv_uuids) / sizeof(adv_uuids[0]);
    advdata.uuids_complete.p_uuids = adv_uuids;
    advdata.p_service_data_array = &service_data; // Pointer to Service Data structure.
    advdata.service_data_count = 1;

    err_code = ble_advdata_set(&advdata, NULL);
    APP_ERROR_CHECK(err_code);

    // Initialize advertising parameters (used when starting advertising).
    memset(&m_adv_params, 0, sizeof(m_adv_params));

    m_adv_params.type = BLE_GAP_ADV_TYPE_ADV_NONCONN_IND;
    m_adv_params.p_peer_addr = NULL; // Undirected advertisement.
    m_adv_params.fp = BLE_GAP_ADV_FP_ANY;
    m_adv_params.interval = NON_CONNECTABLE_ADV_INTERVAL;
    m_adv_params.timeout = APP_CFG_NON_CONN_ADV_TIMEOUT;
    }

    This is where i used the function call but there was no change in the advertising data.

    sd_ble_gap_address_get()
Reply
  • static void advertising_init(void)
    {
    uint32_t err_code;
    ble_advdata_t advdata;
    uint8_t flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    ble_uuid_t adv_uuids[] = {{APP_EDDYSTONE_UUID, BLE_UUID_TYPE_BLE}};

    ble_gap_addr_t *p_mac1;
    sd_ble_gap_address_get(p_mac1);
    eddystone_uid_data[3] = (uint8_t) p_mac1;

    uint8_array_t eddystone_data_array; // Array for Service Data structure.
    /** @snippet [Eddystone data array] */
    eddystone_data_array.p_data = (uint8_t *) eddystone_uid_data; // Pointer to the data to advertise.
    eddystone_data_array.size = sizeof(eddystone_uid_data); // Size of the data to advertise.
    /** @snippet [Eddystone data array] */

    ble_advdata_service_data_t service_data; // Structure to hold Service Data.
    service_data.service_uuid = APP_EDDYSTONE_UUID; // Eddystone UUID to allow discoverability on iOS devices.
    service_data.data = eddystone_data_array; // Array for service advertisement data.

    // Build and set advertising data.
    memset(&advdata, 0, sizeof(advdata));

    advdata.name_type = BLE_ADVDATA_NO_NAME;
    advdata.flags = flags;
    advdata.uuids_complete.uuid_cnt = sizeof(adv_uuids) / sizeof(adv_uuids[0]);
    advdata.uuids_complete.p_uuids = adv_uuids;
    advdata.p_service_data_array = &service_data; // Pointer to Service Data structure.
    advdata.service_data_count = 1;

    err_code = ble_advdata_set(&advdata, NULL);
    APP_ERROR_CHECK(err_code);

    // Initialize advertising parameters (used when starting advertising).
    memset(&m_adv_params, 0, sizeof(m_adv_params));

    m_adv_params.type = BLE_GAP_ADV_TYPE_ADV_NONCONN_IND;
    m_adv_params.p_peer_addr = NULL; // Undirected advertisement.
    m_adv_params.fp = BLE_GAP_ADV_FP_ANY;
    m_adv_params.interval = NON_CONNECTABLE_ADV_INTERVAL;
    m_adv_params.timeout = APP_CFG_NON_CONN_ADV_TIMEOUT;
    }

    This is where i used the function call but there was no change in the advertising data.

    sd_ble_gap_address_get()
Children
  • Hi,

    it looks like you are writing one byte of your pointer value to  APP_EDDYSTONE_UID_NAMESPACE. 

    Try to replace this code:

    ble_gap_addr_t *p_mac1;
    sd_ble_gap_address_get(p_mac1);
    eddystone_uid_data[3] = (uint8_t) p_mac1;

    With this:

    ble_gap_addr_t addr;

    err_code = sd_ble_gap_address_get(&addr);
    APP_ERROR_CHECK(err_code);

    /*Offset of APP_EDDYSTONE_UID_ID = APP_EDDYSTONE_UID_FRAME_TYPE+APP_EDDYSTONE_RSSI+APP_EDDYSTONE_UID_NAMESPACE*/
    memcpy(&eddystone_uid_data[12], addr.addr, sizeof(addr.addr));

    Edit: you should use SDK 12.3.0. The eddistone example was in an experimental state in SDK 11. 

  • Sir, Sorry for the delayed reply. But I am not able to run the SDK 12.3.0 examples on this board when I contacted the vendor, I got this response -

    "It seems  that your firmware need to use crystal oscillators as Nordic's official routine use it, but our F3 with 51822 nordic chip si without  crystal oscillators.

    So now our engineer guess that is the reason firmware fail to work when load to F3 devices."

    Can you suggest any solutions please?

  • No problem. All SDK examples are configured to use the optional 32KHz crystal as the low-frequency clock source. You should make the following changes to main.c to use the internal RC oscillator if your board doesn't have a LF crystal:

    diff --git a/examples/ble_peripheral/ble_app_eddystone/main.c b/examples/ble_peripheral/ble_app_eddystone/main.c
    index 07e7355..c639921 100644
    --- a/examples/ble_peripheral/ble_app_eddystone/main.c
    +++ b/examples/ble_peripheral/ble_app_eddystone/main.c
    @@ -203,10 +203,10 @@ static void ble_stack_init(void)
         ret_code_t         err_code;
         nrf_clock_lf_cfg_t lf_clock_config;
     
    -    lf_clock_config.source        = NRF_CLOCK_LF_SRC_XTAL;
    -    lf_clock_config.rc_ctiv       = 0;
    -    lf_clock_config.rc_temp_ctiv  = 0;
    -    lf_clock_config.xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM;
    +    lf_clock_config.source        = NRF_CLOCK_LF_SRC_RC;
    +    lf_clock_config.rc_ctiv       = 8;
    +    lf_clock_config.rc_temp_ctiv  = 1;
    +    lf_clock_config.xtal_accuracy = 0; 
     
         // Initialize the SoftDevice handler module.
         SOFTDEVICE_HANDLER_INIT(&lf_clock_config, NULL);

  • ble_gap_addr_t addr;

    err_code = sd_ble_gap_address_get(&addr);
    APP_ERROR_CHECK(err_code);

    /*Offset of APP_EDDYSTONE_UID_ID = APP_EDDYSTONE_UID_FRAME_TYPE+APP_EDDYSTONE_RSSI+APP_EDDYSTONE_UID_NAMESPACE*/
    memcpy(&eddystone_uid_data[12], addr.addr, sizeof(addr.addr));

    I tried this it , I has reserved the entire data. How to get it the right way?

  • Please help with the quoted issue

    I tried this it , I has reserved the entire data. How to get it the right way?
Related