Skip to content

Commit 1df431a

Browse files
committed
nimble/phy: nrf5x: Add continues tone test mode
Use BLE_PHY_CS_TEST_MODE_CONTINUES_TONE and BLE_PHY_CS_TEST_MODE_CONTINUES_TONE when building an image to put the radio into continuous tone transmission mode. Helpful for frequency calibration.
1 parent 81a646d commit 1df431a

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

nimble/drivers/nrf5x/pkg.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,6 @@ pkg.source_files.'MCU_TARGET=="nRF54L15"':
4646

4747
pkg.source_files.'BLE_CHANNEL_SOUNDING':
4848
- "src/ble_phy_cs.c"
49+
50+
pkg.init.'BLE_PHY_CS_TEST_MODE_CONTINUES_TONE':
51+
ble_phy_cs_tx_continuous_tone: $after:ble_transport_ll_init

nimble/drivers/nrf5x/src/ble_phy_cs.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,4 +804,36 @@ ble_phy_cs_subevent_start(struct ble_phy_cs_transmission *transm,
804804

805805
return 0;
806806
}
807+
808+
#if MYNEWT_VAL(BLE_PHY_CS_TEST_MODE_CONTINUES_TONE)
809+
void
810+
ble_phy_cs_tx_continuous_tone(void)
811+
{
812+
int rc = 0;
813+
814+
os_trace_isr_enter();
815+
816+
ble_phy_rfclk_enable();
817+
818+
phy_ppi_cs_mode_enable();
819+
ble_phy_cs_radio_events_clear();
820+
821+
/* Make sure all interrupts are disabled */
822+
nrf_radio_int_disable(NRF_RADIO, NRF_RADIO_IRQ_MASK_ALL);
823+
824+
NRF_RADIO->SHORTS = 0;
825+
ble_phy_cs_rtt_set(NULL, 0);
826+
ble_phy_cs_channel_set(MYNEWT_VAL(BLE_PHY_CS_TEST_MODE_CONTINUES_TONE_CHANNEL));
827+
ble_phy_cs_tone_configure(80, BLE_PHY_CS_TONE_MODE_FM);
828+
ble_phy_cs_tune_set();
829+
830+
NRF_RADIO->TASKS_TXEN = 1;
831+
832+
while (1);
833+
834+
os_trace_isr_exit();
835+
836+
return;
837+
}
838+
#endif
807839
#endif

0 commit comments

Comments
 (0)