Skip to content

Commit 4988d73

Browse files
committed
samples: boards: st: ble ieee802.15.4 concurrent mode cleaning
Clean sample Bluetooth Heart Rate - 802154 Echo Client to keep only useful coding Signed-off-by: Vincent Tardy <[email protected]>
1 parent 7cb9519 commit 4988d73

File tree

13 files changed

+97
-617
lines changed

13 files changed

+97
-617
lines changed

samples/boards/st/ble_802154/ble_hr_802154_echo_client/CMakeLists.txt

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,10 @@
33
cmake_minimum_required(VERSION 3.20.0)
44

55
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
6-
project(sockets_echo_client)
7-
8-
if(CONFIG_NET_SOCKETS_SOCKOPT_TLS AND
9-
CONFIG_MBEDTLS_KEY_EXCHANGE_PSK_ENABLED AND
10-
(CONFIG_NET_SAMPLE_PSK_HEADER_FILE STREQUAL "dummy_psk.h"))
11-
add_custom_target(development_psk
12-
COMMAND ${CMAKE_COMMAND} -E echo "----------------------------------------------------------"
13-
COMMAND ${CMAKE_COMMAND} -E echo "--- WARNING: Using dummy PSK! Only suitable for ---"
14-
COMMAND ${CMAKE_COMMAND} -E echo "--- development. Set NET_SAMPLE_PSK_HEADER_FILE to use ---"
15-
COMMAND ${CMAKE_COMMAND} -E echo "--- own pre-shared key. ---"
16-
COMMAND ${CMAKE_COMMAND} -E echo "----------------------------------------------------------"
17-
)
18-
add_dependencies(app development_psk)
19-
endif()
6+
project(st_ble_802154_echo_client)
207

218
target_sources( app PRIVATE src/echo-client.c)
229
target_sources( app PRIVATE src/app_ble.c)
2310
target_sources_ifdef(CONFIG_NET_UDP app PRIVATE src/udp.c)
24-
target_sources_ifdef(CONFIG_NET_TCP app PRIVATE src/tcp.c)
2511

2612
include(${ZEPHYR_BASE}/samples/net/common/common.cmake)
27-
28-
set(gen_dir ${ZEPHYR_BINARY_DIR}/include/generated/)
29-
30-
generate_inc_file_for_target(
31-
app
32-
src/echo-apps-cert.der
33-
${gen_dir}/echo-apps-cert.der.inc
34-
)

samples/boards/st/ble_802154/ble_hr_802154_echo_client/Kconfig

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -6,52 +6,6 @@
66

77
mainmenu "BLE Heart Rate - Networking echo-client sample application"
88

9-
config NET_SAMPLE_IFACE2_MY_IPV6_ADDR
10-
string "My IPv6 address for second interface"
11-
help
12-
The value depends on your network setup.
13-
14-
config NET_SAMPLE_IFACE2_MY_IPV4_ADDR
15-
string "My IPv4 address for second interface"
16-
help
17-
The value depends on your network setup.
18-
19-
config NET_SAMPLE_IFACE2_VLAN_TAG
20-
int "VLAN tag for second interface"
21-
default 100
22-
range 0 4094
23-
depends on NET_VLAN
24-
help
25-
Set VLAN (virtual LAN) tag (id) that is used in the sample
26-
application.
27-
28-
config NET_SAMPLE_IFACE3_MY_IPV6_ADDR
29-
string "My IPv6 address for third interface"
30-
help
31-
The value depends on your network setup.
32-
33-
config NET_SAMPLE_IFACE3_MY_IPV4_ADDR
34-
string "My IPv4 address for third interface"
35-
help
36-
The value depends on your network setup.
37-
38-
config NET_SAMPLE_IFACE3_VLAN_TAG
39-
int "VLAN tag for third interface"
40-
default 200
41-
range 0 4094
42-
depends on NET_VLAN
43-
help
44-
Set VLAN (virtual LAN) tag (id) that is used in the sample
45-
application.
46-
47-
config NET_SAMPLE_PSK_HEADER_FILE
48-
string "Header file containing PSK"
49-
default "dummy_psk.h"
50-
depends on MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
51-
help
52-
Name of a header file containing a
53-
pre-shared key.
54-
559
config NET_SAMPLE_SEND_ITERATIONS
5610
int "Send sample data this many times"
5711
default 0

