CC1150的发射问题
TI的工程师:
您好,我用CC1150做射频发射端,现在我碰到的问题是: CC1150复位、寄存器初始化都能正常运行。但是我让CC1150发送数据时,此时我判断GDO0口的状态来判断发送进程。每次程序跑到while (!GDO0);这条语句时,程序就死在这里了。但是同样的程序我用CC1101跑。却没有问题。下面是我的初始化:频率是410M,波特率是250K。
typedef struct S_RF_SETTINGS
{
//INT8U FSCTRL2; //自已加的
//INT8U FSCTRL1; // Frequency synthesizer control.
//INT8U FSCTRL0; // Frequency synthesizer control.
INT8U FREQ2; // Frequency control word, high INT8U.
INT8U FREQ1; // Frequency control word, middle INT8U.
INT8U FREQ0; // Frequency control word, low INT8U.
INT8U MDMCFG4; // Modem configuration.
INT8U MDMCFG3; // Modem configuration.
INT8U MDMCFG2; // Modem configuration.
INT8U MDMCFG1; // Modem configuration.
INT8U MDMCFG0; // Modem configuration.
INT8U CHANNR; // Channel number.
INT8U DEVIATN; // Modem deviation setting (when FSK modulation is enabled).
//INT8U FREND1; // Front end RX configuration.
INT8U FREND0; // Front end RX configuration.
INT8U MCSM0; // Main Radio Control State Machine configuration.
//INT8U FOCCFG; // Frequency Offset Compensation Configuration.
//INT8U BSCFG; // Bit synchronization Configuration.
//INT8U AGCCTRL2; // AGC control.
//INT8U AGCCTRL1; // AGC control.
//INT8U AGCCTRL0; // AGC control.
INT8U FSCAL3; // Frequency synthesizer calibration.
INT8U FSCAL2; // Frequency synthesizer calibration.
INT8U FSCAL1; // Frequency synthesizer calibration.
INT8U FSCAL0; // Frequency synthesizer calibration.
INT8U FSTEST; // Frequency synthesizer calibration control
INT8U TEST2; // Various test settings.
INT8U TEST1; // Various test settings.
INT8U TEST0; // Various test settings.
INT8U IOCFG2; // GDO2 output pin configuration
INT8U IOCFG0; // GDO0 output pin configuration
//INT8U PKTCTRL1; // Packet automation control.
INT8U PKTCTRL0; // Packet automation control.
INT8U ADDR; // Device address.
INT8U PKTLEN; // Packet length.
} RF_SETTINGS;
/////////////////////////////////////////////////////////////////
const RF_SETTINGS rfSettings =
{
//0x00,
//0x0c, // FSCTRL1 Frequency synthesizer control.
//0x00, // FSCTRL0 Frequency synthesizer control.
0x0f, // FREQ2 Frequency control word, high byte.
0xc4, // FREQ1 Frequency control word, middle byte.
0xec, // FREQ0 Frequency control word, low byte.
0x0d, // MDMCFG4 Modem configuration.
0x3b, // MDMCFG3 Modem configuration.
0x13, // MDMCFG2 Modem configuration.
0x22, // MDMCFG1 Modem configuration.
0xF8, // MDMCFG0 Modem configuration.
0x03, // CHANNR Channel number.
0x00, // DEVIATN Modem deviation setting (when FSK modulation is enabled).
//0xB6, // FREND1 Front end RX configuration.
0x10, // FREND0 Front end RX configuration.
0x18, // MCSM0 Main Radio Control State Machine configuration.
//0x1D, // FOCCFG Frequency Offset Compensation Configuration.
//0x1C, // BSCFG Bit synchronization Configuration.
//0xC7, // AGCCTRL2 AGC control.
//0x00, // AGCCTRL1 AGC control.
//0xB0, // AGCCTRL0 AGC control.
0xEA, // FSCAL3 Frequency synthesizer calibration.
0x2A, // FSCAL2 Frequency synthesizer calibration.
0x00, // FSCAL1 Frequency synthesizer calibration.
0x1F, // FSCAL0 Frequency synthesizer calibration.
0x59, // FSTEST Frequency synthesizer calibration.
0x88, // TEST2 Various test settings.
0x31, // TEST1 Various test settings.
0x0b, // TEST0 Various test settings.
0x0b, // IOCFG2 GDO2 output pin configuration.
0x06, // IOCFG0D A GDO0 output pin configuration. Refer to SmartRF?Studio User Manual for detailed pseudo register explanation.
//0x04, // PKTCTRL1 Packet automation control.
0x05, // PKTCTRL0 Packet automation control.
0x00, // ADDR Device address.
0x05 // PKTLEN Packet length.
};
发送程序:
void halRfSendPacket(INT8U *txBuffer, INT8U size)
{
halSpiWriteReg(CCxxx0_TXFIFO, size);
halSpiWriteBurstReg(CCxxx0_TXFIFO, txBuffer, size); //写入要发送的数据
halSpiStrobe(CCxxx0_STX); //进入发送模式发送数据
// Wait for GDO0 to be set -> sync transmitted
while (!GDO0);
// Wait for GDO0 to be cleared -> end of packet
while (GDO0);
halSpiStrobe(CCxxx0_SFTX);
}
死在 while(!GDO0), 那实际用示波器测量GDO0是什么情况?
你用的是什么板子?自己做的还是TI的参考板? MCU是哪颗?
另外可以查看一下 TX_FIFO 的状态,看是不是underflow了。
因为CC1150只支持发送,可以尝试把 GDO0_CFG[5:0] 设置为0x05 试试。
根据你们的提示,查到问题了。由于我们硬件工程师的失误,造成PCB问题。给你们添麻烦了。谢谢!