应用:MSP430控制CC1101发码,由外部电源触发电源给CC1101供电2S时间,让CC1101发4条相同协议的码,有时不能发码,(已确定触发电源供电正常)
初始化和发码代码如下:
/*********************************************************
//函数名称:|PORT_INIT()
//函数功能:|端口初始化
*********************************************************/
void PORT_INIT(void)
{
P2SEL &= ~(TI_CC_CSn_PIN); //TI_CC_GDO0_PIN+ P2SEL2 &= ~(TI_CC_CSn_PIN); //TI_CC_GDO0_PIN+ TI_CC_GDO0_PxDIR &= ~TI_CC_GDO0_PIN; TI_CC_GDO0_PxIES &= ~ TI_CC_GDO0_PIN; TI_CC_GDO0_PxIFG &= ~TI_CC_GDO0_PIN; // Clear flag
TI_CC_GDO0_PxIE &= ~ TI_CC_GDO0_PIN; TI_CC_GDO0_PxREN |= TI_CC_GDO0_PIN;}
/*********************************************************
函数名称:|CC1101_INIT()
函数功能:|CC1101初始化
*********************************************************/
void CC1101_INIT(void)
{
TI_CC_SPISetup(); // Initialize SPI port TI_CC_PowerupResetCCxxxx(); // Reset CCxxxx
writeRFSettings(); // Write RF settings to config reg
temp = TI_CC_SPIReadReg(TI_CCxxx0_IOCFG2); // GDO2 output pin configuration
TI_CC_SPIWriteBurstReg(TI_CCxxx0_PATABLE, paTable, paTableLen); //Write PATABLE
TI_CC_SPIStrobe(TI_CCxxx0_SIDLE); // Exit RX / TX
TI_CC_SPIStrobe(TI_CCxxx0_SWOR); // Start automatic RX polling sequence }
/*********************************************************
函数名称:|Send_RF_Data()
函数功能:|发送数据到主机
*********************************************************/void Send_RF_Data(void)
{
Product_State[0]=Read_flashByte((unsigned char*)HOST_MAC_ID0);
Product_State[1]=Read_flashByte((unsigned char*)HOST_MAC_ID1);
Product_State[2]=Read_flashByte((unsigned char*)HOST_MAC_ID2);
RF_TxBuf[0] = 0x08; //1字节版本号
RF_TxBuf[1] = 0x0D; //1字节有效长度
RF_TxBuf[2] = 0XFF;
RF_TxBuf[3] = 0XFF;
RF_TxBuf[4] = 0XFF; RF_TxBuf[5] = MAC_buf[0]; //3字节设备地址MAC_buf[0],MAC_buf[1],MAC_buf[2]
RF_TxBuf[6] = MAC_buf[1];
RF_TxBuf[7] = MAC_buf[2];
RF_TxBuf[8] = 0x09; //1字节设备大类
RF_TxBuf[9] = 0x07; //1字节设备小类
RF_TxBuf[10] = 0x00; //2字节加密轮询
RF_TxBuf[11] = 0x00;
RF_TxBuf[12] = REPORT; //1字节控制命令
_DINT();
TI_CC_SPIStrobe(TI_CCxxx0_SIDLE); TI_CC_GDO0_PxIFG &= ~TI_CC_GDO0_PIN;
TI_CC_GDO0_PxIE &= ~TI_CC_GDO0_PIN;
RFSendPacket(RF_TxBuf, 13);
_EINT();
TI_CC_SPIStrobe(TI_CCxxx0_SIDLE); // Exit RX / TX
TI_CC_SPIStrobe(TI_CCxxx0_STX); // Enable TX.
TI_CC_SPIStrobe(TI_CCxxx0_SFRX); // Flush the RX FIFO buffer.
TI_CC_SPIStrobe(TI_CCxxx0_SRX); // Enable RX.
TI_CC_GDO0_PxIFG &= ~TI_CC_GDO0_PIN; TI_CC_GDO0_PxIE |= TI_CC_GDO0_PIN;
TI_CC_SPIStrobe(TI_CCxxx0_SFTX); // Flush the TX FIFO buffer.}
void main( void )
{
WDTCTL = WDTPW + WDTHOLD;
BCSCTL1 = CALBC1_16MHZ;
DCOCTL = CALDCO_16MHZ; _DINT(); DATA_INIT(); PORT_INIT();
CC1101_INIT(); _EINT(); for(x=0;x<4;x++)
{
Send_RF_Data();
}
while(1);
}
Seven Han:
cc1101属于无线系列芯片,请到
硬件, 射频和私有技术
咨询。
Alvin Chen:
void halRfSendPacket(BYTE *txBuffer, UINT8 size) {halSpiWriteBurstReg(CCxxx0_TXFIFO, txBuffer, size);halSpiStrobe(CCxxx0_STX);// Wait for GDO0 to be set -> sync transmittedwhile (!GDO0_PIN);// Wait for GDO0 to be cleared -> end of packetwhile (GDO0_PIN);}// halRfSendPacketDescriptionPart NumberCompanyTool Type
CC1101 JTI Balun 868/915 MHz Reference Design
CC1101-JTIBALUN-RD
Texas Instruments
Reference designsCC1101-CC1190EM 869 MHz Reference Design
CC1101-CC1190EM869RD
Texas Instruments
Reference designsCC1101-CC1190EM 915 MHz Reference Design
CC1101-CC1190EM915RD
Texas Instruments
Reference designsCC1101-RF3858 915MHz Reference Design
CC1101-RF3858-RD
Texas Instruments
Reference designsCC1101EM 315 and 433MHz Reference Design
CC1101EM433_REFDES
Texas Instruments
Reference designsCC1101EM 868 and 915MHz Reference Design
CC1101EM868-915_REFDES
Texas Instruments
Reference designsCC1110 IIFA Antenna 868/915 MHz Reference Design
CC1110IIFA-868-915-RD
Texas Instruments
Reference designsCC1110 Meander Antenna 868/915 MHz Reference Design
CC1110MDR-868-915-RD
Texas Instruments
Reference designsSoftware (3)
NamePart#Type
CC1100 CC1101 CC1100E CC2500 Examples Libraries (Rev. F) (ZIP841KB ) 1,225views,01 Apr 2009
SimpliciTI Compliant Protocol Stack
SIMPLICITI
Software LibrariesWireless M-Bus Protocol Software
WMBUS
Software Libraries