Commit graph

795 commits

Author SHA1 Message Date
Dmitrii Sharshakov
639bccf969 Bluetooth: drivers: make H4 and H5 follow CONFIG_BT_HCI_INIT_PRIORITY
In some cases UART drivers might have too high init priorities
so HCI must be initialized even later if used with those.

One example is zephyr,native-tty-uart.

Signed-off-by: Dmitrii Sharshakov <d3dx12.xx@gmail.com>
2025-06-21 13:14:45 +02:00
Jori Rintahaka
0d5ed7c306 drivers: bluetooth: hci: silabs: fix radio IRQ priorities
Fix radio IRQ priorities. With the Controller update from SiSDK,
its behavior changed so that it overwrites the IRQ priorities.

Reconfigure the priorities after the Controller is initialized.
Source interrupt numbers and priorities from devicetree.

Also set the SYNTH IRQ priority on all HW, and set either the
RDMAILBOX or HOSTMAILBOX IRQ depending on which one exists.

Signed-off-by: Jori Rintahaka <jori.rintahaka@silabs.com>
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-06-18 17:45:51 -04:00
Jori Rintahaka
133f5bc3c2 drivers: bluetooth: hci: refactor silabs controller init
Refactor the controller init to use the new init routines the
controller now provides. Instead of using a hardcoded set of
features, the features are now initialized based on Kconfig
values that the application selects.

Add config files under modules/hal_silabs, used by the controller
init routines in the external module hal_silabs to determine which
features to enable based on Kconfig options. This brings the
controller feature configurability to roughly parity with the
Simplicity SDK.

Signed-off-by: Jori Rintahaka <jori.rintahaka@silabs.com>
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-06-18 17:45:51 -04:00
Nirav Agrawal
ffe8daa767 drivers: bluetooth: add BT-CAL data load for NXP IW612/IW416 SoC
- Add support for default Annex-55 Bluetooth calibration data load
 for both IW612 and IW416 SoC.
- Add support for default Annex-100 Bluetooth calibration data load
 for both IW612 and IW416 SoC.

Signed-off-by: Nirav Agrawal <nirav.agrawal@nxp.com>
2025-06-13 10:36:28 -04:00
Ali Hozhabri
ecf795f0f1 drivers: bluetooth: hci: Use TRNG peripheral for BLE purpose on WB0x
Call entropy APIs to use TRNG peripheral on STM32WB0x devices for BLE
purposes.

Enable RNG node on Nucleo-WB0x boards.

Remove RNG initialization as it's done in the entropy driver.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2025-06-12 09:32:41 -07:00
Matthias Ringwald
b67b5c5dc1 bluetooth: cyw43xxx: support newer PatchRAM files
The CYW43xxx for Infineon Controllers stops after the first LauncRAM
command. Newer Controllers like the CYW5557x update the firmware in
multiple stages, which is supported by this commit.

Signed-off-by: Matthias Ringwald <matthias@ringwald.ch>
2025-06-11 16:04:56 -07:00
Matthias Ringwald
e50f03404e bluetooth: cyw43xxx: support autobaud feature
Newer AIROC controllers like the CYW55573 don't support changing the
baudrate in Download Mode. However, a higher baud rate can be used
directly to sent HCI Reset.

This commit adds the KConfig flag CONFIG_AIROC_DOWNLOAD_MODE to enable
the new behaviour.

Signed-off-by: Matthias Ringwald <matthias@ringwald.ch>
2025-06-11 10:12:24 -07:00
Guotao Zhang
b2c4397185 drivers: bluetooth: hci: nxp: add Kconfig for IW610
Add Kconfig BT_NXP_IW610.

Signed-off-by: Guotao Zhang <guotao.zhang@nxp.com>
2025-06-09 14:30:04 -07:00
Axel Le Bourhis
928aa4a196 drivers: bluetooth: hci_nxp: fix discarding multi part adv reports
In case of extended advertising, advertising data can be reported in
parts, so we shouldn't discard them.
Instead, only discard the legacy advertising reports.

