Skip to content

Commit 78310ee

Browse files
alexsvenkoffes
authored andcommitted
applications: nrf5340_audio: Use FICR to set fixed broadcast ID
- Read NFC tag register to use as a unique fixed broadcast ID - Add option to choose between: - FICR based fixed ID - CONFIG based fixed ID - Random generated ID - Delete forgotten Kconfig.default for broadcast_source - OCT-3350 Signed-off-by: Alexander Svensen <[email protected]>
1 parent 8ceb415 commit 78310ee

File tree

4 files changed

+36
-49
lines changed

4 files changed

+36
-49
lines changed

applications/nrf5340_audio/broadcast_source/Kconfig.defaults

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

applications/nrf5340_audio/broadcast_source/main.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,19 @@ static int ext_adv_populate(uint8_t big_index, struct broadcast_source_ext_adv_d
406406
return ret;
407407
}
408408

409+
uint32_t broadcast_id = 0x000000;
409410
bool fixed_id = !IS_ENABLED(CONFIG_BT_AUDIO_USE_BROADCAST_ID_RANDOM);
410411

411-
uint32_t broadcast_id = CONFIG_BT_AUDIO_BROADCAST_ID_FIXED;
412+
if (IS_ENABLED(CONFIG_BT_AUDIO_USE_BROADCAST_ID_FICR)) {
413+
LOG_DBG("Using FICR ID");
414+
broadcast_id = NRF_FICR->NFC.TAGHEADER0 >> 8;
415+
} else if (IS_ENABLED(CONFIG_BT_AUDIO_USE_BROADCAST_ID_FIXED)) {
416+
LOG_DBG("Using fixed ID");
417+
broadcast_id = CONFIG_BT_AUDIO_BROADCAST_ID_FIXED;
418+
} else {
419+
LOG_DBG("Using random broadcast ID");
420+
/* The random broadcast ID will be generated by the Bluetooth module */
421+
}
412422

413423
ret = broadcast_source_ext_adv_populate(big_index, fixed_id, broadcast_id, ext_adv_data,
414424
&ext_adv_buf[ext_adv_buf_cnt],

applications/nrf5340_audio/src/bluetooth/bt_stream/broadcast/Kconfig

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,19 +132,40 @@ config BT_AUDIO_BROADCAST_ENCRYPTION_KEY
132132
characters. Encryption keys larger than BT_ISO_BROADCAST_CODE_SIZE will be truncated to
133133
BT_ISO_BROADCAST_CODE_SIZE.
134134

135+
choice BT_AUDIO_BROADCAST_ID_TYPE
136+
prompt "Broadcast ID"
137+
depends on TRANSPORT_BIS
138+
default BT_AUDIO_USE_BROADCAST_ID_FICR
139+
help
140+
Select the broadcast ID to use for the broadcast.
141+
142+
config BT_AUDIO_USE_BROADCAST_ID_FICR
143+
bool "Use the FICR broadcast ID"
144+
depends on TRANSPORT_BIS
145+
help
146+
Use the FICR broadcast ID. This is a fixed broadcast ID that is unique to each device.
147+
It is stored in the FICR NFC.TAGHEADER0 register.
148+
135149
config BT_AUDIO_USE_BROADCAST_ID_RANDOM
136150
bool "Use a random broadcast ID"
137151
depends on TRANSPORT_BIS
138-
default y
139152
help
140153
Use a randomly generated broadcast ID.
141154

155+
config BT_AUDIO_USE_BROADCAST_ID_FIXED
156+
bool "Use a fixed broadcast ID"
157+
depends on TRANSPORT_BIS
158+
help
159+
Use a fixed broadcast ID. This is useful for debugging purposes.
160+
161+
endchoice
162+
142163
config BT_AUDIO_BROADCAST_ID_FIXED
143164
hex "Fixed broadcast ID"
144165
depends on TRANSPORT_BIS
145166
default 0x123456
146167
help
147-
Fixed broadcast ID; 3 octets. Will only be used if BT_AUDIO_USE_BROADCAST_ID_RANDOM=n.
168+
Fixed broadcast ID; 3 octets. Will only be used if BT_AUDIO_USE_BROADCAST_ID_FIXED=y.
148169
Only use for debugging.
149170

150171
config BT_AUDIO_BROADCAST_PBA_METADATA_SIZE

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,9 @@ Matter bridge
198198

199199
nRF5340 Audio
200200
-------------
201+
* Updated:
201202

202-
|no_changes_yet_note|
203+
* The application to use the ``NFC.TAGHEADER0`` value from FICR as the broadcast ID instead of using a random ID.
203204

204205
nRF Desktop
205206
-----------

0 commit comments

Comments
 (0)