diff --git a/doc/releases/migration-guide-4.2.rst b/doc/releases/migration-guide-4.2.rst index faad669e379..08a2a3d0e33 100644 --- a/doc/releases/migration-guide-4.2.rst +++ b/doc/releases/migration-guide-4.2.rst @@ -410,6 +410,10 @@ Bluetooth HCI have been deprecated, but are still usable, with the exception that they can only be called once per buffer. +* The :c:func:`bt_hci_cmd_create` function has been depracated and the new :c:func:`bt_hci_cmd_alloc` + function should be used instead. The new function takes no parameters because the command + sending functions have been updated to do the command header encoding. + Bluetooth Host ============== diff --git a/drivers/bluetooth/hci/Kconfig.nxp b/drivers/bluetooth/hci/Kconfig.nxp index 1f6983ee989..9fb0850fa8e 100644 --- a/drivers/bluetooth/hci/Kconfig.nxp +++ b/drivers/bluetooth/hci/Kconfig.nxp @@ -13,14 +13,14 @@ config HCI_NXP_ENABLE_AUTO_SLEEP message to the Controller as the Host will need to wake it up. config HCI_NXP_SET_CAL_DATA - bool "BLE Controller calibration data" + bool "Bluetooth Controller calibration data" help - If enabled, the Host will send calibration data to the BLE Controller during HCI init. + If enabled, the Host will send calibration data to the Bluetooth Controller during HCI init. config HCI_NXP_SET_CAL_DATA_ANNEX100 - bool "BLE Controller calibration data annex 100" + bool "Bluetooth Controller calibration data annex 100" help - If enabled, the Host will send calibration data annex 100 to the BLE Controller during HCI + If enabled, the Host will send calibration data annex 100 to the Bluetooth Controller during HCI init. config HCI_NXP_RX_THREAD diff --git a/drivers/bluetooth/hci/apollox_blue.c b/drivers/bluetooth/hci/apollox_blue.c index 1fb2ab33fb1..9a4bf5440d8 100644 --- a/drivers/bluetooth/hci/apollox_blue.c +++ b/drivers/bluetooth/hci/apollox_blue.c @@ -396,8 +396,7 @@ static int bt_apollo_set_nvds(void) #else uint8_t *p; - buf = bt_hci_cmd_create(HCI_VSC_UPDATE_NVDS_CFG_CMD_OPCODE, - HCI_VSC_UPDATE_NVDS_CFG_CMD_LENGTH); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } diff --git a/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c b/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c index 6bc563fb9f2..e115ea92b47 100644 --- a/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c +++ b/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c @@ -122,8 +122,7 @@ static int bt_update_controller_baudrate(const struct device *bt_uart_dev, uint3 /* Allocate buffer for update uart baudrate command. * It will be BT_HCI_OP_RESET with extra parameters. */ - buf = bt_hci_cmd_create(BT_HCI_VND_OP_UPDATE_BAUDRATE, - HCI_VSC_UPDATE_BAUD_RATE_LENGTH); + buf = bt_hci_cmd_alloc(K_FOREVER); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); return -ENOMEM; @@ -172,7 +171,7 @@ static int bt_firmware_download(const uint8_t *firmware_image, uint32_t size) uint16_t op_code = *(uint16_t *)data; /* Allocate buffer for hci_write_ram/hci_launch_ram command. */ - buf = bt_hci_cmd_create(op_code, data_length); + buf = bt_hci_cmd_alloc(K_FOREVER); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); return err; diff --git a/drivers/bluetooth/hci/hci_ifx_cyw208xx.c b/drivers/bluetooth/hci/hci_ifx_cyw208xx.c index 1fee53436a6..913d19d514c 100644 --- a/drivers/bluetooth/hci/hci_ifx_cyw208xx.c +++ b/drivers/bluetooth/hci/hci_ifx_cyw208xx.c @@ -146,7 +146,7 @@ static int cyw208xx_bt_firmware_download(const uint8_t *firmware_image, uint32_t } /* Allocate buffer for hci_write_ram/hci_launch_ram command. */ - buf = bt_hci_cmd_create(op_code, data_length); + buf = bt_hci_cmd_alloc(K_FOREVER); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); return -ENOBUFS; @@ -211,7 +211,7 @@ static int cyw208xx_setup(const struct device *dev, const struct bt_hci_setup_pa cybt_platform_hci_wait_for_boot_fully_up(false); /* Set public address */ - buf = bt_hci_cmd_create(BT_HCI_VND_OP_SET_LOCAL_DEV_ADDR, BTM_SET_LOCAL_DEV_ADDR_LENGTH); + buf = bt_hci_cmd_alloc(K_FOREVER); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); cyhal_syspm_unlock_deepsleep(); @@ -375,7 +375,7 @@ wiced_bt_dev_vendor_specific_command(uint16_t opcode, uint8_t param_len, uint8_t struct net_buf *buf = NULL; /* Allocate a HCI command buffer */ - buf = bt_hci_cmd_create(opcode, param_len); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { LOG_ERR("Unable to allocate buffer"); return WICED_NO_MEMORY; diff --git a/drivers/bluetooth/hci/hci_ifx_psoc6_bless.c b/drivers/bluetooth/hci/hci_ifx_psoc6_bless.c index db50091c8ae..531a3439d91 100644 --- a/drivers/bluetooth/hci/hci_ifx_psoc6_bless.c +++ b/drivers/bluetooth/hci/hci_ifx_psoc6_bless.c @@ -203,7 +203,7 @@ static int psoc6_bless_setup(const struct device *dev, const struct bt_hci_setup addr[5], addr[4], addr[3], addr[2], addr[1], addr[0], BT_ADDR_LE_PUBLIC, }; - buf = bt_hci_cmd_create(PSOC6_BLESS_OP_SET_PUBLIC_ADDR, sizeof(hci_data)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); return -ENOMEM; diff --git a/drivers/bluetooth/hci/hci_nxp.c b/drivers/bluetooth/hci/hci_nxp.c index 2cd5511e7c7..a540e264ac0 100644 --- a/drivers/bluetooth/hci/hci_nxp.c +++ b/drivers/bluetooth/hci/hci_nxp.c @@ -94,7 +94,7 @@ static int nxp_bt_send_vs_command(uint16_t opcode, const uint8_t *params, uint8_ struct net_buf *buf; /* Allocate buffer for the hci command */ - buf = bt_hci_cmd_create(opcode, params_len); + buf = bt_hci_cmd_alloc(K_FOREVER); if (buf == NULL) { LOG_ERR("Unable to allocate command buffer"); return -ENOMEM; diff --git a/drivers/bluetooth/hci/hci_nxp_setup.c b/drivers/bluetooth/hci/hci_nxp_setup.c index 6fa34d0a24e..a89e1ede677 100644 --- a/drivers/bluetooth/hci/hci_nxp_setup.c +++ b/drivers/bluetooth/hci/hci_nxp_setup.c @@ -29,13 +29,25 @@ LOG_MODULE_REGISTER(bt_nxp_ctlr); #define DT_DRV_COMPAT nxp_bt_hci_uart -#define FW_UPLOAD_CHANGE_TIMEOUT_RETRY_COUNT 6 +#define FW_UPLOAD_CHANGE_TIMEOUT_RETRY_COUNT 6 +#define HCI_CMD_STORE_BT_CAL_DATA_ANNEX100_OCF 0xFF +#define HCI_CMD_STORE_BT_CAL_DATA_PARAM_ANNEX100_LENGTH 16 +#define HCI_CMD_STORE_BT_CAL_DATA_OCF 0x61 +#define HCI_CMD_STORE_BT_CAL_DATA_PARAM_LENGTH 32 extern const unsigned char *bt_fw_bin; extern const unsigned int bt_fw_bin_len; static const struct device *uart_dev = DEVICE_DT_GET(DT_INST_GPARENT(0)); +#if !defined(CONFIG_HCI_NXP_SET_CAL_DATA) +#define bt_nxp_set_calibration_data_annex55() 0 +#endif + +#if !defined(CONFIG_HCI_NXP_SET_CAL_DATA_ANNEX100) +#define bt_nxp_set_calibration_data_annex100() 0 +#endif + #if DT_NODE_HAS_PROP(DT_DRV_INST(0), sdio_reset_gpios) struct gpio_dt_spec sdio_reset = GPIO_DT_SPEC_GET(DT_DRV_INST(0), sdio_reset_gpios); #endif /* DT_NODE_HAS_PROP(DT_DRV_INST(0), sdio_reset_gpios) */ @@ -1171,6 +1183,189 @@ static int bt_nxp_ctlr_init(void) return 0; } +#if defined(CONFIG_HCI_NXP_SET_CAL_DATA) + +static int bt_nxp_set_calibration_data_annex55(void) +{ + int ret = 0; + uint16_t opcode = BT_OP(BT_OGF_VS, HCI_CMD_STORE_BT_CAL_DATA_OCF); + + const uint8_t hci_cal_data_annex55[HCI_CMD_STORE_BT_CAL_DATA_PARAM_LENGTH] = { +#if defined(CONFIG_BT_NXP_NW612) + 0x00, /* Sequence Number : 0x00 */ + 0x01, /* Action : 0x01 */ + 0x01, /* Type : Not use CheckSum */ + 0x1C, /* File Length : 0x1C */ + 0x37, /* BT Annex Type : BT CFG */ + 0x33, /* Checksum : 0x71 */ + 0x1C, /* Annex Length LSB: 0x001C */ + 0x00, /* Annex Length MSB: 0x001C */ + 0x00, /* Pointer For Next Annex[0] : 0x00000000 */ + 0x00, /* Pointer For Next Annex[1] : 0x00000000 */ + 0x00, /* Pointer For Next Annex[2] : 0x00000000 */ + 0x00, /* Pointer For Next Annex[3] : 0x00000000 */ + 0x01, /* Annex Version : 0x01 */ + 0x81, /* External Xtal Calibration Value : 0x7d */ + 0x0D, /* Initial TX Power : 13 */ + 0x07, /* Front End Loss : 0x07 */ + 0x28, /* BT Options : */ + /* BIT[0] Force Class 2 operation = 0 */ + /* BIT[1] Disable Pwr-ctrl for class 2=0 */ + /* BIT[2] MiscFlg(to indicate ext.XTAL)=0 */ + /* BIT[3] Used Internal Sleep Clock = 1 */ + /* BIT[4] BT AOA location support = 0 */ + /* BIT[5] Force Class 1 mode = 1 */ + /* BIT[7:6] Reserved */ + 0x00, /* AOANumberOfAntennas: 0x00 */ + 0x00, /* RSSI Golden Low : 0 */ + 0x00, /* RSSI Golden High : 0 */ + 0xC0, /* UART Baud Rate[0] : 0x002DC6C0(3000000) */ + 0xC6, /* UART Baud Rate[1] : 0x002DC6C0(3000000) */ + 0x2D, /* UART Baud Rate[2] : 0x002DC6C0(3000000) */ + 0x00, /* UART Baud Rate[3] : 0x002DC6C0(3000000) */ + 0x00, /* BdAddress[0] : 0x000000000000 */ + 0x00, /* BdAddress[1] : 0x000000000000 */ + 0x00, /* BdAddress[2] : 0x000000000000 */ + 0x00, /* BdAddress[3] : 0x000000000000 */ + 0x00, /* BdAddress[4] : 0x000000000000 */ + 0x00, /* BdAddress[5] : 0x000000000000 */ + 0xF0, /* Encr_Key_Len[3:0]: MinEncrKeyLen = 0x0 */ + /* ExEncrKeyLen = 0xF */ + 0x00, /* RegionCode : 0x00 */ +#elif defined(CONFIG_BT_NXP_IW416) + 0x00, /* Sequence Number : 0x00 */ + 0x01, /* Action : 0x01 */ + 0x01, /* Type : Not use CheckSum */ + 0x1C, /* File Length : 0x1C */ + 0x37, /* BT Annex Type : BT CFG */ + 0x33, /* Checksum : 0x71 */ + 0x1C, /* Annex Length LSB: 0x001C */ + 0x00, /* Annex Length MSB: 0x001C */ + 0x00, /* Pointer For Next Annex[0] : 0x00000000 */ + 0x00, /* Pointer For Next Annex[1] : 0x00000000 */ + 0x00, /* Pointer For Next Annex[2] : 0x00000000 */ + 0x00, /* Pointer For Next Annex[3] : 0x00000000 */ + 0x01, /* Annex Version : 0x01 */ + 0x00, /* External Xtal Calibration Value */ + 0x03, /* Initial TX Power : 0x03 */ + 0x03, /* Front End Loss : 0x03 */ + 0x00, /* BT Options : */ + /* BIT[0] Force Class 2 operation = 0 */ + /* BIT[1] Disable Pwr Ctrl for class 2=0 */ + /* BIT[2] MiscFlg(to indicate ext.XTAL)=0 */ + /* BIT[3] Used Internal Sleep Clock = 0 */ + /* BIT[4] BT AOA localtion support = 0 */ + /* BIT[5] Force Class 1 mode = 0 */ + /* BIT[7:6] Reserved */ + 0x00, /* AOANumberOfAntennas: 0x00 */ + 0xBA, /* RSSI Golden Low : 0 */ + 0xCE, /* RSSI Golden High : 0 */ + 0xC0, /* UART Baud Rate[0] : 0x002DC6C0(3000000) */ + 0xC6, /* UART Baud Rate[1] : 0x002DC6C0(3000000) */ + 0x2D, /* UART Baud Rate[2] : 0x002DC6C0(3000000) */ + 0x00, /* UART Baud Rate[3] : 0x002DC6C0(3000000) */ + 0x00, /* BdAddress[0] : 0x000000000000 */ + 0x00, /* BdAddress[1] : 0x000000000000 */ + 0x00, /* BdAddress[2] : 0x000000000000 */ + 0x00, /* BdAddress[3] : 0x000000000000 */ + 0x00, /* BdAddress[4] : 0x000000000000 */ + 0x00, /* BdAddress[5] : 0x000000000000 */ + 0xF0, /* Encr_Key_Len[3:0]: MinEncrKeyLen = 0x0 */ + /* ExEncrKeyLen = 0xF */ + 0x00, /* RegionCode : 0x00 */ +#else +#error "BT Calibration data (annex-55) is not given for selected chipset" +#endif + }; + + if (IS_ENABLED(CONFIG_BT_HCI_HOST)) { + struct net_buf *buf; + + buf = bt_hci_cmd_alloc(K_FOREVER); + if (buf == NULL) { + LOG_ERR("Unable to allocate command buffer"); + return -ENOMEM; + } + + net_buf_add_mem(buf, hci_cal_data_annex55, HCI_CMD_STORE_BT_CAL_DATA_PARAM_LENGTH); + + ret = bt_hci_cmd_send_sync(opcode, buf, NULL); + if (ret) { + LOG_ERR("Failed to send set-calibration cmd (err %d)", ret); + return ret; + } + + (void)k_msleep(CONFIG_BT_H4_NXP_CTLR_WAIT_TIME_AFTER_BAUDRATE_UPDATE); + } + + return ret; +} +#endif /*CONFIG_HCI_NXP_SET_CAL_DATA*/ + +#if defined(CONFIG_HCI_NXP_SET_CAL_DATA_ANNEX100) + +static int bt_nxp_set_calibration_data_annex100(void) +{ + int ret = 0; + const uint8_t hci_cal_data_annex100[HCI_CMD_STORE_BT_CAL_DATA_PARAM_ANNEX100_LENGTH] = { +#if defined(CONFIG_BT_NXP_NW612) + 0x64, /* Annex Type : 0x64 */ + 0x83, /* Checksum */ + 0x10, 0x00, /* Length */ + 0x00, 0x00, 0x00, 0x00, /* Pointer for next Annex-Structure */ + 0x01, /* Ext PA Present (1 bit) + */ + /* Ext. PA Gain (7 bits) */ + 0x00, /* Ext Antenna Gain(1 bit) + */ + /* Ext. Antenna Gain Val(4 bits) */ + 0x04, 0x00, /* BT / LE Ext PA FEM CTRL Bitmask */ + 0x01, /* Ext LNA Present (1 bit) + */ + /* Ext LNA Gain (7 bits) */ + 0x00, /* Reserved */ + 0x04, 0x00 /* BT / LE Ext LNA FEM CTRL Bitmask */ +#elif defined(CONFIG_BT_NXP_IW416) + 0x64, /* Annex Type : 0x64 */ + 0x83, /* Checksum */ + 0x10, 0x00, /* Length */ + 0x00, 0x00, 0x00, 0x00, /* Pointer for next Annex-Structure */ + 0x01, /* Ext PA Present (1 bit) + */ + /* Ext. PA Gain (7 bits) */ + 0x00, /* Ext Antenna Gain(1 bit) + */ + /* Ext. Antenna Gain Val (4 bits) */ + 0x0C, 0x00, /* BT / LE Ext PA FEM CTRL Bitmask */ + 0x01, /* Ext LNA Present (1 bit) + */ + /* Ext LNA Gain (7 bits) */ + 0x00, /* Reserved */ + 0x0C, 0x00 /* BT/LE Ext LNA FEM CTRL Bitmask */ +#else +#error "BT Calibration data (annex-100) is not given for selected chipset" +#endif + }; + + uint16_t opcode = BT_OP(BT_OGF_VS, HCI_CMD_STORE_BT_CAL_DATA_ANNEX100_OCF); + + if (IS_ENABLED(CONFIG_BT_HCI_HOST)) { + struct net_buf *buf; + + buf = bt_hci_cmd_alloc(K_FOREVER); + if (buf == NULL) { + LOG_ERR("Unable to allocate command buffer"); + return -ENOMEM; + } + + net_buf_add_mem(buf, hci_cal_data_annex100, + HCI_CMD_STORE_BT_CAL_DATA_PARAM_ANNEX100_LENGTH); + + ret = bt_hci_cmd_send_sync(opcode, buf, NULL); + if (ret) { + LOG_ERR("Failed to send set-calibration cmd (err %d)", ret); + return ret; + } + } + + return ret; +} +#endif /* defined(CONFIG_HCI_NXP_SET_CAL_DATA_ANNEX100) */ + int bt_hci_transport_setup(const struct device *dev) { int ret = 0; @@ -1192,8 +1387,7 @@ static int bt_hci_baudrate_update(const struct device *dev, uint32_t baudrate) int err; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_VSC_BAUDRATE_UPDATE_OPCODE, - BT_HCI_VSC_BAUDRATE_UPDATE_LENGTH); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { LOG_ERR("Fail to allocate buffer"); return -ENOBUFS; @@ -1231,6 +1425,7 @@ int bt_h4_vnd_setup(const struct device *dev) flowcontrol_of_hci = (bool)DT_PROP_OR(DT_DRV_INST(0), hw_flow_control, false); if (operation_speed == default_speed) { + fw_upload.is_setup_done = true; return 0; } @@ -1240,7 +1435,7 @@ int bt_h4_vnd_setup(const struct device *dev) return err; } - /* BT waiting time after controller bandrate updated */ + /* BT waiting time after controller bandrate updated */ (void)k_msleep(CONFIG_BT_H4_NXP_CTLR_WAIT_TIME_AFTER_BAUDRATE_UPDATE); } @@ -1250,7 +1445,21 @@ int bt_h4_vnd_setup(const struct device *dev) return err; } - fw_upload.is_setup_done = true; + if (!fw_upload.is_setup_done) { + err = bt_nxp_set_calibration_data_annex55(); + if (err) { + LOG_ERR("Fail to load annex-55 calibration data"); + return err; + } + + err = bt_nxp_set_calibration_data_annex100(); + if (err) { + LOG_ERR("Fail to load annex-100 calibration data"); + return err; + } + + fw_upload.is_setup_done = true; + } return 0; } diff --git a/drivers/bluetooth/hci/hci_spi_st.c b/drivers/bluetooth/hci/hci_spi_st.c index e6201ec0475..ebed8ae1ff4 100644 --- a/drivers/bluetooth/hci/hci_spi_st.c +++ b/drivers/bluetooth/hci/hci_spi_st.c @@ -335,7 +335,7 @@ static int bt_spi_send_aci_config(uint8_t offset, const uint8_t *value, size_t v hdr.param_len = data_len; buf = bt_buf_get_tx(BT_BUF_CMD, K_NO_WAIT, &hdr, sizeof(hdr)); #else - buf = bt_hci_cmd_create(BLUENRG_ACI_WRITE_CONFIG_DATA, data_len); + buf = bt_hci_cmd_alloc(K_FOREVER); #endif /* CONFIG_BT_HCI_RAW */ if (!buf) { diff --git a/drivers/bluetooth/hci/hci_stm32wba.c b/drivers/bluetooth/hci/hci_stm32wba.c index 77654e16bea..57bc54c231a 100644 --- a/drivers/bluetooth/hci/hci_stm32wba.c +++ b/drivers/bluetooth/hci/hci_stm32wba.c @@ -432,7 +432,7 @@ static int bt_hci_stm32wba_setup(const struct device *dev, return -ENOMSG; } - buf = bt_hci_cmd_create(ACI_HAL_WRITE_CONFIG_DATA, sizeof(*param)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } diff --git a/drivers/bluetooth/hci/ipm_stm32wb.c b/drivers/bluetooth/hci/ipm_stm32wb.c index 3e0dee023dc..0f61f7c36f7 100644 --- a/drivers/bluetooth/hci/ipm_stm32wb.c +++ b/drivers/bluetooth/hci/ipm_stm32wb.c @@ -433,8 +433,7 @@ static int bt_ipm_set_addr(void) return -ENOMSG; } - buf = bt_hci_cmd_create(ACI_HAL_WRITE_CONFIG_DATA, sizeof(*param)); - + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -468,7 +467,7 @@ static int bt_ipm_ble_init(void) LOG_ERR("Can't set BLE UID addr"); } /* Send ACI_WRITE_SET_TX_POWER_LEVEL */ - buf = bt_hci_cmd_create(ACI_WRITE_SET_TX_POWER_LEVEL, 3); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } diff --git a/include/zephyr/bluetooth/hci.h b/include/zephyr/bluetooth/hci.h index dd9c60c8ae8..cc0843fb7e3 100644 --- a/include/zephyr/bluetooth/hci.h +++ b/include/zephyr/bluetooth/hci.h @@ -56,12 +56,14 @@ static inline const char *bt_hci_err_to_str(uint8_t hci_err) * of the parameters. Upon successful return the buffer is ready to have * the parameters encoded into it. * + * @deprecated Use bt_hci_cmd_alloc() instead. + * * @param opcode Command OpCode. * @param param_len Length of command parameters. * * @return Newly allocated buffer. */ -struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len); +__deprecated struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len); /** Allocate an HCI command buffer. * @@ -80,7 +82,7 @@ struct net_buf *bt_hci_cmd_alloc(k_timeout_t timeout); /** Send a HCI command asynchronously. * * This function is used for sending a HCI command asynchronously. It can - * either be called for a buffer created using bt_hci_cmd_create(), or + * either be called for a buffer created using bt_hci_cmd_alloc(), or * if the command has no parameters a NULL can be passed instead. The * sending of the command will happen asynchronously, i.e. upon successful * return from this function the caller only knows that it was queued @@ -99,7 +101,7 @@ int bt_hci_cmd_send(uint16_t opcode, struct net_buf *buf); /** Send a HCI command synchronously. * * This function is used for sending a HCI command synchronously. It can - * either be called for a buffer created using bt_hci_cmd_create(), or + * either be called for a buffer created using bt_hci_cmd_alloc(), or * if the command has no parameters a NULL can be passed instead. * * The function will block until a Command Status or a Command Complete diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 537cdacf924..c74f0a40d99 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -158,7 +158,7 @@ static int set_adv_randomness(uint8_t handle, int rand_us) struct net_buf *buf; sdc_hci_cmd_vs_set_adv_randomness_t *cmd_params; - buf = bt_hci_cmd_create(SDC_HCI_OPCODE_CMD_VS_SET_ADV_RANDOMNESS, sizeof(*cmd_params)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { LOG_ERR("Could not allocate command buffer"); return -ENOMEM;