Signed-off-by: Axel Le Bourhis <axel.lebourhis@nxp.com>
2025-06-06 08:45:33 +02:00
Lyle Zhu
71ef6c6979 Drivers: Bluetooth: H4: Use a semaphore to wake up HCI RX thread
There is an issue that the buffer cannot be allocated by the function
`read_payload()` in UART ISR context. Then the UART RX will be
disabled. The H4 driver hopes to get the receive buffer in the HCI RX
thread and then open the UART RX again. However, there is a situation
where the HCI RX thread is blocked in getting the received data
buffer. However, since the UARt RX has been disabled, the HCI RX
thread cannot get the received data buffer. Therefore, the RX thread
is always blocked here, causing the Bluetooth host to not work
properly.

Add a semaphore `rx.ready` to notify new received data buffer has
been added to H4 RX queue.

Wait for the semaphore `rx.ready` instead of H4 RX queue in HCI RX
thread.

Wake up the HCI RX thread when failing to allocate the RX buffer.

Fixes #89879.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-05-26 11:54:09 +02:00
Sreeram Tatapudi
f61efef6b0 drivers: bluetooth: Add BLE low power mode for cyw920829m2evk_02
Add BLE low power mode for cyw920829m2evk_02

Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
2025-05-13 17:45:47 +02:00
Johan Hedberg
4cce7b6987 Bluetooth: drivers: Add names to Silabs EFR32 threads
This makes thread analysis output nicer, e.g.:

uart:~$ kernel thread list
Scheduler: 25953 since last call
Threads:
 0x20002380 EFR32 HCI RX
        options: 0x0, priority: -10 timeout: 0
        state: pending, entry: 0x80228fd
        stack size 512, unused 216, usage 296 / 512 (57 %)

 0x20002478 EFR32 LL
        options: 0x0, priority: -16 timeout: 0
        state: pending, entry: 0x8022921
        stack size 1024, unused 296, usage 728 / 1024 (71 %)

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-05-07 13:32:28 +02:00
Johan Hedberg
6113230ce3 Bluetooth: drivers: Update to use new H:4 buffer encoding
Update all HCI drivers to use the new H:4 encoding for buffers passing
to/from drivers.

One behavioral change that's done in favor of simplicity, is that where
there's previously been switch statements that could return an error for
unsupported packet types now simply pass any received packet unchanged to
lower layers of the controller (or the HCI transport). Handling this is
now the responsibility of the lower layers, however in practice hitting
such scenarios means that there's a mismatch between configured host and
controller features.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-04-29 13:00:33 +02:00
Nirav Agrawal
49e96fb885 drivers: bluetooth: hci: add IW416 BT Controller Support
Added IW416 SoC support to enable Bluetooth HCI driver perform
firmware load, and works with blueooth HCI interface.

Removed cmake file from bt_controller/, added support in hal_nxp
module to fetch firmware blobs for iW416/nw612 BT Only FW.

Signed-off-by: Nirav Agrawal <nirav.agrawal@nxp.com>
2025-04-28 12:57:54 -05:00
Luis Ubieda
b6e2486ac3 bluetooth: userchan: Guard reads from beyond frame size
Even though through code-inspection there isn't a clear path where the
guard wouldn't act upon the length reaching the limit, this check is
moved up to unconditially validate it on every read.

Fixes #84731.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-04-28 17:50:56 +01:00
Hao Luo
6f4b92d64d soc: ambiq: Optimize the inclusion relationship of header files
Optimized the inclusion relationship of header files

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-04-17 09:06:18 +02:00
Marcio Ribeiro
de98c3ce78 drivers: bt: esp32 bt controller features supported
Adds features supported by esp32 bt controller

Signed-off-by: Marcio Ribeiro <marcio.ribeiro@espressif.com>
2025-04-08 16:10:37 +02:00
Jordan Yates
c3139c59d0 bluetooth: hci: SPI backend boot timeout
Add a timeout to the SPI boot process to ensure that `bt_enable` does
not block forever but instead returns an error after an appropriately
large delay. While 1 second would be sufficient under normal operation,
we also want to give the controller time to perform any application
upgrades via a bootloader.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-08 08:57:26 +02:00
Yassine El Aissaoui
58ea18ed75 bluetooth: hci_nxp: disallow standby usage while sending HCI MSG
Sending an HCI message requires to wake up the controller
core if it's asleep. Platform controllers may send responses using
non wakeable interrupts and those can be lost during standby usage.
Blocking standby usage until the HCI message is sent.

