Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions drivers/bluetooth/hci/hci_stm32wba.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ static int bt_hci_stm32wba_open(const struct device *dev, bt_hci_recv_t recv)
struct hci_data *data = dev->data;
int ret = 0;

link_layer_register_isr();
link_layer_register_isr(false);

ret = bt_ble_ctlr_init();
if (ret == 0) {
Expand Down Expand Up @@ -563,7 +563,7 @@ static int radio_pm_action(const struct device *dev, enum pm_device_action actio
#if defined(CONFIG_PM_S2RAM)
if (LL_PWR_IsActiveFlag_SB() == 1U) {
/* Put the radio in active state */
link_layer_register_isr();
link_layer_register_isr(true);
}
#endif /* CONFIG_PM_S2RAM */
LINKLAYER_PLAT_NotifyWFIExit();
Expand Down
4 changes: 2 additions & 2 deletions drivers/ieee802154/ieee802154_stm32wba.c
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ static void stm32wba_802154_iface_init(struct net_if *iface)
.stm32wba_802154_ral_cbk_tx_ack_started = stm32wba_802154_tx_ack_started,
};

link_layer_register_isr();
link_layer_register_isr(false);

#if !defined(CONFIG_NET_L2_CUSTOM_IEEE802154_STM32WBA)
ll_sys_thread_init();
Expand Down Expand Up @@ -995,7 +995,7 @@ static int radio_pm_action(const struct device *dev, enum pm_device_action actio
if (LL_PWR_IsActiveFlag_SB() == 1U) {
/* Put the radio in active state */
LL_AHB5_GRP1_EnableClock(LL_AHB5_GRP1_PERIPH_RADIO);
link_layer_register_isr();
link_layer_register_isr(true);
}
LINKLAYER_PLAT_NotifyWFIExit();
ll_sys_dp_slp_exit();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(st_ble_802154_echo_client)

target_sources(app PRIVATE src/echo-client.c)
target_sources(app PRIVATE src/app_ble.c)
target_sources(app PRIVATE src/udp.c)

include(${ZEPHYR_BASE}/samples/net/common/common.cmake)
69 changes: 69 additions & 0 deletions samples/boards/st/bluetooth/ble_hr_802154_echo_client/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
.. zephyr:code-sample:: stm32_ble_hr_802154_echo_client
:name: BLE HR - 802154 Echo client (advanced)

Implement a Bluetooth |reg| Energy Heart Rate - IEEE 802154 client.
The BLE Heart Rate (HR) GATT Service generates dummy heart-rate
values and the 802154 echo client sends IP packets, waits for data
to be sent back, and verifies it.

Overview
********

The sample application implements a concurrent mode BLE - IEEE 802.15.4.
Both wireless protocols Bluetooth |reg| Energy and IEEE 802.15.4 coexist:
the application supports simultaneously one Bluetooth |reg| Energy connection
and one IEEE 802.15.4 connection.
The 802.15.4 part implements UDP client that will send IPv6 packets,
wait for the data to be sent back, and then verify it matches
the data that was sent.
The BLE part exposes the HR (Heart Rate) GATT Service. Once a device
connects, it will generate dummy heart-rate values.

The source code for this sample application can be found at:
:zephyr_file:`samples/boards/st/bluetooth/ble_hr_802154_echo_client`.

The IEEE 802.15.4 config of the sample enables support for native
IEEE 802.15.4 connectivity.
Note that by default IEEE 802.15.4 L2 uses unacknowledged communication.
To improve connection reliability, acknowledgments can be enabled with
shell command: ``ieee802154 ack set``.

Environment Setup
*****************

This sample has been tested on the STMicroelectonics NUCLEO-WBA65RI board
(nucleo_wba65ri).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If 2 boards are required, please specify it here.

This board interacts simultaneously with another board embedding an
echo-server sample with the 802.15.4 overlay (nucleo_wba65ri) and a
smartphone supporting BLE Heart Rate.

Building and Running
********************

Build sample application like this:

.. zephyr-app-commands::
:zephyr-app: samples/boards/st/bluetooth/ble_hr_802154_echo_client
:board: nucleo_wba65ri
:goals: build
:compact:

The LED 1 toggles while application is BLE advertising. Once a remote device
connects, the LED 1 turns ON and application will generate dummy heart-rate values.
Once remote device disconnects, the application restarts BLE advertising and LED 1
toggles.

Simultaneously, IEEE 802.15.4 feature is enabled. To validate behavior, use another
board that will be used as a remote server.
This can be done using echo-server sample application with :file:`overlay-802154.conf`.

.. zephyr-app-commands::
:zephyr-app: samples/net/sockets/echo_server
:board: nucleo_wba65ri
:gen-args: -DEXTRA_CONF_FILE=overlay-802154.conf
:goals: build flash
:compact:

Once both devices are connected, local device will send IPv6 packets, wait for
the data to be sent back from the remote echo-server device, and then verify it
matches the data that was sent.
71 changes: 71 additions & 0 deletions samples/boards/st/bluetooth/ble_hr_802154_echo_client/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Generic networking options
CONFIG_NETWORKING=y
CONFIG_NET_UDP=y
CONFIG_NET_IPV6=y
CONFIG_NET_IPV4=n
CONFIG_NET_SOCKETS=y
CONFIG_ZVFS_POLL_MAX=5
CONFIG_NET_CONNECTION_MANAGER=y

CONFIG_POSIX_API=y

# Kernel options
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_ENTROPY_GENERATOR=y
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_INIT_STACKS=y

# Logging
CONFIG_NET_LOG=y
CONFIG_LOG=y
CONFIG_NET_STATISTICS=y
CONFIG_PRINTK=y

# Network buffers
CONFIG_NET_PKT_RX_COUNT=16
CONFIG_NET_PKT_TX_COUNT=16
CONFIG_NET_BUF_RX_COUNT=80
CONFIG_NET_BUF_TX_COUNT=80
CONFIG_NET_CONTEXT_NET_PKT_POOL=y

# IP address options
CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=3
CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=4
CONFIG_NET_MAX_CONTEXTS=10
CONFIG_NET_IF_MAX_IPV6_COUNT=3
CONFIG_NET_IF_MAX_IPV4_COUNT=3

# Network shell
CONFIG_NET_SHELL=y

# Network Config
CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_CONFIG_NEED_IPV6=y
CONFIG_NET_CONFIG_MY_IPV6_ADDR="2001:db8::2"
CONFIG_NET_CONFIG_PEER_IPV6_ADDR="2001:db8::1"
CONFIG_NET_CONFIG_NEED_IPV4=n
CONFIG_NET_CONFIG_MY_IPV4_ADDR=""
CONFIG_NET_CONFIG_PEER_IPV4_ADDR=""
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_NET_RX_STACK_SIZE=2048

CONFIG_NET_L2_IEEE802154=y
CONFIG_NET_L2_IEEE802154_SHELL=y
CONFIG_NET_L2_IEEE802154_LOG_LEVEL_INF=y

CONFIG_NET_CONFIG_IEEE802154_CHANNEL=26

CONFIG_NET_L2_IEEE802154_FRAGMENT_REASS_CACHE_SIZE=5


# Bluetootn configuration
CONFIG_BT=y
CONFIG_BT_SMP=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DIS=y
CONFIG_BT_DIS_PNP=n
CONFIG_BT_BAS=y
CONFIG_BT_HRS=y
CONFIG_BT_DEVICE_NAME="Zephyr HR 802154 Echo Client"
CONFIG_BT_DEVICE_APPEARANCE=833
CONFIG_BT_STM32WBA_USE_TEMP_BASED_CALIB=y
Loading
Loading