Skip to content

Commit 7e94724

Browse files
e-rknordicjm
authored andcommitted
nrf_802154: rev 642a884302def68f4d89cc33af535a8d1abeb393
This commit updates revision of the nrf_802154 component. Signed-off-by: Rafal Kuznia <[email protected]>
1 parent 36ba54a commit 7e94724

File tree

8 files changed

+165
-138
lines changed

8 files changed

+165
-138
lines changed

nrf_802154/doc/multiprotocol_switching_tables.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ Multiprotocol radio switching time comparison by device family
3535
+--------------------+---------------------+-----------------+-----------------+------------------+
3636
| Bluetooth activity | Direction | nRF52 mean [µs] | nRF53 mean [µs] | nRF54L mean [µs] |
3737
+====================+=====================+=================+=================+==================+
38-
| advertisement | 802.15.4→Bluetooth | 324 | 346 | 268 |
38+
| advertisement | 802.15.4→Bluetooth | 324 | 336 | 268 |
3939
+--------------------+---------------------+-----------------+-----------------+------------------+
40-
| advertisement | Bluetooth→802.15.4 | 289 | 335 | 172 |
40+
| advertisement | Bluetooth→802.15.4 | 289 | 330 | 172 |
4141
+--------------------+---------------------+-----------------+-----------------+------------------+
42-
| scanning | 802.15.4→Bluetooth | 303 | 315 | 256 |
42+
| scanning | 802.15.4→Bluetooth | 303 | 313 | 256 |
4343
+--------------------+---------------------+-----------------+-----------------+------------------+
44-
| scanning | Bluetooth→802.15.4 | 234 | 292 | 150 |
44+
| scanning | Bluetooth→802.15.4 | 234 | 294 | 150 |
4545
+--------------------+---------------------+-----------------+-----------------+------------------+
46-
| connection | 802.15.4→Bluetooth | 386 | 388 | 348 |
46+
| connection | 802.15.4→Bluetooth | 386 | 408 | 348 |
4747
+--------------------+---------------------+-----------------+-----------------+------------------+
48-
| connection | Bluetooth→802.15.4 | 333 | 398 | 211 |
48+
| connection | Bluetooth→802.15.4 | 333 | 391 | 211 |
4949
+--------------------+---------------------+-----------------+-----------------+------------------+
5050

5151
Multiprotocol radio switching time measurements by device family
@@ -78,17 +78,17 @@ nRF53 family
7878
+--------------------+---------------------+---------------------------------+
7979
| Bluetooth activity | Direction | Timings (min | mean | max) [µs] |
8080
+====================+=====================+=================================+
81-
| advertisement | 802.15.4→Bluetooth | 320 | 346 | 505 |
81+
| advertisement | 802.15.4→Bluetooth | 319 | 336 | 395 |
8282
+--------------------+---------------------+---------------------------------+
83-
| advertisement | Bluetooth→802.15.4 | 324 | 335 | 352 |
83+
| advertisement | Bluetooth→802.15.4 | 314 | 330 | 345 |
8484
+--------------------+---------------------+---------------------------------+
85-
| scanning | 802.15.4→Bluetooth | 298 | 315 | 328 |
85+
| scanning | 802.15.4→Bluetooth | 298 | 313 | 327 |
8686
+--------------------+---------------------+---------------------------------+
87-
| scanning | Bluetooth→802.15.4 | 290 | 292 | 305 |
87+
| scanning | Bluetooth→802.15.4 | 292 | 294 | 302 |
8888
+--------------------+---------------------+---------------------------------+
89-
| connection | 802.15.4→Bluetooth | 375 | 388 | 401 |
89+
| connection | 802.15.4→Bluetooth | 395 | 408 | 421 |
9090
+--------------------+---------------------+---------------------------------+
91-
| connection | Bluetooth→802.15.4 | 379 | 398 | 418 |
91+
| connection | Bluetooth→802.15.4 | 373 | 391 | 404 |
9292
+--------------------+---------------------+---------------------------------+
9393

9494