Signed-off-by: Yassine El Aissaoui <yassine.elaissaoui@nxp.com>
2025-04-01 16:27:50 +02:00
Johan Hedberg
4fe9e018d3 drivers: bluetooth: h4: Free RX buffer upon reset
There are cases where reset_rx() is called when rx.buf is set (e.g. when
the buffer was too small to receive the incoming packet). Be sure to free
the buffer, so that it wont get reused for the next packet (which might
require a buffer from a different pool).

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-03-31 11:29:55 +02:00
Niek Ilmer
86c4b8d1f6 drv: bluetooth: Renesas: add Zephyr_blobs_verify
Add a Zephyr blobs verify check for Renesas HAL

Signed-off-by: Niek Ilmer <niek.ilmer.aj@renesas.com>
2025-03-26 16:21:46 +01:00
Nirav Agrawal
cacf8f6a47 drivers: bluetooth: hci_nxp_setup: support for bt disable and reinit
- added flag in nxp setup driver to perform HCI controller firmware-
  load and configuration only once. This avoid loading/setting-up
  controller fw on successive bt_init() after bt_disable() call.

Signed-off-by: Nirav Agrawal <nirav.agrawal@nxp.com>
2025-03-12 19:02:35 +01:00
Nirav Agrawal
438701fdd5 bluetooth: host: perform hci-reset in bt_disable()
- added HCI command to send hci-reset in bt_disable() func, and
  remove its call from the driver close() call.
- remove rsp buf pass to 'hci_reset_complete()' func as status is
  already checked under 'bt_hci_cmd_send_sync()'.

Signed-off-by: Nirav Agrawal <nirav.agrawal@nxp.com>
2025-03-12 19:02:35 +01:00
Lyle Zhu
ca121e134e Driver: HCI: set BT_NXP_NW612 as default
Add a choice `BT_NXP_MODULE` to make sure only one controller can be
selected if the multiple controllers are supported.

All NXP Bluetooth module similar with BT_NXP_NW612 should be added
to the section.

And set the BT_NXP_NW612 as the default controller.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-03-12 19:01:50 +01:00
Alberto Escolar Piedras
1bfbd9262e Bluetooth: userchan: Remove support for native_posix and clarify msg
native_posix has been removed, so let's remove its support from
kconfig for this driver.
Also let's replace its mention in the help message.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-12 02:27:36 +01:00
Piotr Pryga
ceb4298566 drivers: hci: ipc: Make IPC endpoint bound timeout configurable
The HCI IPC endpoint bound timeout value was hardcoded and set
to 1000 ms. This value may be differ between platforms, for
exampel due to extended boot time.
The default value used was a bit short for multicore SoCs
that usually may wait for some other service reposnes for
similar time. That may lead to timeout error while other
end of an endpoint was slightly late. Change the default
duration to 2000 ms to give more room for possible delays.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2025-03-11 09:00:29 +01:00
Alberto Escolar Piedras
b2b6f3c314 Bluetooth: userchan: Support other libCs
Refactor the userchan driver into a top and a bottom part.
The bottom is the one which interacts with the host and is built
with the host libC, while the top is built with the embedded code
and whatever libC that is built with.

Errors (errno) is converted between the top and bottom to ensure they
are coherent with the local libC.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-10 06:52:19 +01:00
Pavel Vasilyev
179f3c6f05 bluetooth: hci: ipc: assert when building HCI IPC driver w/o ACL FC
The HCI IPC driver is not reliable and can lead to lost ACL data if
built without Controller-to-Host ACL flow control.

This commit prevents building HCI IPC driver and hci_ipc sample without
CONFIG_BT_HCI_ACL_FLOW_CONTROL.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-03-08 03:37:16 +01:00
Ying Zhang
6b16d10342 drivers: Bluetooth: nxp: not power off BLE controller when bt disable
remove the power off BLE controller function since the hci_reset cmd
is enough, also for wifi-ble coex scenario, need to maintain BLE controller
for some info in SMU region

Signed-off-by: Ying Zhang <ying.zhang_2@nxp.com>
2025-03-07 20:19:14 +01:00
FILLIOT Louis
c77127d657 Bluetooth: hci: added h4_close function
Inside the hci driver API in h4.c, there were no
API function allowing to close the bluetooth
interface, as there were close function defined
for other bluetooth hci driver.

The function disables Bluetooth reception and
sending, and calls a weak function allowing
to implement user specific behaviors
while shutting down bluetooth interface

Signed-off-by: FILLIOT Louis <l.filliot@lacroix.group>
2025-03-07 20:17:10 +01:00
Marcio Ribeiro
216f9dafcc soc: esp32: add extended advertising support
Adds extended advertising support to:
- esp32s2
- esp32c3

