Hello,
I've been trying to figure why calling sd_ble_gap_tx_power_set() continues to return the error NRF_ERROR_NO_MEM. I'm using SDK 17.0.2 with S113, v7.2.0 on the NRF52840.
I've seen previous posted regarding other Softdevice function calls failing with NRF_ERROR_NO_MEM, but all attempts to limit MTU and GAP_LENGTH in sdk_config.h failed.
I even tried rebuilding the project with S140, but still, my application code errors out with NRF_ERROR_NO_MEM.
ret_code_t err_code = NRF_SUCCESS; ble_advertising_init_t bleAdvInitData; // Initialize to zero. memset( &bleAdvInitData, 0, sizeof( bleAdvInitData ) ); // Set the Tx power before we begin advertisement. Radio transmit power in // dBm (accepted values are ONLY -40, -20, -16, -12, -8, -4, 0, and 4 dBm). // Note: Testing with the base station found that TX_POWER_HIGH_SECURITY set // the transmit strength too low for consistent log transfers. txPower_t calaTxPower = TX_POWER_MEDIUM_SECURITY; ble_uuid_t adv_uuids[] = { { BTS_UUID_SERVICE, m_bts.uuid_type } }; // BTS // Build advertising data struct to pass into @ref ble_advertising_init. bleAdvInitData.advdata.name_type = BLE_ADVDATA_FULL_NAME; bleAdvInitData.advdata.include_appearance = true; bleAdvInitData.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE; memset( &bleAdvInitData.srdata, 0, sizeof( bleAdvInitData.srdata ) ); bleAdvInitData.srdata.uuids_complete.uuid_cnt = sizeof( adv_uuids ) / sizeof( adv_uuids[0] ); bleAdvInitData.srdata.uuids_complete.p_uuids = adv_uuids; bleAdvInitData.config.ble_adv_fast_enabled = true; bleAdvInitData.config.ble_adv_fast_interval = APP_ADV_INTERVAL; bleAdvInitData.config.ble_adv_fast_timeout = APP_ADV_NEVER_TIMEOUT; bleAdvInitData.evt_handler = on_adv_evt; // Set the Tx power (rely on compiler type promotion to int8_t here): err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, m_connHandle, calaTxPower); if ( err_code != NRF_SUCCESS ) { NRF_LOG_INFO( "sd_ble_gap_tx_power_set() failed, err_code: 0x%X\n", err_code ); }