nrf_802154/driver/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ target_sources(nrf-802154-driver
5656
src/nrf_802154_notification_direct.c
5757
src/nrf_802154_notification_swi.c
5858
src/nrf_802154_pib.c
59-
src/nrf_802154_peripherals_alloc.c
6059
src/nrf_802154_queue.c
6160
src/nrf_802154_request_direct.c
6261
src/nrf_802154_request_swi.c
@@ -70,6 +69,7 @@ target_sources(nrf-802154-driver
7069
src/nrf_802154_tx_work_buffer.c
7170
src/nrf_802154_tx_power.c
7271
src/mac_features/nrf_802154_csma_ca.c
72+
src/mac_features/nrf_802154_csma_ca_backoff.c
7373
src/mac_features/nrf_802154_delayed_trx.c
7474
src/mac_features/nrf_802154_filter.c
7575
src/mac_features/nrf_802154_frame_parser.c

nrf_802154/driver/src/mac_features/nrf_802154_csma_ca.c

Lines changed: 24 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
#include "nrf_802154_request.h"
5757
#include "nrf_802154_tx_power.h"
5858
#include "nrf_802154_stats.h"
59-
#include "platform/nrf_802154_random.h"
59+
#include "nrf_802154_csma_ca_backoff.h"
6060
#include "rsch/nrf_802154_rsch.h"
6161
#include "nrf_802154_sl_timer.h"
6262
#include "nrf_802154_sl_atomics.h"
@@ -136,14 +136,12 @@ static void priority_leverage(void)
136136
NRF_802154_COEX_TX_REQUEST_MODE_CCA_START);
137137

138138
// Leverage priority only after the first backoff in the specified Coex TX request mode
139-
if (first_transmit_attempt && coex_requires_boosted_prio)
139+
// It should always be possible to update this timeslot's priority here
140+
if (first_transmit_attempt && coex_requires_boosted_prio &&
141+
!nrf_802154_rsch_delayed_timeslot_priority_update(NRF_802154_RESERVED_CSMACA_ID,
142+
RSCH_PRIO_TX))
140143
{
141-
// It should always be possible to update this timeslot's priority here
142-
if (!nrf_802154_rsch_delayed_timeslot_priority_update(NRF_802154_RESERVED_CSMACA_ID,
143-
RSCH_PRIO_TX))
144-
{
145-
NRF_802154_ASSERT(false);
146-
}
144+
NRF_802154_ASSERT(false);
147145
}
148146

149147
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_HIGH);
@@ -211,59 +209,14 @@ static void frame_transmit(rsch_dly_ts_id_t dly_ts_id)
211209
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
212210
}
213211

214-
/**
215-
* @brief Calculates number of backoff periods as random value according to IEEE Std. 802.15.4.
216-
*/
217-
static uint8_t backoff_periods_calc_random(void)
218-
{
219-
return nrf_802154_random_get() % (1U << m_be);
220-
}
221-
222-
/**
223-
* @brief Calculates number of backoff periods to wait before the next CCA attempt of CSMA/CA
224-
*
225-
* @return Number of backoff periods
226-
*/
227-
static uint8_t backoff_periods_calc(void)
228-
{
229-
uint8_t result;
230-
231-
#if NRF_802154_TEST_MODES_ENABLED
232-
233-
switch (nrf_802154_pib_test_mode_csmaca_backoff_get())
234-
{
235-
case NRF_802154_TEST_MODE_CSMACA_BACKOFF_RANDOM:
236-
result = backoff_periods_calc_random();
237-
break;
238-
239-
case NRF_802154_TEST_MODE_CSMACA_BACKOFF_ALWAYS_MAX:
240-
result = (1U << m_be) - 1U;
241-
break;
242-
243-
case NRF_802154_TEST_MODE_CSMACA_BACKOFF_ALWAYS_MIN:
244-
result = 0U;
245-
break;
246-
247-
default:
248-
result = backoff_periods_calc_random();
249-
NRF_802154_ASSERT(false);
250-
break;
251-
}
252-
#else
253-
result = backoff_periods_calc_random();
254-
#endif
255-
256-
return result;
257-
}
258-
259212
/**
260213
* @brief Delay CCA procedure for random (2^BE - 1) unit backoff periods.
261214
*/
262215
static void random_backoff_start(void)
263216
{
264217
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_HIGH);
265218

266-
uint64_t backoff_us = backoff_periods_calc() * UNIT_BACKOFF_PERIOD;
219+
uint64_t backoff_us = nrf_802154_csma_ca_backoff_periods_get(m_be) * UNIT_BACKOFF_PERIOD;
267220

