本帖最后由 gzbkey 于 2014-8-13 14:02 编辑
用的代码也是网上找来的,发数据没有问题,收数据是检查寄存器的,想改为中断接收,IOCFG2设置为0x06,发送端发出数据,接收端没反应,设置成0x3f可以输出方波。谁能指教一下,设置成接收中断需要哪些操作啊,只要接收到数据是,GDO2电平能变化提示就可以。单片机中断代码是没有问题的。
寄存器搞的一头雾水,看说明看得眼花缭乱
下边是重新调整的设置
用示波器看到中断脉冲了,但是一定要在while中 运行 CC1101_SendPacket(buff,sizeof(buff)); 怎么回事啊
cc1101的寄存器 实在..................
CC1101_SPI_WriteReg(CC1101_IOCFG2,0x46); //GDO2 Output Pin Configuration
CC1101_SPI_WriteReg(CC1101_IOCFG1,0x2E); //GDO1 Output Pin Configuration
CC1101_SPI_WriteReg(CC1101_IOCFG0,0x06); //GDO0 Output Pin Configuration
//CC1101_SPI_WriteReg(CC1101_FIFOTHR,0x47); //RX FIFO and TX FIFO Thresholds
//CC1101_SPI_WriteReg(CC1101_SYNC1,0xD3); //Sync Word, High Byte
//CC1101_SPI_WriteReg(CC1101_SYNC0,0x91); //Sync Word, Low Byte
CC1101_SPI_WriteReg(CC1101_PKTLEN,0x0c); //Packet Length
CC1101_SPI_WriteReg(CC1101_PKTCTRL1,0x04);//Packet Automation Control
CC1101_SPI_WriteReg(CC1101_PKTCTRL0,0x45);//Packet Automation Control
CC1101_SPI_WriteReg(CC1101_ADDR,0x00); //Device Address
CC1101_SPI_WriteReg(CC1101_CHANNR,0x00); //Channel Number
CC1101_SPI_WriteReg(CC1101_FSCTRL1,0x06); //Frequency Synthesizer Control
CC1101_SPI_WriteReg(CC1101_FSCTRL0,0x00); //Frequency Synthesizer Control
CC1101_SPI_WriteReg(CC1101_FREQ2,0x10); //Frequency Control Word, High Byte
CC1101_SPI_WriteReg(CC1101_FREQ1,0xB1); //Frequency Control Word, Middle Byte
CC1101_SPI_WriteReg(CC1101_FREQ0,0x3B); //Frequency Control Word, Low Byte
CC1101_SPI_WriteReg(CC1101_MDMCFG4,0xF6); //Modem Configuration
CC1101_SPI_WriteReg(CC1101_MDMCFG3,0x83); //Modem Configuration
CC1101_SPI_WriteReg(CC1101_MDMCFG2,0x13); //Modem Configuration
CC1101_SPI_WriteReg(CC1101_MDMCFG1,0x22); //Modem Configuration
CC1101_SPI_WriteReg(CC1101_MDMCFG0,0xF8); //Modem Configuration
CC1101_SPI_WriteReg(CC1101_DEVIATN,0x15); //Modem Deviation Setting
CC1101_SPI_WriteReg(CC1101_MCSM2,0x07); //Main Radio Control State Machine Configuration
CC1101_SPI_WriteReg(CC1101_MCSM1,0x30); //Main Radio Control State Machine Configuration
CC1101_SPI_WriteReg(CC1101_MCSM0,0x18); //Main Radio Control State Machine Configuration
CC1101_SPI_WriteReg(CC1101_FOCCFG,0x16); //Frequency Offset Compensation Configuration
CC1101_SPI_WriteReg(CC1101_BSCFG,0x6C); //Bit Synchronization Configuration
CC1101_SPI_WriteReg(CC1101_AGCCTRL2,0x03);//AGC Control
CC1101_SPI_WriteReg(CC1101_AGCCTRL1,0x40);//AGC Control
CC1101_SPI_WriteReg(CC1101_AGCCTRL0,0x91);//AGC Control
CC1101_SPI_WriteReg(CC1101_WORCTRL,0xFB); //Wake On Radio Control
CC1101_SPI_WriteReg(CC1101_FSCAL3,0xE9); //Frequency Synthesizer Calibration
CC1101_SPI_WriteReg(CC1101_FSCAL2,0x2A); //Frequency Synthesizer Calibration
CC1101_SPI_WriteReg(CC1101_FSCAL1,0x00); //Frequency Synthesizer Calibration
CC1101_SPI_WriteReg(CC1101_FSCAL0,0x1F); //Frequency Synthesizer Calibration
CC1101_SPI_WriteReg(CC1101_TEST2,0x81); //Various Test Settings
CC1101_SPI_WriteReg(CC1101_TEST1,0x35); //Various Test Settings
CC1101_SPI_WriteReg(CC1101_TEST0,0x09); //Various Test Settings
|