samples/boards/st/ble_802154/ble_hr_802154_echo_client/README.rst

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,37 @@
99
Overview
1010
********
1111

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

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

23-
Requirements
24-
************
25+
The IEEE 802.15.4 config of the sample enables support for native
26+
IEEE 802.15.4 connectivity.
27+
Note that by default IEEE 802.15.4 L2 uses unacknowledged communication.
28+
To improve connection reliability, acknowledgments can be enabled with
29+
shell command: ``ieee802154 ack set``.
30+
31+
Environment Setup
32+
*****************
2533

2634
This sample has been tested on the STMicroelectonics NUCLEO-WBA65RI board
2735
(nucleo_wba65ri).
36+
This board interacts simultaneously with another board embedding an
37+
echo-server sample with the 802.15.4 overlay (nucleo_wba65ri) and a
38+
smartphone supporting BLE Heart Rate.
2839

2940
Building and Running
3041
********************
3142

32-
There are configuration files for different boards and setups in the
33-
samples directory:
34-
35-
- :file:`prj.conf`
36-
Generic config file, normally you should use this.
37-
38-
- :file:`overlay-802154.conf`
39-
This overlay config enables support for native IEEE 802.15.4 connectivity.
40-
Note that by default IEEE 802.15.4 L2 uses unacknowledged communication.
41-
To improve connection reliability, acknowledgments can be enabled with shell
42-
command: ``ieee802154 ack set``.
43-
4443
Build sample application like this:
4544

4645
.. zephyr-app-commands::
@@ -55,18 +54,17 @@ Example building for the IEEE 802.15.4 on nucleo_wba65ri:
5554
.. zephyr-app-commands::
5655
:zephyr-app: samples/boards/st/ble_802154/ble_hr_802154_echo_client
5756
:board: nucleo_wba65ri
58-
:gen-args: -DEXTRA_CONF_FILE=overlay-802154.conf
5957
:goals: build
6058
:compact:
6159

6260
The LED 1 toggles while application is BLE advertising. Once a remote device
6361
connects, the LED 1 turns ON and application will generate dummy heart-rate values.
64-
Once remote device disconnects, the ammplication restarts BLE advertising and LED 1
62+
Once remote device disconnects, the application restarts BLE advertising and LED 1
6563
toggles.
6664

6765
Simultaneously, IEEE 802.15.4 feature is enabled.
6866
In remote device, you can run a echo-server sample application with
6967
:file:`overlay-802154.conf`.
70-
Once both devices are connected, local device will send IPv4 or IPv6 packets,
71-
wait for the data to be sent back from the remote echo-server device, and then
72-
verify it matches the data that was sent.
68+
Once both devices are connected, local device will send IPv6 packets,wait for
69+
the data to be sent back from the remote echo-server device, and then verify it
70+
matches the data that was sent.

samples/boards/st/ble_802154/ble_hr_802154_echo_client/overlay-802154.conf

Lines changed: 0 additions & 20 deletions
This file was deleted.

samples/boards/st/ble_802154/ble_hr_802154_echo_client/prj.conf

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Generic networking options
22
CONFIG_NETWORKING=y
33
CONFIG_NET_UDP=y
4-
CONFIG_NET_TCP=y
4+
CONFIG_NET_TCP=n
55
CONFIG_NET_IPV6=y
6-
CONFIG_NET_IPV4=y
6+
CONFIG_NET_IPV4=n
77
CONFIG_NET_SOCKETS=y
88
CONFIG_ZVFS_POLL_MAX=5
99
CONFIG_NET_CONNECTION_MANAGER=y
@@ -40,17 +40,25 @@ CONFIG_NET_IF_MAX_IPV4_COUNT=3
4040
# Network shell
4141
CONFIG_NET_SHELL=y
4242

