-
Notifications
You must be signed in to change notification settings - Fork 8.2k
stm32wba : ble-802.15.4 concurrent mode integration #97773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vtardy-st
wants to merge
3
commits into
zephyrproject-rtos:main
Choose a base branch
from
vtardy-st:stm32wba_1_7_0_ble_802154_concurrent
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,986
−19
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
samples/boards/st/ble_802154/ble_hr_802154_echo_client/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| cmake_minimum_required(VERSION 3.20.0) | ||
|
|
||
| find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
| project(sockets_echo_client) | ||
|
|
||
| if(CONFIG_NET_SOCKETS_SOCKOPT_TLS AND | ||
| CONFIG_MBEDTLS_KEY_EXCHANGE_PSK_ENABLED AND | ||
| (CONFIG_NET_SAMPLE_PSK_HEADER_FILE STREQUAL "dummy_psk.h")) | ||
| add_custom_target(development_psk | ||
| COMMAND ${CMAKE_COMMAND} -E echo "----------------------------------------------------------" | ||
| COMMAND ${CMAKE_COMMAND} -E echo "--- WARNING: Using dummy PSK! Only suitable for ---" | ||
| COMMAND ${CMAKE_COMMAND} -E echo "--- development. Set NET_SAMPLE_PSK_HEADER_FILE to use ---" | ||
| COMMAND ${CMAKE_COMMAND} -E echo "--- own pre-shared key. ---" | ||
| COMMAND ${CMAKE_COMMAND} -E echo "----------------------------------------------------------" | ||
| ) | ||
| add_dependencies(app development_psk) | ||
| endif() | ||
|
|
||
| target_sources( app PRIVATE src/echo-client.c) | ||
| target_sources( app PRIVATE src/app_ble.c) | ||
| target_sources_ifdef(CONFIG_NET_UDP app PRIVATE src/udp.c) | ||
| target_sources_ifdef(CONFIG_NET_TCP app PRIVATE src/tcp.c) | ||
|
|
||
| include(${ZEPHYR_BASE}/samples/net/common/common.cmake) | ||
|
|
||
| set(gen_dir ${ZEPHYR_BINARY_DIR}/include/generated/) | ||
|
|
||
| generate_inc_file_for_target( | ||
| app | ||
| src/echo-apps-cert.der | ||
| ${gen_dir}/echo-apps-cert.der.inc | ||
| ) |
62 changes: 62 additions & 0 deletions
62
samples/boards/st/ble_802154/ble_hr_802154_echo_client/Kconfig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # Private config options for ble HR - Networking echo-client sample app | ||
|
|
||
| # Copyright (c) 2018 Intel Corporation | ||
| # Copyright (c) 2025 STMicroelectronics | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| mainmenu "BLE Heart Rate - Networking echo-client sample application" | ||
|
|
||
| config NET_SAMPLE_IFACE2_MY_IPV6_ADDR | ||
| string "My IPv6 address for second interface" | ||
| help | ||
| The value depends on your network setup. | ||
|
|
||
| config NET_SAMPLE_IFACE2_MY_IPV4_ADDR | ||
| string "My IPv4 address for second interface" | ||
| help | ||
| The value depends on your network setup. | ||
|
|
||
| config NET_SAMPLE_IFACE2_VLAN_TAG | ||
| int "VLAN tag for second interface" | ||
| default 100 | ||
| range 0 4094 | ||
| depends on NET_VLAN | ||
| help | ||
| Set VLAN (virtual LAN) tag (id) that is used in the sample | ||
| application. | ||
|
|
||
| config NET_SAMPLE_IFACE3_MY_IPV6_ADDR | ||
| string "My IPv6 address for third interface" | ||
| help | ||
| The value depends on your network setup. | ||
|
|
||
| config NET_SAMPLE_IFACE3_MY_IPV4_ADDR | ||
| string "My IPv4 address for third interface" | ||
| help | ||
| The value depends on your network setup. | ||
|
|
||
| config NET_SAMPLE_IFACE3_VLAN_TAG | ||
| int "VLAN tag for third interface" | ||
| default 200 | ||
| range 0 4094 | ||
| depends on NET_VLAN | ||
| help | ||
| Set VLAN (virtual LAN) tag (id) that is used in the sample | ||
| application. | ||
|
|
||
| config NET_SAMPLE_PSK_HEADER_FILE | ||
| string "Header file containing PSK" | ||
| default "dummy_psk.h" | ||
| depends on MBEDTLS_KEY_EXCHANGE_PSK_ENABLED | ||
| help | ||
| Name of a header file containing a | ||
| pre-shared key. | ||
|
|
||
| config NET_SAMPLE_SEND_ITERATIONS | ||
| int "Send sample data this many times" | ||
| default 0 | ||
| help | ||
| Send sample data this many times before exiting. A value of | ||
| zero means that the sample application is run forever. | ||
|
|
||
| source "Kconfig.zephyr" | ||
72 changes: 72 additions & 0 deletions
72
samples/boards/st/ble_802154/ble_hr_802154_echo_client/README.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| .. 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 for Zephyr implements a concurrent mode | ||
| BLE - IEEE 802.15.4. | ||
| The 802.15.4 part implements UDP/TCP client that will send IPv4 | ||
| or 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/ble_802154/ble_hr_802154_echo_client`. | ||
|
|
||
| Requirements | ||
| ************ | ||
|
|
||
| This sample has been tested on the STMicroelectonics NUCLEO-WBA65RI board | ||
| (nucleo_wba65ri). | ||
|
|
||
| Building and Running | ||
| ******************** | ||
|
|
||
|
|
||
| There are configuration files for different boards and setups in the | ||
| samples directory: | ||
|
|
||
| - :file:`prj.conf` | ||
| Generic config file, normally you should use this. | ||
|
|
||
| - :file:`overlay-802154.conf` | ||
| This overlay config 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``. | ||
|
|
||
| Build sample application like this: | ||
|
|
||
| .. zephyr-app-commands:: | ||
| :zephyr-app: samples/boards/st/ble_802154/ble_hr_802154_echo_client | ||
| :board: <board to use> | ||
| :conf: <config file to use> | ||
| :goals: build | ||
| :compact: | ||
|
|
||
| Example building for the IEEE 802.15.4 on nucleo_wba65ri: | ||
|
|
||
| .. zephyr-app-commands:: | ||
| :zephyr-app: samples/boards/st/ble_802154/ble_hr_802154_echo_client | ||
| :board: nucleo_wba65ri | ||
| :gen-args: -DEXTRA_CONF_FILE=overlay-802154.conf | ||
| :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 ammplication restarts BLE advertising and LED 1 | ||
| toggles. | ||
|
|
||
| Simultaneously, IEEE 802.15.4 feature is enabled. | ||
| In remote device, you can run a echo-server sample application with overlay-802154.conf. | ||
| Once both devices are connected, local device will send IPv4 or 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. |
18 changes: 18 additions & 0 deletions
18
samples/boards/st/ble_802154/ble_hr_802154_echo_client/docker-test.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Copyright (c) 2020 Intel Corporation | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| if [ -z "$RUNNING_FROM_MAIN_SCRIPT" ]; then | ||
| echo "Do not run this script directly!" | ||
| echo "Run $ZEPHYR_BASE/scripts/net/run-sample-tests.sh instead." | ||
| exit 1 | ||
| fi | ||
|
|
||
| start_configuration "--ip=192.0.2.1 --ip6=2001:db8::1" || return $? | ||
| start_docker "/net-tools/echo-server -i eth0" || return $? | ||
|
|
||
| start_zephyr "$overlay" "-DCONFIG_NET_SAMPLE_SEND_ITERATIONS=10" | ||
|
|
||
| wait_zephyr | ||
| result=$? | ||
|
|
||
| stop_docker |
20 changes: 20 additions & 0 deletions
20
samples/boards/st/ble_802154/ble_hr_802154_echo_client/overlay-802154.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Disable TCP and IPv4 (TCP disabled to avoid heavy traffic) | ||
| CONFIG_NET_TCP=n | ||
| CONFIG_NET_IPV4=n | ||
|
|
||
| CONFIG_NET_CONFIG_NEED_IPV6=y | ||
| CONFIG_NET_CONFIG_NEED_IPV4=n | ||
| CONFIG_NET_CONFIG_MY_IPV4_ADDR="" | ||
| CONFIG_NET_CONFIG_PEER_IPV4_ADDR="" | ||
| CONFIG_NET_CONFIG_MY_IPV6_ADDR="2001:db8::2" | ||
| CONFIG_NET_CONFIG_PEER_IPV6_ADDR="2001:db8::1" | ||
|
|
||
| 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 | ||
|
|
||
| CONFIG_NET_RX_STACK_SIZE=2048 |
65 changes: 65 additions & 0 deletions
65
samples/boards/st/ble_802154/ble_hr_802154_echo_client/prj.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # Generic networking options | ||
| CONFIG_NETWORKING=y | ||
| CONFIG_NET_UDP=y | ||
| CONFIG_NET_TCP=y | ||
| CONFIG_NET_IPV6=y | ||
| CONFIG_NET_IPV4=y | ||
| 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 | ||
| CONFIG_MAX_THREAD_BYTES=3 | ||
|
|
||
| # 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 | ||
|
|
||
| # The addresses are selected so that qemu<->qemu connectivity works ok. | ||
| # For linux<->qemu connectivity, create a new conf file and swap the | ||
| # addresses (so that peer address is ending to 2). | ||
| 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=y | ||
| CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.2" | ||
| CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.1" | ||
| CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 | ||
|
|
||
| # 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 |
12 changes: 12 additions & 0 deletions
12
samples/boards/st/ble_802154/ble_hr_802154_echo_client/sample.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| sample: | ||
| description: Test concurrent mode BLE Heart Rate - IEEE802.15.4 echo client | ||
| name: BLE Heart Rate - Socket Echo Client | ||
| tests: | ||
| sample.boards.stm32.ble_802154.ble_hr_802154_echo_client: | ||
| harness: net | ||
| extra_args: EXTRA_CONF_FILE="overlay-802154.conf" | ||
| platform_allow: nucleo_wba65ri | ||
| tags: | ||
| - bluetooth | ||
| - net | ||
| - socket |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add ST copyright since you also modify the content you initially started from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ST copyright has been added in modified files coming from an existing copyrighted implementation