diff --git a/snippets/hci-uart-native-sim/README.rst b/snippets/hci-uart-native-sim/README.rst new file mode 100644 index 00000000000..c4e2b671178 --- /dev/null +++ b/snippets/hci-uart-native-sim/README.rst @@ -0,0 +1,15 @@ +.. _snippet-hci-uart-native-sim: + +Native Simulator support for hci_uart Snippet (hci-uart-native-sim) +################################################################### + +.. code-block:: console + + west build -S hci-uart-native-sim [...] + +Overview +******** + +This snippet allows to use hci_uart connected to the host computer +with the Native Simulator. It is useful for testing with a real +Bluetooth controller, such as a device running Zephyr. diff --git a/snippets/hci-uart-native-sim/hci-uart-native-sim.conf b/snippets/hci-uart-native-sim/hci-uart-native-sim.conf new file mode 100644 index 00000000000..ac8005441af --- /dev/null +++ b/snippets/hci-uart-native-sim/hci-uart-native-sim.conf @@ -0,0 +1,8 @@ +# zephyr,native-tty-uart has a high load order +CONFIG_BT_HCI_INIT_PRIORITY=55 + +CONFIG_BT_BUF_EVT_RX_SIZE=255 +CONFIG_BT_BUF_ACL_RX_SIZE=255 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_BUF_CMD_TX_SIZE=255 +CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191 diff --git a/snippets/hci-uart-native-sim/hci-uart-native-sim.overlay b/snippets/hci-uart-native-sim/hci-uart-native-sim.overlay new file mode 100644 index 00000000000..fb1d5d648fb --- /dev/null +++ b/snippets/hci-uart-native-sim/hci-uart-native-sim.overlay @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Dmitrii Sharshakov + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&bt_hci_userchan { + status = "disabled"; +}; + +/ { + chosen { + zephyr,bt-hci = &bt_hci_uart; + }; + + hci_uart: hci_uart { + compatible = "zephyr,native-tty-uart"; + status = "okay"; + current-speed = <2000000>; + serial-port = "/dev/ttyACM0"; + + bt_hci_uart: bt_hci_uart { + compatible = "zephyr,bt-hci-uart"; + status = "okay"; + }; + }; +}; diff --git a/snippets/hci-uart-native-sim/snippet.yml b/snippets/hci-uart-native-sim/snippet.yml new file mode 100644 index 00000000000..dece9e83651 --- /dev/null +++ b/snippets/hci-uart-native-sim/snippet.yml @@ -0,0 +1,4 @@ +name: hci-uart-native-sim +append: + EXTRA_CONF_FILE: hci-uart-native-sim.conf + EXTRA_DTC_OVERLAY_FILE: hci-uart-native-sim.overlay