Skip to content

Commit c602283

Browse files
HaavardReirlubos
authored andcommitted
Samples: Bluetooth: conn time sync fix
This commit fixes the following: * Fix a bug in the initialization of `init_val` in the GPIOTE task used for the LED, where it would always be initialized to `NRF_GPIOTE_INITIAL_VALUE_HIGH` and not take the dt_flags into account. This made the LED toggle with inverted polarity on platforms where the LEDs are active high. * Update references to LED numbers in the README to match the actual sample behavior. Signed-off-by: Håvard Reierstad <[email protected]>
1 parent 87476db commit c602283

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

samples/bluetooth/conn_time_sync/README.rst

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,16 @@ To observe that the LEDs are toggled synchronously, use a logic analyzer or an o
2929

3030
Overview
3131
********
32+
.. tabs::
33+
34+
.. group-tab:: nRF52 and nRF53 DKs
35+
36+
The Central and Peripheral devices toggle **LED 2** synchronously and within a few microseconds of one another.
37+
38+
.. group-tab:: nRF54 DKs
39+
40+
The Central and Peripheral devices toggle **LED 1** synchronously and within a few microseconds of one another.
3241

33-
The Central and Peripheral devices toggle **LED 1** synchronously and within a few microseconds of one another.
3442
The LEDs are toggled at the timestamp specified by the Central device.
3543

3644
Clock synchronization
@@ -99,9 +107,17 @@ On nRF52 and nRF53 Series devices, you also need one RTC peripheral, one TIMER p
99107

100108
User interface
101109
**************
110+
.. tabs::
111+
112+
.. group-tab:: nRF52 and nRF53 DKs
113+
114+
LED 2:
115+
Blinks simultaneously on all devices after synchronization takes place.
116+
117+
.. group-tab:: nRF54 DKs
102118

103-
LED 1:
104-
Blinks simultaneously on all devices after synchronization takes place.
119+
LED 1:
120+
Blinks simultaneously on all devices after synchronization takes place.
105121

106122
Building and running
107123
********************

samples/bluetooth/conn_time_sync/src/timed_led_toggle.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ int timed_led_toggle_init(void)
5454
const nrfx_gpiote_task_config_t task_cfg_led_toggle = {
5555
.task_ch = gpiote_chan_led_toggle,
5656
.polarity = NRF_GPIOTE_POLARITY_TOGGLE,
57-
.init_val = (led.dt_flags & GPIO_ACTIVE_HIGH) ?
58-
NRF_GPIOTE_INITIAL_VALUE_LOW : NRF_GPIOTE_INITIAL_VALUE_HIGH,
57+
.init_val = (led.dt_flags & GPIO_ACTIVE_LOW) ?
58+
NRF_GPIOTE_INITIAL_VALUE_HIGH : NRF_GPIOTE_INITIAL_VALUE_LOW,
5959
};
6060

6161
if (nrfx_gpiote_output_configure(&gpiote, LED_PIN, &gpiote_output_cfg,

0 commit comments

Comments
 (0)