Skip to content

Commit a57e284

Browse files
cvinayakcarlescufi
authored andcommitted
Bluetooth: Controller: Fix nRF51x advertising channel PDU regression
Fix nRF51x series advertising channel PDU S1 byte configuration regression, that causes corrupted advertising PDUs being reported to Host, by adding the missing bits_s1 local variable initialization. Regression introduced in commit 1dcbe73 ("Bluetooth: controller: radio: add setting of S1 byte in radio packet"). Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent f49ed7a commit a57e284

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,10 @@ void radio_pkt_configure(uint8_t bits_len, uint8_t max_len, uint8_t flags)
348348
/* nRF51 supports only 27 byte PDU when using h/w CCM for encryption. */
349349
if (!IS_ENABLED(CONFIG_BT_CTLR_DATA_LENGTH_CLEAR) &&
350350
pdu_type == RADIO_PKT_CONF_PDU_TYPE_DC) {
351-
bits_len = 5U;
352-
bits_s1 = 3U;
351+
bits_len = RADIO_PKT_CONF_LENGTH_5BIT;
353352
}
353+
bits_s1 = RADIO_PKT_CONF_LENGTH_8BIT - bits_len;
354+
354355
#elif defined(CONFIG_SOC_COMPATIBLE_NRF52X) || \
355356
defined(CONFIG_SOC_SERIES_NRF53X)
356357
extra = 0U;
@@ -389,7 +390,7 @@ void radio_pkt_configure(uint8_t bits_len, uint8_t max_len, uint8_t flags)
389390
RADIO_PCNF0_S1INCL_Pos) & RADIO_PCNF0_S1INCL_Msk;
390391
#if defined(CONFIG_BT_CTLR_DF)
391392
if (RADIO_PKT_CONF_CTE_GET(flags) == RADIO_PKT_CONF_CTE_ENABLED) {
392-
bits_s1 = 8U;
393+
bits_s1 = RADIO_PKT_CONF_S1_8BIT;
393394
} else
394395
#endif /* CONFIG_BT_CTLR_DF */
395396
{

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626

2727
/* Macro to define length of the BLE packet length field in bits */
2828
#define RADIO_PKT_CONF_LENGTH_8BIT (8U)
29+
#define RADIO_PKT_CONF_LENGTH_5BIT (5U)
30+
31+
/* Macro to define length of the BLE packet S1 field in bits */
32+
#define RADIO_PKT_CONF_S1_8BIT (8U)
2933

3034
/* Helper macro to create bitfield with PDU type only*/
3135
#define RADIO_PKT_CONF_PDU_TYPE(phy) ((uint8_t)((phy) << RADIO_PKT_CONF_PDU_TYPE_POS))

0 commit comments

Comments
 (0)