268221
rsch_dly_ts_param_t backoff_ts_param =
269222
{
@@ -492,4 +445,21 @@ static void csma_ca_tx_done(uint8_t * p_frame,
492445
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
493446
}
494447

448+
#ifdef TEST
449+
void nrf_802154_csma_ca_module_reset(void)
450+
{
451+
m_state = CSMA_CA_STATE_IDLE;
452+
m_nb = 0;
453+
m_be = 0;
454+
m_frame = (nrf_802154_frame_t){0};
455+
m_data_props = (nrf_802154_transmitted_frame_props_t){0};
456+
m_tx_channel = 0;
457+
#if NRF_802154_TX_TIMESTAMP_PROVIDER_ENABLED
458+
m_tx_timestamp_encode = false;
459+
#endif
460+
m_state = CSMA_CA_STATE_IDLE;
461+
}
462+
463+
#endif // TEST
464+
495465
#endif // NRF_802154_CSMA_CA_ENABLED
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
* Copyright (c) 2025, Nordic Semiconductor ASA
3+
* All rights reserved.
4+
*
5+
* SPDX-License-Identifier: BSD-3-Clause
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* 1. Redistributions of source code must retain the above copyright notice, this
11+
* list of conditions and the following disclaimer.
12+
*
13+
* 2. Redistributions in binary form must reproduce the above copyright
14+
* notice, this list of conditions and the following disclaimer in the
15+
* documentation and/or other materials provided with the distribution.
16+
*
17+
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
18+
* contributors may be used to endorse or promote products derived from this
19+
* software without specific prior written permission.
20+
*
21+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23+
* IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
24+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31+
* POSSIBILITY OF SUCH DAMAGE.
32+
*
33+
*/
34+
35+
#include "nrf_802154_config.h"
36+
37+
#if NRF_802154_CSMA_CA_ENABLED
38+
#include "nrf_802154_compiler.h"
39+
#include "platform/nrf_802154_random.h"
40+
#if NRF_802154_TEST_MODES_ENABLED
41+
#include "nrf_802154_pib.h"
42+
#endif
43+
#include "nrf_802154_csma_ca_backoff.h"
44+
45+
static inline uint8_t backoff_periods_get_random(uint8_t be)
46+
{
47+
return (uint8_t)(nrf_802154_random_get() % (1U << be));
48+
}
49+
50+
uint8_t nrf_802154_csma_ca_backoff_periods_get(uint8_t be)
51+
{
52+
uint8_t result;
53+
54+
#if NRF_802154_TEST_MODES_ENABLED
55+
56+
switch (nrf_802154_pib_test_mode_csmaca_backoff_get())
57+
{
58+
case NRF_802154_TEST_MODE_CSMACA_BACKOFF_ALWAYS_MAX:
59+
result = (1U << be) - 1U;
60+
break;
61+
62+
case NRF_802154_TEST_MODE_CSMACA_BACKOFF_ALWAYS_MIN:
63+
result = 0U;
64+
break;
65+
66+
case NRF_802154_TEST_MODE_CSMACA_BACKOFF_RANDOM:
67+
SWITCH_CASE_FALLTHROUGH;
68+
69+
default:
70+
result = backoff_periods_get_random(be);
71+
break;
72+
}
73+
#else
74+
result = backoff_periods_get_random(be);
75+
#endif
76+
77+
return result;
78+
}
79+
80+
#endif // NRF_802154_CSMA_CA_ENABLED
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, Nordic Semiconductor ASA
2+
* Copyright (c) 2025, Nordic Semiconductor ASA
33
* All rights reserved.
44
*
55
* SPDX-License-Identifier: BSD-3-Clause
@@ -32,46 +32,37 @@
3232
*
3333
*/
3434

35-
/**
36-
* @file
37-
* This file supplies bitmasks specifying which of the peripherals are used
38-
* by the 802.15.4 driver.
39-
*
40-
* Bitmasks currently provided applies to:
41-
* - PPI or DPPI channels (g_nrf_802154_used_nrf_ppi_channels)
42-
* - PPI or DPPI channel groups (g_nrf_802154_used_nrf_ppi_groups)
43-
*/
44-
45-
#include "nrf_802154_peripherals.h"
35+
#ifndef NRF_802154_CSMA_CA_BACKOFF_H__
36+
#define NRF_802154_CSMA_CA_BACKOFF_H__
4637

38+
#include <stdbool.h>
4739
#include <stdint.h>
4840

49-
#if NRF_802154_VERIFY_PERIPHS_ALLOC_AGAINST_MPSL
50-
/* Obtaining the MPSL_RESERVED_.. macros */
51-
#include "mpsl.h"
52-
#endif
53-
54-
#if defined(PPI_PRESENT)
55-
#define NRF_802154_PPI_CH_USED_MSK NRF_802154_PPI_CHANNELS_USED_MASK
56-
#define NRF_802154_PPI_GR_USED_MSK NRF_802154_PPI_GROUPS_USED_MASK
57-
#elif defined(DPPI_PRESENT)
58-
#define NRF_802154_PPI_CH_USED_MSK NRF_802154_DPPI_CHANNELS_USED_MASK
59-
#define NRF_802154_PPI_GR_USED_MSK NRF_802154_DPPI_GROUPS_USED_MASK
60-
#else
61-
#error Unsupported chip family
62-
#endif
63-
64-
const uint32_t g_nrf_802154_used_nrf_ppi_channels = NRF_802154_PPI_CH_USED_MSK;
65-
const uint32_t g_nrf_802154_used_nrf_ppi_groups = NRF_802154_PPI_GR_USED_MSK;
66-
67-
#if NRF_802154_VERIFY_PERIPHS_ALLOC_AGAINST_MPSL
41+
/**
42+
* @defgroup nrf_802154_csma_ca_backoff 802.15.4 driver CSMA-CA support
43+
* @{
44+
* @ingroup nrf_802154_csma_ca
45+
* @brief CSMA-CA procedure.
46+
*/
6847

69-
#if ((NRF_802154_PPI_CH_USED_MSK & MPSL_RESERVED_PPI_CHANNELS) != 0UL)
70-
#error PPI channels for 802.15.4 driver overlap with MPSL channels
71-
#endif
48+
/** @brief Gets the number of backoff periods to wait before the next CCA attempt of CSMA/CA.
49+
*
50+
* When test modes are not enabled, the number of backoff periods is a random value in the range
51+
* from 0 to (2^BE - 1), where BE is the current backoff exponent, as defined in IEEE Std. 802.15.4.
52+
*
53+
* When test modes are enabled the returned value depends on the value returned by
54+
* @c nrf_802154_pib_test_mode_csmaca_backoff_get .
55+
*
56+
* @note Consecutive calls to this function may return different values.
57+
*
58+
* @param[in] be Backoff Exponent. Allowed range 0...8.
59+
*
60+
* @return Number of backoff periods to wait before the next CCA attempt
61+
*/
62+
uint8_t nrf_802154_csma_ca_backoff_periods_get(uint8_t be);
7263

73-
#if ((NRF_802154_PPI_GR_USED_MSK & MPSL_RESERVED_PPI_GROUPS) != 0UL)
74-
#error PPI groups for 802.15.4 driver overlap with MPSL groups
75-
#endif
64+
/**
65+
*@}
66+
**/
7667

77-
#endif // NRF_802154_VERIFY_PERIPHS_ALLOC_AGAINST_MPSL
68+
#endif // NRF_802154_CSMA_CA_BACKOFF_H__

nrf_802154/driver/src/mac_features/nrf_802154_filter.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -393,12 +393,9 @@ static nrf_802154_rx_error_t dst_addr_check(const nrf_802154_frame_t * p_frame_d
393393
const uint8_t * p_dst_addr = nrf_802154_frame_dst_addr_get(p_frame_data);
394394
uint8_t frame_type = nrf_802154_frame_type_get(p_frame_data);
395395

396-
if (p_dst_panid != NULL)
396+
if (p_dst_panid != NULL && !dst_pan_id_check(p_dst_panid, frame_type))
397397
{
398-
if (!dst_pan_id_check(p_dst_panid, frame_type))
399-
{
400-
return NRF_802154_RX_ERROR_INVALID_DEST_ADDR;
401-
}
398+
return NRF_802154_RX_ERROR_INVALID_DEST_ADDR;
402399
}
403400

404401
uint8_t dst_addr_size =

0 commit comments

Comments
 (0)