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

NRF51 to NRF52 - ble_advertising : NRF_ERROR_INVALID_PARAM

Hi

we are switching from NRF51 to NRF52.

Putting the same (very basic) inits for sd and advertising, leads to NRF_ERROR_INVALID_PARAM..

This is my source:

#define APP_ADV_INTERVAL                64
#define APP_ADV_TIMEOUT_IN_SECONDS      4

static void advertising_init(void)
{
	uint32_t      err_code;
	ble_advdata_t advdata;
	ble_advdata_t scanrsp;

	ble_uuid_t m_adv_uuids[] = {
			{BLE_UUID_SERVICE, m_metas_conf.uuid_type}
	};

	// Build advertising data struct to pass into @ref ble_advertising_init.
	memset(&advdata, 0, sizeof(advdata));
	advdata.name_type			= BLE_ADVDATA_FULL_NAME;
	advdata.include_appearance	= false;
	advdata.flags				= BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;

	memset(&scanrsp, 0, sizeof(scanrsp));
	scanrsp.name_type				= BLE_ADVDATA_FULL_NAME;
	scanrsp.include_ble_device_addr = false;
	scanrsp.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
	scanrsp.uuids_complete.p_uuids  = m_adv_uuids;

	ble_adv_modes_config_t options = {0};
	options.ble_adv_fast_enabled  = BLE_ADV_FAST_ENABLED;
	options.ble_adv_fast_interval = APP_ADV_INTERVAL;
	options.ble_adv_fast_timeout  = APP_ADV_TIMEOUT_IN_SECONDS;

	err_code = ble_advertising_init(&advdata, &scanrsp, &options, on_adv_evt, NULL);
	APP_ERROR_CHECK(err_code);
}

int main(void)
{
	uint32_t err_code;

	ble_stack_init();
	gap_params_init();
	services_init();
	advertising_init();

	sd_ble_gap_address_get(&m_devAddress);

	err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
	APP_ERROR_CHECK(err_code);

	for (;;)
	{
		power_manage();
	}
}

Any hints what could be wrong with this config? It works nicely on NRF51...

Related