谁能分享一个完整的项目示例,如何在专有 RF 模式下设置寄存器和接收数据? Texas Instruments 只发布了一个示例——PER Test,该示例非常难以理解和修改。理想情况下,我想禁用尽可能多的东西并听取来自解调器的原始数据。
这是我到目前为止的想法:
#include "prop_regs.h"
#include "hal_board.h"
void halRfSetFreq(uint16 frequency);
void rxSetRegisterSettings(void);
void halRfSetFreq(uint16 frequency) {
MDMTEST1 = 0x05; // 0 MHz IF
FREQCTRL = frequency - 2379;
return;
}
void rxSetRegisterSettings(void) {
/***********************************************************************
* CC2541 RX REGISTER SETTINGS
*/
FRMCTRL0 = 0x40; //
MDMCTRL0 = 0x06; // modem configuration
MDMCTRL1 = 0x48; // modem configuration
MDMCTRL2 = 0x7C; // modem configuration
MDMCTRL3 = 0x23; // modem configuration
SW0 = 0x34; // primary sync word byte 0
SW1 = 0x12; // primary sync word byte 1
SW2 = 0x00; // primary sync word byte 2
SW3 = 0x00; // primary sync word byte 3
RXCTRL = 0x29; // receive section tuning
FSCTRL = 0x5A; // frequency synthesizer tuning
LNAGAIN = 0x00; // lna gain setting
ADCTEST0 = 0x66; //
MDMTEST1 = 0x25; // modem configuration
LLECTRL = 0x01; // lle control
BSP_MODE = 0x00; // bit stream processor configuration
IVCTRL = 0x1B; // analog control register
RFC_OBS_CTRL0 = 0x08;
RFC_OBS_CTRL1 = 0x09;
OBSSEL0 = 0xFB;
OBSSEL1 = 0xFC;
}
/***********************************************************************************
* @fn main
*
* @brief Main program
*
* @param void
*
* @return int (does not return)
*/
int main(void) {
unsigned volatile char *p = 0;
unsigned char i = 0;
// Initialize Clock Source (32 Mhz Xtal), global interrupt (EA=1), I/O ports and pheripherals(LCD).
halBoardInit();
// Clear radio data RAM (page 0)
p = RFCORE_RAM_PAGE;
for (i = 0; i < RFCORE_RAM_PAGE_SZ; i++) {
*p++ = 0;
}
// Program sync word length to 32 bit and configure single sync word
SW_CONF = 0;
// Disable timer 2 events to LLE
T2EVTCFG = 0x77;
//Enable link layer engine prop mode
LLECTRL = 0x01;
RFST = 0x01; // CMD_Shutdown
halRfInit();
// Set correct register settings for continous rx.
// Most settings copied from SmartRFStudio.
rxSetRegisterSettings();
// Set frequency.
halRfSetFreq(2424); // 2440 MHz
// Clear TASKDONE interrupt
RFIRQF1 = ~0x40;
//Send CMD_Rx_TEST to LLE.
while (RFST != 0);
RFST = CMD_DEMOD_TEST;
while(1);
}
我在 P1_0 和 P1_1 上连接了我的逻辑分析仪,但它没有声音。