Signed-off-by: Marcio Ribeiro <marcio.ribeiro@espressif.com>
2025-03-07 19:51:16 +01:00
Dominik Chat
93d15996e9 drivers: bluetooth: hci: Add retries for IPC interface
Add HCI IPC retry handling in case of full IPC
queue. This mechanism improves reliability.

The ipc_service_send can return -ENOMEM in case
of full queue. If this happens the retries are
executed in order to wait for queue to empty
and not drop messages.
If the retry mechanism reaches maximum then
the error code is passed back to the host.

The change should improve the handling of
passing messages to full ipc and reduce
dropping of packets.

Signed-off-by: Dominik Chat <dominik.chat@nordicsemi.no>
2025-03-07 19:49:15 +01:00
Swift Tian
681bc1aa82 modules: hal_ambiq: fix cmake warning when no BLE
Added CONFIG_AMBIQ_COMPONENT_USE_BT and CONFIG_SOC_AMBIQ_BT_SUPPORTED
to fix empty zephyr_library() warning when BLE is not needed for compile.
Added CMake message if BT related Ambiq specific Kconfig is overriden for
not supported SoC.

Signed-off-by: Swift Tian <swift.tian@ambiq.com>
2025-03-07 19:45:40 +01:00
Emil Gydesen
210adaf399 drivers: Bluetooth: ipc: Add additional logging info
Add logging of the values that cause LOG_ERR statements.
This makes it easier to debug any issues that occur.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-02-28 08:01:46 +01:00
Axel Le Bourhis
e5a1c0bbe4 drivers: bluetooth: hci_nxp: fix unexpected command complete event
As the previous version of the MCXW71 BLE Controller wasn't sending a
command complete event after setting the BD address, we used a
workaround to directly send the HCI command without using zephyr's API.
Now, on the latest version of MCXW72 and MCXW71, this issue is fixed,
so we need to use `bt_hci_cmd_send_sync` to properly expect the
command complete event.

Signed-off-by: Axel Le Bourhis <axel.lebourhis@nxp.com>
2025-02-25 15:14:18 +00:00
Axel Le Bourhis
0034e12599 drivers: bluetooth: hci_nxp: fix nomem handling
When allocation fails in `hci_rx_cb`, we should return immediately
instead of continuing the execution of the function.

Also, we need to free the allocated buffer from the heap when sending
to the message queue fails to avoid memory leak.

Signed-off-by: Axel Le Bourhis <axel.lebourhis@nxp.com>
2025-02-25 07:54:56 +01:00
Ramana Gudipudi
5994a5efda drivers: bluetooth: siwx917: Fix issue with controller to host flow control
The SiWx917 BLE controller currently does not support
HCI Command 0x0C35 i.e. Host Number of Completed Packets Command
Disabling the ACL Flow Control avoids sending this command during
SMP Pairing process and therefore avoiding an ASSERT

Signed-off-by: Ramana Gudipudi <ragudipu@silabs.com>
2025-02-24 15:36:55 +00:00
Martino Facchin
56539d8ce4 hci_da1453x: consider polarity of reset gpio
Previously polarity was ignored so inverted reset were never toggled

Signed-off-by: Martino Facchin <m.facchin@arduino.cc>
2025-02-18 18:40:08 +01:00
Kamil Piszczek
7c828bd232 bluetooth: dis: add Kconfig for disabling optional characteristics
Added new Kconfig option set that allows the user to control the
presence of the following optional characteristics:

- Manufacturer Name String
- Model Number String

Depreacted the old configuration that can be deleted in the future
Zephyr releases.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2025-02-13 16:46:12 +01:00
Kalle Kietäväinen
c8e93401d0 drivers: bluetooth: silabs: Set maximum TX power
Honor Kconfig option `BT_CTLR_TX_PWR_ANTENNA` for limiting the maximum TX
power. The default value for this option is 0 dBm, which means that after
this change the actual TX power is likely lower than before, unless
increased by this option.

Signed-off-by: Kalle Kietäväinen <kalle.kietavainen@silabs.com>
2025-02-13 16:44:21 +01:00
Emil Gydesen
571f26cf1a Bluetooth: Rename BLE to Bluetooth (LE) where applicable
The BLE acronym is not an official description of Bluetooth
LE, and the Bluetooth SIG only ever refers to it as Bluetooth
Low Energy or Bluetooth LE, so Zephyr should as well.