43-
# The addresses are selected so that qemu<->qemu connectivity works ok.
44-
# For linux<->qemu connectivity, create a new conf file and swap the
45-
# addresses (so that peer address is ending to 2).
43+
# Network Config
4644
CONFIG_NET_CONFIG_SETTINGS=y
4745
CONFIG_NET_CONFIG_NEED_IPV6=y
4846
CONFIG_NET_CONFIG_MY_IPV6_ADDR="2001:db8::2"
4947
CONFIG_NET_CONFIG_PEER_IPV6_ADDR="2001:db8::1"
50-
CONFIG_NET_CONFIG_NEED_IPV4=y
51-
CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.2"
52-
CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.1"
48+
CONFIG_NET_CONFIG_NEED_IPV4=n
49+
CONFIG_NET_CONFIG_MY_IPV4_ADDR=""
50+
CONFIG_NET_CONFIG_PEER_IPV4_ADDR=""
5351
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
52+
CONFIG_NET_RX_STACK_SIZE=2048
53+
54+
CONFIG_NET_L2_IEEE802154=y
55+
CONFIG_NET_L2_IEEE802154_SHELL=y
56+
CONFIG_NET_L2_IEEE802154_LOG_LEVEL_INF=y
57+
58+
CONFIG_NET_CONFIG_IEEE802154_CHANNEL=26
59+
60+
CONFIG_NET_L2_IEEE802154_FRAGMENT_REASS_CACHE_SIZE=5
61+
5462

5563
# Bluetootn configuration
5664
CONFIG_BT=y

samples/boards/st/ble_802154/ble_hr_802154_echo_client/src/app_ble.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ static void hrs_notify(void)
130130
}
131131
}
132132

133-
#if defined(CONFIG_GPIO)
134133
/* The devicetree node identifier for the "led0" alias. */
135134
#define LED0_NODE DT_ALIAS(led0)
136135

@@ -195,7 +194,6 @@ static void blink_stop(void)
195194
gpio_pin_set(led.port, led.pin, (int)led_is_on);
196195
}
197196
#endif /* LED0_NODE */
198-
#endif /* CONFIG_GPIO */
199197

200198
int ble_init(void)
201199
{

samples/boards/st/ble_802154/ble_hr_802154_echo_client/src/ca_certificate.h

Lines changed: 0 additions & 25 deletions
This file was deleted.

samples/boards/st/ble_802154/ble_hr_802154_echo_client/src/common.h

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,24 @@ int start_udp(void);
9090
int process_udp(void);
9191
void stop_udp(void);
9292
#else
93-
static inline void init_udp(void) { }
94-
static inline int start_udp(void) { return 0; }
95-
static inline int process_udp(void) { return 0; }
96-
static inline void stop_udp(void) { }
93+
static inline void init_udp(void)
94+
{
95+
/*nothing to do*/
96+
}
97+
static inline int start_udp(void)
98+
{
99+
return 0;
100+
}
101+
static inl
102+
{
103+
return 0;
104+
}
105+
static inline void stop_udp(void)
106+
{
107+
/*nothing to do*/
108+
}
97109
#endif /* defined(CONFIG_NET_UDP) */
98110

99-
int start_tcp(void);
100-
int process_tcp(void);
101-
void stop_tcp(void);
102111

103112
#if defined(CONFIG_BT)
104113
extern int ble_init(void);

samples/boards/st/ble_802154/ble_hr_802154_echo_client/src/dummy_psk.h

Lines changed: 0 additions & 14 deletions
This file was deleted.
Binary file not shown.

0 commit comments

Comments
 (0)