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

Can't advertise custom service on 52832

Hello,
I'm trying to port my working project from 52811 to 52832
Both are on SDK 16.0.0, SD 7.0.1

Here is the advertising code that works on 52811 :

#define BLE_UUID_XYZ_SERVICE 0x0001
#define XYZ_SERVICE_UUID_TYPE   BLE_UUID_TYPE_VENDOR_BEGIN 

static ble_uuid_t m_adv_uuids[] =
{
    {BLE_UUID_XYZ_SERVICE , XYZ_SERVICE_UUID_TYPE}
};

static void advertising_init(void)
{
    uint32_t                    err_code;
    ble_advertising_init_t      init;
    ble_advdata_manuf_data_t    adv_manuf_data;

    memset(&init, 0, sizeof(init));

    init.advdata.name_type               = BLE_ADVDATA_FULL_NAME;
    init.advdata.include_appearance      = false;
    init.advdata.uuids_complete.uuid_cnt = 1;
    init.advdata.uuids_complete.p_uuids  = m_adv_uuids;
    init.advdata.uuids_more_available.uuid_cnt = 0;

    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;
    
    // Advertising mac address as custom data
    adv_manuf_data.data.p_data        = macAdress;
    adv_manuf_data.data.size          = 6;
    adv_manuf_data.company_identifier = 1111;
    init.srdata.p_manuf_specific_data     = &adv_manuf_data;
    
    err_code = ble_advertising_init(&m_advertising, &init);
    APP_ERROR_CHECK(err_code);
    ble_advertising_conn_cfg_tag_set(&m_advertising, APP_BLE_CONN_CFG_TAG);
}

This code crashes on the 52832, in ble_advertising_init -> ble_advdata_encode -> uuid_list_encode -> uuid_list_sized_encode -> sd_ble_uuid_encode
It either returns error code 0x3001 or crashes later if I comment some parts (like hardcoding return value of uuid_list_sized_encode)

I supected the custom data part (init.srdata.p_manuf_specific_data) but commenting these 4 lines doesn't make it work. Without these, it's very similar to the code of ble_app_uart_pca10040

I'm out of ideas, what can go wrong ? 

Parents Reply Children
  • Hello QuentinFarizon,

    QuentinFarizon said:
    Ok fixing RAM placement fixed the issue

    I am happy to hear that you were able to identify and resolve your issue!
    Updating RAM placement is a common source of error when migrating from one SoC to another.

    For future reference, I recommend that you define DEBUG in your preprocessor defines, like shown in the included image. This way, a detailed error message will be written out to your logger backend whenever a non-NRF_SUCCESS error code is passed to an APP_ERROR_CHECK.
    This way, you will be alerted whenever a function fails, and you will know what caused the failure by looking intothe error code's meaning in the returning functions API Reference.


    Please do not hesitate to open another ticket if you should encounter any issues or questions in the future.

    Good luck with your development!

    Best regards,
    Karl 

Related