Skip to content

Commit d25c51d

Browse files
committed
samples: peripherals: radio_test: Fix PPI endpoint clear and coded PHY RX
Fix endpoints_clear() to also clear NRF_TIMER_EVENT_COMPARE1 when ENDPOINT_TIMER_RADIO_TX is set. Without this, start_duty_cycle_modulated_tx did not work on retriggers because radio_ppi_tx_reconfigure() attaches COMPARE1 but endpoints_clear() only cleared COMPARE0. Route coded PHY (BLE LR125/LR500) RX through DISABLED state using END->DISABLE and DISABLED->RXEN shorts instead of END->START. This ensures the receiver meets expected packet-loss behavior for Long Range modes. Add a shell warning when start_rx is used with coded PHY. Ported from sdk-nrf commits 7f07170da0 and 9145ec2458. Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>
1 parent c160c88 commit d25c51d

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

samples/peripherals/radio_test/src/radio_cmd.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,19 @@ static int cmd_rx_start(const struct shell *shell, size_t argc, char **argv)
600600
memset(&test_config, 0, sizeof(test_config));
601601
test_config.type = RX;
602602
test_config.mode = config.mode;
603+
604+
if (config.mode == NRF_RADIO_MODE_BLE_LR125KBIT ||
605+
config.mode == NRF_RADIO_MODE_BLE_LR500KBIT) {
606+
shell_warn(
607+
shell,
608+
"Warning:\n Due to required post-processing in the receiver,"
609+
" only every second packet sent by a device\n"
610+
" running the start_tx_modulated_carrier command"
611+
" with the configured data rate: %s can be received. Starting RX anyway.",
612+
config.mode == NRF_RADIO_MODE_BLE_LR125KBIT ? "ble_lr125kbit"
613+
: "ble_lr500kbit");
614+
}
615+
603616
test_config.params.rx.channel = config.channel_start;
604617
test_config.params.rx.pattern = config.tx_pattern;
605618

samples/peripherals/radio_test/src/radio_test.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,8 @@ static void endpoints_clear(void)
323323
if (atomic_test_and_clear_bit(&endpoint_state, ENDPOINT_TIMER_RADIO_TX)) {
324324
nrfx_gppi_ep_clear(
325325
nrf_timer_event_address_get(timer.p_reg, NRF_TIMER_EVENT_COMPARE0));
326+
nrfx_gppi_ep_clear(
327+
nrf_timer_event_address_get(timer.p_reg, NRF_TIMER_EVENT_COMPARE1));
326328
nrfx_gppi_ep_clear(nrf_radio_task_address_get(NRF_RADIO, NRF_RADIO_TASK_TXEN));
327329
}
328330
}
@@ -695,9 +697,14 @@ static void radio_rx(uint8_t mode, uint8_t channel, enum transmit_pattern patter
695697

696698
radio_mode_set(NRF_RADIO, mode);
697699

698-
nrf_radio_shorts_enable(NRF_RADIO,
699-
NRF_RADIO_SHORT_READY_START_MASK |
700-
NRF_RADIO_SHORT_END_START_MASK);
700+
if ((mode == NRF_RADIO_MODE_BLE_LR125KBIT) || (mode == NRF_RADIO_MODE_BLE_LR500KBIT)) {
701+
nrf_radio_shorts_enable(NRF_RADIO, NRF_RADIO_SHORT_READY_START_MASK |
702+
RADIO_TEST_SHORT_END_DISABLE_MASK |
703+
NRF_RADIO_SHORT_DISABLED_RXEN_MASK);
704+
} else {
705+
nrf_radio_shorts_enable(NRF_RADIO, NRF_RADIO_SHORT_READY_START_MASK |
706+
NRF_RADIO_SHORT_END_START_MASK);
707+
}
701708
nrf_radio_packetptr_set(NRF_RADIO, rx_packet);
702709

703710
radio_config(mode, pattern);

0 commit comments

Comments
 (0)