cc1310 driverlib 射频初始化问题
只使用了driverlib中的驱动库,本想测试下命令的交互,顺带发送一个载波信号出来,却不想一直没成功。
。。。。。。
//1. XOSC初始化 PRCMPowerDomainOn(PRCM_DOMAIN_PERIPH); while (PRCM_DOMAIN_POWER_ON != PRCMPowerDomainStatus(PRCM_DOMAIN_PERIPH)); PRCMPowerDomainOn(PRCM_DOMAIN_VIMS); while (PRCM_DOMAIN_POWER_ON != PRCMPowerDomainStatus(PRCM_DOMAIN_VIMS)); PRCMDomainEnable(PRCM_DOMAIN_VIMS); PRCMPeripheralRunEnable(PRCM_PERIPH_GPIO); PRCMLoadSet(); while (!PRCMLoadGet()); if (OSCClockSourceGet(OSC_SRC_CLK_LF)!=OSC_XOSC_LF) { OSCClockSourceSet(OSC_SRC_CLK_LF, OSC_XOSC_LF); } SetupSetAonRtcSubSecInc(0x7FFD40); if (OSCClockSourceGet(OSC_SRC_CLK_HF)!=OSC_XOSC_HF) { uint32_t tmp; OSCHF_TurnOnXosc(); while (!OSCHfSourceReady()); OSCHfSourceSwitch(); do {//check tmp = OSCClockSourceGet(OSC_SRC_CLK_HF); } while (tmp != OSC_XOSC_HF); } //2. RF部分电源与时钟初始化 rf_core_set_modesel(); if (!PRCMRfReady()) { PRCMPowerDomainOn(PRCM_DOMAIN_RFCORE); while (PRCMPowerDomainStatus(PRCM_DOMAIN_RFCORE)!=PRCM_DOMAIN_POWER_ON); PRCMDomainEnable(PRCM_DOMAIN_RFCORE); PRCMLoadSet(); while (!PRCMLoadGet()); //RFCClockSet(RFC_PWR_PWMCLKEN_CPERAM|RFC_PWR_PWMCLKEN_CPE |RFC_PWR_PWMCLKEN_RFC); RFCClockEnable(); //rf_patch_cpe_genfsk(); clock_wait(CLOCK_SECOND); } //3.命令交互测试 tmp = RFCDoorbellSendTo((uint32_t)&RF_cmdPropRadioDivSetup); wait_cmd_done(&RF_cmdPropRadioDivSetup); if ((RF_cmdPropRadioDivSetup.status&0x0fff)!=0x0400) { flag = 1; printf("radio setup error-->status=%x\r\n", RF_cmdPropRadioDivSetup.status); } tmp = RFCDoorbellSendTo((uint32_t)&RF_cmdFs); wait_cmd_done(&RF_cmdFs); if ((RF_cmdFs.status&0x0ffff)!=0x0400) { flag = 1; printf("Fs cmd error-->status=%x\r\n", RF_cmdFs.status); }
当运行到 RF_cmdPropRadioDivSetup时,命令中的status一直为0x02。
同道中人。。。 不过基于DRIVERLIB直接编程,官方不会提供技术支持,相信,这里不会有答案。demo 中的例程有答案。。。
我认为问题在于 RF_cmdPropRadioDivSetup这条命令后面跟随的pOverrides。
具体为什么会这样还暂时不清楚。
修改pOverrides后,发射出了载波信号!
// Overrides for CMD_PROP_RADIO_div_SETUP static uint32_t pOverrides[] = { // override_use_patch_prop_genfsk.xml // PHY: Use MCE ROM bank 4, RFE RAM patch //MCE_RFE_OVERRIDE(0,4,0,1,0,0), // override_synth_prop_863_930_div5.xml // Synth: Set recommended RTRIM to 7 HW_REG_OVERRIDE(0x4038,0x0037), // Synth: Set Fref to 4 MHz (uint32_t)0x000684A3, // Synth: Configure fine calibration setting HW_REG_OVERRIDE(0x4020,0x7F00), // Synth: Configure fine calibration setting HW_REG_OVERRIDE(0x4064,0x0040), // Synth: Configure fine calibration setting (uint32_t)0xB1070503, // Synth: Configure fine calibration setting (uint32_t)0x05330523, // Synth: Set loop bandwidth after lock to 20 kHz (uint32_t)0x0A480583, // Synth: Set loop bandwidth after lock to 20 kHz (uint32_t)0x7AB80603, // Synth: Configure VCO LDO (in ADI1, set VCOLDOCFG=0x9F to use voltage input reference) ADI_REG_OVERRIDE(1,4,0x9F), // Synth: Configure synth LDO (in ADI1, set SLDOCTL0.COMP_CAP=1) ADI_HALFREG_OVERRIDE(1,7,0x4,0x4), // Synth: Use 24 MHz XOSC as synth clock, enable extra PLL filtering (uint32_t)0x02010403, // Synth: Configure extra PLL filtering (uint32_t)0x00108463, // Synth: Increase synth programming timeout (0x04B0 RAT ticks = 300 us) (uint32_t)0x04B00243, // override_phy_rx_aaf_bw_0xd.xml // Rx: Set anti-aliasing filter bandwidth to 0xD (in ADI0, set IFAMPCTL3[7:4]=0xD) ADI_HALFREG_OVERRIDE(0,61,0xF,0xD), // override_phy_gfsk_rx.xml // Rx: Set LNA bias current trim offset to 3 (uint32_t)0x00038883, // Rx: Freeze RSSI on sync found event HW_REG_OVERRIDE(0x6084,0x35F1), // override_phy_gfsk_pa_ramp_agc_reflevel_0x1a.xml // Tx: Configure PA ramping setting (0x41). Rx: Set AGC reference level to 0x1A. HW_REG_OVERRIDE(0x6088,0x411A), // Tx: Configure PA ramping setting HW_REG_OVERRIDE(0x608C,0x8213), // override_phy_rx_rssi_offset_5db.xml // Rx: Set RSSI offset to adjust reported RSSI by +5 dB (uint32_t)0x00FB88A3, // TX power override // Tx: Set PA trim to max (in ADI0, set PACTL0=0xF8) ADI_REG_OVERRIDE(0,12,0xF8), (uint32_t)0xFFFFFFFF, }; // CMD_PROP_RADIO_div_SETUP // Proprietary Mode Radio Setup Command for All Frequency Bands rfc_CMD_PROP_RADIO_div_SETUP_t RF_cmdPropRadioDivSetup = { .commandNo = 0x3807, .status = 0x0000, .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx .startTime = 0x00000000, .startTrigger.triggerType = 0x0, .startTrigger.bEnaCmd = 0x0, .startTrigger.triggerNo = 0x0, .startTrigger.pastTrig = 0x0, .condition.rule = 0x1, .condition.nSkip = 0x0, .modulation.modType = 0x1, .modulation.deviation = 0x64, .symbolRate.preScale = 0xF, .symbolRate.rateWord = 0x8000, .rxBw = 0x24, .preamConf.nPreamBytes = 0x1E, .preamConf.preamMode = 0x0, .formatConf.nSwBits = 0x20, .formatConf.bBitReversal = 0x0, .formatConf.bMsbFirst = 0x1, .formatConf.fecMode = 0x0, .formatConf.whitenMode = 0x0, .config.frontEndMode = 0x0, .config.biasMode = 0x1, .config.analogCfgMode = 0x0, .config.bNoFsPowerUp = 0x0, .txPower = 0xAB3F, .pRegOverride = pOverrides, .centerFreq = 0x0364, .intFreq = 0x8000, .loDivider = 0x05, };
以上是 RF_cmdPropRadioDivSetup命令和pOverrides,
注释掉第一句 //MCE_RFE_OVERRIDE(0,4,0,1,0,0),后,Setup正常。
使用SmartRF Studio 7是能正确操作板子的, 是自己程序中ccfg.c没配置正确吗或者其他初始化代码有问题?