Hi
我用CC1310来做频率扫描实验,发送模式切换频率正常,接收模式不正常,
根据CMD_MODIFY_FS命令的描述,设定新的合成频率而不重新校准,是一个立即执行命令,如果命令是在rx或tx期间执行的,则可能发生额外的失真,所以在执行该命令前进行了RX和TX的开和关,由于我的程序是不发送时就一直处于接收状态,所以执行该命令前后分别进行了RX的关和开操作,程序如下:
{
uint32_t new_freq,cmd_status;
uint16_t freq, frac;
rfc_CMD_MODIFY_FS_t cmd_modify_fs;
smartrf_settings_cmd_prop_radio_div_setup.centerFreq = freq;
smartrf_settings_cmd_fs.frequency = freq;
smartrf_settings_cmd_fs.fractFreq = frac;
memset(&cmd_modify_fs, 0x00, sizeof(rfc_CMD_MODIFY_FS_t));
cmd_modify_fs.commandNo = CMD_MODIFY_FS;
cmd_modify_fs.frequency = freq;
cmd_modify_fs.fractFreq = frac;
//需要执行RF rx关闭,否则会导致失真
rx_off_prop();
rf_core_send_cmd((uint32_t)&cmd_modify_fs, &cmd_status);
rx_on_prop();
}
在发送时切换频率可以正常运行,但是在接收时切换频率就无法接收数据了,请问切换频率操作有什么需要注意的地方?在其他帖子里看到有直接操作RFC_FSCA_O_PLLM寄存器直接改变频率,但是手册中找不到该寄存器的描述。
Viki Shi:
论坛有类似问题,请参考这边: e2e.ti.com/…/663662
Susan Yang:
CMD_MODIFY_FS can only be used for CC2640R2 or the CC13x2/ CC26x2 products
您可以看一下 e2e.ti.com/…/663662
user5271072:
回复 Viki Shi:
非常感谢您的回答,相关帖子我也看了,如下是论坛里给的扫描可用信道的程序,标黄部分的寄存器在手册里没有说明,这里看的不太明白
int16_t findActiveRFChannel(void) {
uint32_t mceEvent2 = 0;
uint8_t pqtScanCount;
prevTime = AONRTCCurrent64BitValueGet();
/* Override som internal configuration */
setupScanModemOverrides();
/* Switch off AGC and set static max gain */
HWREG(0x40046084) = 0x34FF;
/* Use the pre cal values and do fast frequency scan */
/* Enable FSCA and RFE in the RF Core */
RF_runImmediateCmd(rfHandle, CMDR_DIR_CMD_2BYTE( 0x0607, RFC_PWR_PWMCLKEN_RFE |
RFC_PWR_PWMCLKEN_RFERAM |
RFC_PWR_PWMCLKEN_MDM |
RFC_PWR_PWMCLKEN_MDMRAM |
RFC_PWR_PWMCLKEN_FSCA));
/* Change the frequency by overwriting the registers and read rssi */
for (chNum = 0; chNum < NUM_CHANNELS; chNum++ ) {
HWREG(RFC_FSCA_BASE + RFC_FSCA_O_PLLM) = chFsCal[chNum].pllm;
midCalValue = chFsCal[chNum].midCal;
frcdco_reg = ((midCalValue << 8) | (chFsCal[chNum].coarseCal << 4) | 0xC);
HWREG(RFC_FSCA_BASE + RFC_FSCA_O_FRCDCO) = frcdco_reg;
/* Delay to read RSSI */
Task_sleep(chSwitchDelay);
chRssi[chNum] = RF_getRssi(rfHandle);
chFsCal[chNum].chRssi = chRssi[chNum];
if (chRssi[strongestCh] < chRssi[chNum])
strongestCh = chNum;
}
/* Switch on AGC to dynamically control gain */
HWREG(0x40046084) = 0x34F1;
/* PQT Scanning */
if( chRssi[strongestCh] > RX_SENSITIVITY_THRESHOLD) {
for(pqtScanCount = 0; pqtScanCount < num_pqt_scans; pqtScanCount++ ) {
/* Set channel for strongest channel */
HWREG(RFC_FSCA_BASE + RFC_FSCA_O_PLLM) = chFsCal[strongestCh].pllm;
midCalValue = chFsCal[strongestCh].midCal;
frcdco_reg = ((midCalValue << 8) | (chFsCal[strongestCh].coarseCal << 4) | 0xC);
HWREG(RFC_FSCA_BASE + RFC_FSCA_O_FRCDCO) = frcdco_reg;
/* Scan for Preamble quality */
Task_sleep(pqtSymbolTime);
/* Clear previous correlation peak event */
HWREG(RFC_MDM_BASE + RFC_MDM_O_MCEEVENTCLR2) |= MCE_CORRELATOR_PEAK_FOUND_EVENT;
Task_sleep(symbolTime * 2);
/* Check if we found a correlation */
mceEvent2 = HWREG(RFC_MDM_BASE + RFC_MDM_O_MCEEVENT2);
if(mceEvent2 & MCE_CORRELATOR_PEAK_FOUND_EVENT) {
pqtCount++;
/* RF frequency found. Hence exit */
/* Get the total time taken to scan all channels */
currentTime = AONRTCCurrent64BitValueGet(); /* Returns (SEC[31:0].SUBSEC[31:0]).*/
diffTime = currentTime – prevTime;
prevTime = currentTime;
return 1;
}
// find next strong channel here
chRssi[strongestCh] = -128;
for (chNum = 0; chNum < NUM_CHANNELS; chNum++ ) {
if (chRssi[strongestCh] < chRssi[chNum])
strongestCh = chNum;
}
}
}
/* Disable forcing of the mid code and force the mid code found in calibration. Need to do this
* for the next CMD_FS to work. */
HWREG(RFC_FSCA_BASE + RFC_FSCA_O_FRCDCO) &= ~RFC_FSCA_FRCDCO_TST_FORCE_C_M_F_CODES_M;
return 0;
}
user5271072:
回复 Viki Shi:
非常感谢您的回答,请问
HWREG(RFC_FSCA_BASE + RFC_FSCA_O_PLLM)
HWREG(RFC_FSCA_BASE + RFC_FSCA_O_FRCDCO)
这两个寄存器有没有相关说明