This commit does not change any board or vendor specific
documentation, and the term BLE may still be used in those.
It will be up to the vendors to update it if they want,
since many of them are using the term BLE in their
products.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-02-12 12:24:18 +01:00
Jérôme Pouiller
aa6914dc56 drivers: bluetooth: Introduce SiWx91x HCI driver
Driver was tested with a custom application which enabled the BT_SHELL.
Basic functionalities were verified:
 - Scanning
 - Advertising
 - Connecting

Configuration needed for the test:
 - CONFIG_BT=y
 - CONFIG_BT_PERIPHERAL=y
 - CONFIG_BT_CENTRAL=y
 - CONFIG_BT_SHELL=y
 - CONFIG_SHELL=y

Co-authored-by: Tibor Laczko <tibor.laczko@silabs.com>
Signed-off-by: Tibor Laczko <tibor.laczko@silabs.com>
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2025-02-11 22:07:11 +01:00
Marek Matej
6e6ab2f8ab soc: espressif: Remove ESP heap and use heap adapter
Remove ESP heap from the sources. System heap is default heap.
Use heap adapter layer to configure used heap.
Use MEM_POOL memory request config to Wi-Fi and Bluetooth drivers.
Update the Wi-Fi and BLE memory needs.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2025-02-05 17:49:54 +01:00
Johan Hedberg
77a350efa7 drivers: bluetooth: silabs_efr32: Add support for vendor HCI extensions
Add a Kconfig option which can be used to enable vendor HCI extensions for
Silicon Labs EFR32 devices.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-01-31 09:40:33 +01:00
Thomas Stranger
e643b286df drivers: bluetooth: hci: h4_ifx_cyw43xxx: add missing hci includes
Add missing bluetooth/hci.h and hci_types.h include to fix the build
error and warnings of the infineon h4 ble driver.

The driver is using bt_hci_cmd_create() and bt_hci_cmd_send_sync()
from bluetooth/hci.h, and BT_HCI_OP_RESET from bluetooth/hci_types.h

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2025-01-25 20:06:34 +01:00
Kalle Kietäväinen
fa9126f5e8 drivers: bluetooth: hci: Increase default RX stack size
The `BT_DRV_RX_STACK_SIZE` config is used by HCI drivers to determine a
suitable stack size for their RX thread. These threads handle the HCI
transport and pass HCI messages to the Bluetooth host via `bt_hci_recv()`.
Previously, the default stack size was 256 bytes, but it seems to be too
small currently.

Measuring the peak stack usage of `bt_hci_recv()` in different scenarios
indicates that the function needs over 300 bytes of stack. Thus, an RX
thread stack size of 512 should cover that and leave some margin.

Signed-off-by: Kalle Kietäväinen <kalle.kietavainen@silabs.com>
2025-01-23 16:31:54 +01:00
Sylvio Alves
3d3217ea6a hci: esp32: remove deprecated symbol
Make sure HAS_BT_CTLR is used instead
of deprecated BT_CTLR symbol.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-01-23 00:13:17 +01:00
Derek Snell
1d441c239e doc: nxp: nw612: clarify documentation
NW612 is the firmware name, IW612 is the chipset name.

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2025-01-21 15:14:05 +01:00
Kalle Kietäväinen
076e1488e1 drivers: bluetooth: silabs: Potentially discard unimportant HCI events
Certain HCI events, like advertising reports, are of less importance than
others. This takes the discardable buffer pool into use for such events.
When the system is flooded with advertising reports, discarding some of
them ensures that the system can still handle other events.

Signed-off-by: Kalle Kietäväinen <kalle.kietavainen@silabs.com>
2025-01-21 11:11:36 +01:00
Kalle Kietäväinen
fe5abd0344 drivers: bluetooth: silabs: Add separate thread for BT Link Layer
The BT Link Layer needs to get runtime in a timely manner to keep
connections alive and handle other time-critical tasks. This is achieved by
adding a separate thread for it with a meta-IRQ priority, which means it
can preempt other threads. The driver also has an RX thread that passes HCI
messages from the controller to the host stack. This can be a lower
priority cooperative thread, as it doesn't have strict timing requirements.

Signed-off-by: Kalle Kietäväinen <kalle.kietavainen@silabs.com>
2025-01-21 11:11:36 +01:00