dwt tx continuous wave for ic calibration

I’m training to transmit a continuous wave for ic calibration of dwm1000.

I implemented the code described at chapter 8.1.1 (Calibration method of Crystal Oscillator Trim) of DW1000 user manual, but it does not work correctly and I’m not able to see the wave on spettroscope.
Someone can help to find where I’ve wrong please…

This is the portion of code that I’have write:

[font=Serif]void dwt_tx_continuous_wave(uint32_t milliseconds) {
[font=Serif] uint32_t device_id = 0;[/font]
[font=Serif] dwt_config_t *p_config = DW1000_GetConfigP();[/font]
[font=Serif] // 0. Reset the device[/font]
[font=Serif] dwt_softreset();[/font]
[font=Serif] deca_sleep(20);[/font]
[font=Serif] device_id = dwt_readdevid();[/font]
[font=Serif] if (device_id == DWT_DEVICE_ID) {[/font]
[font=Serif] // 1. Initialize Device[/font]
[font=Serif] uint32_t rf_conf = 0;[/font]
[font=Serif] rf_conf = dwt_read32bitoffsetreg(RF_CONF_ID, 0);[/font]
[font=Serif] uint8 plllockdetect = EC_CTRL_PLLLCK;[/font]
[font=Serif] _dwt_enableclocks(FORCE_SYS_XTI);[/font]
[font=Serif] dwt_writetodevice(EXT_SYNC_ID, EC_CTRL_OFFSET, 1, &plllockdetect);[/font]
[font=Serif] // 2. Write 0x00000000 to Sub-Register 0x36:04 ? PMSC_CTRL1;[/font]
[font=Serif] uint32_t pmsc_ctrl1 = 0x00000000;[/font]
[font=Serif] dwt_write32bitoffsetreg(PMSC_ID, PMSC_CTRL1_OFFSET, pmsc_ctrl1);[/font]
[font=Serif] pmsc_ctrl1 = dwt_read32bitoffsetreg(PMSC_ID, PMSC_CTRL1_OFFSET);[/font]
[font=Serif] // 3. Write the correct value for the selected channel to Sub-Register 0x28:0C? RF_TXCTRL[/font]
[font=Serif] // see table 37, e.g. 0x1E3FE0 for channel 5;[/font]
[font=Serif] uint32_t rf_txctrl = tx_config[chan_idx[p_config->chan]];[/font]
[font=Serif] dwt_write32bitoffsetreg(RF_CONF_ID, RF_TXCTRL_OFFSET, rf_txctrl);[/font]
[font=Serif] rf_txctrl = dwt_read32bitoffsetreg(RF_CONF_ID, RF_TXCTRL_OFFSET);[/font]
[font=Serif] // 4. Write an appropriate value to Register file: 0x1E ? Transmit Power Control, such as that for the selected channel[/font]
[font=Serif] // see Table 20: Reference values Register file: 0x1E ? Transmit Power Control;[/font]
[font=Serif] dwt_reg_tx_power_t power_reg = {.reg_value = 0};[/font]
[font=Serif] float power = 0.0;[/font]
[font=Serif] dwt_reg_tx_power_t reg_tx = dwt_gain_valtoreg(22.5);[/font]
[font=Serif] //dwt_setdefaulttxpower(false, p_config->chan, p_config->prf);[/font]
[font=Serif] dwt_settxpower(false, p_config->chan, reg_tx.reg_value);[/font]
[font=Serif] power_reg.reg_value = dwt_readtxpower();[/font]
[font=Serif] power = dwt_gain_regtoval(power_reg);[/font]
[font=Serif] // 5. Write the value for the selected channel to Sub-Register 0x2B:07 ? FS_PLLCFG[/font]
[font=Serif] // e.g. 0x0800041D for channel 5, see Table 43: Sub-Register 0x2B:07 ? FS_PLLCFG values;[/font]
[font=Serif] uint8_t fs_pllcfg[5] = {0};[/font]
[font=Serif] memcpy(fs_pllcfg, &pll2_config[chan_idx[p_config->chan]][0], 5);[/font]
[font=Serif] dwt_writetodevice(FS_CTRL_ID, FS_PLLCFG_OFFSET, 5, fs_pllcfg);[/font]
[font=Serif] dwt_readfromdevice(FS_CTRL_ID, FS_PLLCFG_OFFSET, 5, fs_pllcfg);[/font]
[font=Serif] // 6. Write the correct value for the selected channel to Sub-Register 0x2B:0B ? FS_PLLTUNE[/font]
[font=Serif] // e.g. 0xBE for channel 5. See table 43[/font]
[font=Serif] uint32_t fs_plltune = 0x0800041D;[/font]
[font=Serif] dwt_write32bitoffsetreg(FS_CTRL_ID, FS_PLLTUNE_OFFSET, fs_plltune);[/font]
[font=Serif] fs_plltune = dwt_read32bitoffsetreg(FS_CTRL_ID, FS_PLLTUNE_OFFSET);[/font]
[font=Serif] // 7. Write 0x22 to PMSC_CTRL0 to enable the appropriate clocks, see Sub-Register 0x36:00 ? PMSC_CTRL0;[/font]
[font=Serif] _dwt_enableclocks(ENABLE_ALL_SEQ);[/font]
[font=Serif] //_dwt_enableclocks(FORCE_TX_PLL);[/font]
[font=Serif] // 8. Write 0x0000 to reserved register Sub-Register 0x36:26 ? PMSC_TXFSEQ;[/font]
[font=Serif] uint16_t pmsc_txfineseq = 0x0000;[/font]
[font=Serif] dwt_write16bitoffsetreg(PMSC_ID, PMSC_TXFINESEQ_OFFSET, pmsc_txfineseq);[/font]
[font=Serif] pmsc_txfineseq = dwt_read16bitoffsetreg(PMSC_ID, PMSC_TXFINESEQ_OFFSET);[/font]
[font=Serif] // 9. Write 0x005FFF00 to Sub-Register 0x28:00 ? RF_CONF[/font]
[font=Serif] rf_conf = 0x005FFF00;[/font]
[font=Serif] dwt_write32bitoffsetreg(RF_CONF_ID, 0x0000, rf_conf);[/font]
[font=Serif] rf_conf = dwt_read32bitoffsetreg(RF_CONF_ID, 0x0000);[/font]
[font=Serif] // 10. Sub-Register 0x2A:0C ? TC_PGTEST to 0x13 to enable Continuous Wave (CW) Test Mode; [/font]
[font=Serif] uint8 tc_pgtest[1] = {TC_PGTEST_CW};[/font]
[font=Serif] dwt_writetodevice(TX_CAL_ID, TC_PGTEST_OFFSET, 1, tc_pgtest);[/font]
[font=Serif] dwt_readfromdevice(TX_CAL_ID, TC_PGTEST_OFFSET, 1, tc_pgtest);[/font]
[font=Serif] [font=Serif] }[/font][/font]
[font=Serif] deca_sleep(milliseconds);[/font]
[font=Serif] dwt_softreset();[/font]