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

sd_ble_uuid_vs_add () returns err_code = 16 (#define NRF_ERROR_INVALID_ADDR (NRF_ERROR_BASE_NUM + 16) ///< Bad Memory Address)

Hi, I am using nRF52832 with S132 softdevice and SDK version 11. I am getting bad memory address error code.

err_code = sd_ble_uuid_vs_add (&base_uuid, &ble_service->uuid_type);
if (err_code != NRF_SUCCESS){
SEGGER_RTT_printf(0, "err_code: %d \n", err_code);
return err_code;
}

Can anybody help me to figure out what could be the reason for such errors? Thank!

Parents
  • Okay, hey I want to bring one more info, that may help you to understand the problem. I am not able to step into gap_params_init();. main() look likes this

    ble_stack_init();
      device_manager_init(true);
      gap_params_init();
      services_init();
      advertising_init();
      conn_params_init();
      // Start execution.
      err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
      APP_ERROR_CHECK(err_code);
    

    and gap_params_init()

    static void gap_params_init(void)
    {
        uint32_t                err_code;
        ble_gap_conn_params_t   gap_conn_params;  	        // Struct to store GAP connection parameters like max min connection interval etc
        ble_gap_conn_sec_mode_t sec_mode;     		// Struct to store security parameters
    
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
    
        // Store the device name and security mode in the SoftDevice. Our name is defined to "HelloWorld" in the beginning of this file
        err_code = sd_ble_gap_device_name_set(&sec_mode,
                                              (const uint8_t *)DEVICE_NAME,
                                              strlen(DEVICE_NAME));
        APP_ERROR_CHECK(err_code); // Check for errors
    
        // Always initialize all fields in structs to zero or you might get unexpected behaviour
        memset(&gap_conn_params, 0, sizeof(gap_conn_params));
    
        // Populate the GAP connection parameter struct
        gap_conn_params.min_conn_interval = MIN_CONN_INTERVAL;
        gap_conn_params.max_conn_interval = MAX_CONN_INTERVAL;
        gap_conn_params.slave_latency     = SLAVE_LATENCY;
        gap_conn_params.conn_sup_timeout  = CONN_SUP_TIMEOUT;
    
        // Set GAP Peripheral Preferred Connection Parameters
        // The device use these prefered values when negotiating connection terms with another device
        err_code = sd_ble_gap_ppcp_set(&gap_conn_params);
        APP_ERROR_CHECK(err_code);
                                              
        // Set appearence                     
        sd_ble_gap_appearance_set(0);
        APP_ERROR_CHECK(err_code);                                          
    }
    

    As you asked in your last comment base_uuid address is 20002FBC. I can't tell you ble_service_uuid because I can't reach to that part of code, debugger stopped.

Reply
  • Okay, hey I want to bring one more info, that may help you to understand the problem. I am not able to step into gap_params_init();. main() look likes this

    ble_stack_init();
      device_manager_init(true);
      gap_params_init();
      services_init();
      advertising_init();
      conn_params_init();
      // Start execution.
      err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
      APP_ERROR_CHECK(err_code);
    

    and gap_params_init()

    static void gap_params_init(void)
    {
        uint32_t                err_code;
        ble_gap_conn_params_t   gap_conn_params;  	        // Struct to store GAP connection parameters like max min connection interval etc
        ble_gap_conn_sec_mode_t sec_mode;     		// Struct to store security parameters
    
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
    
        // Store the device name and security mode in the SoftDevice. Our name is defined to "HelloWorld" in the beginning of this file
        err_code = sd_ble_gap_device_name_set(&sec_mode,
                                              (const uint8_t *)DEVICE_NAME,
                                              strlen(DEVICE_NAME));
        APP_ERROR_CHECK(err_code); // Check for errors
    
        // Always initialize all fields in structs to zero or you might get unexpected behaviour
        memset(&gap_conn_params, 0, sizeof(gap_conn_params));
    
        // Populate the GAP connection parameter struct
        gap_conn_params.min_conn_interval = MIN_CONN_INTERVAL;
        gap_conn_params.max_conn_interval = MAX_CONN_INTERVAL;
        gap_conn_params.slave_latency     = SLAVE_LATENCY;
        gap_conn_params.conn_sup_timeout  = CONN_SUP_TIMEOUT;
    
        // Set GAP Peripheral Preferred Connection Parameters
        // The device use these prefered values when negotiating connection terms with another device
        err_code = sd_ble_gap_ppcp_set(&gap_conn_params);
        APP_ERROR_CHECK(err_code);
                                              
        // Set appearence                     
        sd_ble_gap_appearance_set(0);
        APP_ERROR_CHECK(err_code);                                          
    }
    

    As you asked in your last comment base_uuid address is 20002FBC. I can't tell you ble_service_uuid because I can't reach to that part of code, debugger stopped.

Children
No Data
Related