用CC1101做收发,在250K的速率下正常,可是在2.4K速率下fhr9i直接无法通讯,哪位高手能帮帮忙,帮忙配置一下参数,小弟在此感谢各位了。
贴一下250K的配置参数:
void CC1101_INIT(void)
{
unsigned long CH;
unsigned char FREQ_BY;
CS_CC1101=1;
INIT_CC1101_SPI();//初始化CC1101_SPI
Delay_s(1000);
CS_CC1101=0;
CC1101_ReadByte1(0x30);
CC1101_CTS();
CS_CC1101=1;
if(TX_RX_EN==1)
{
CC1101_CH=82;
}
else
{
CC1101_CH=IAP_ReadByte1(0x2000);//读频道
}
CC1101_WriteByte2(0x02,0x46);//GDO0脚输出配置
CC1101_WriteByte2(0x03,0x07);//RX FIFO和TX FIFO门限
CC1101_WriteByte2(0x07,0x4d); //PKTCTRL1-数据包自动控制
CC1101_WriteByte2(0x08,0x05);//数据包自动控制 可变长度数据包,通过同步词汇后的第一个位配置数据包长度
CC1101_WriteByte2(0x09,0x00); //ADDR- 设备地址 (可以删除)
CC1101_WriteByte2(0x0a,0x0C);//CHANNR 信道数
CC1101_WriteByte2(0x0b,0x0C);//FSCTRL1 频率合成器控制
CH=CH_FREQ+(CC1101_CH*630);//频道间隔0.25M
FREQ_BY=CH;
CC1101_WriteByte2(0x0f,FREQ_BY);//FREQ0 频率控制词汇,低字节
CH=CH>>8;
FREQ_BY=CH;
CC1101_WriteByte2(0x0e,FREQ_BY);//FREQ1 频率控制词汇,中间字节
CH=CH>>8;
FREQ_BY=CH;
CC1101_WriteByte2(0x0d,FREQ_BY);//FREQ2 频率控制词汇,高字节
CC1101_WriteByte2(0x10,0x2D);//MDMCFG4 调制解调器配置
CC1101_WriteByte2(0x11,0x3B);//MDMCFG3 调制解调器配置
CC1101_WriteByte2(0x12,0x13);//MDMCFG2 调制解调器配置
CC1101_WriteByte2(0x15,0x62);//DEVIATN 调制解调器背离设置
CC1101_WriteByte2(0x18,0x18);//MCSM0 主通信控制状态机配置
CC1101_WriteByte2(0x19,0x1d);//FOCCFG 频率偏移补偿配置
CC1101_WriteByte2(0x1a,0x1c); //BSCFG- 位同步配置
CC1101_WriteByte2(0x1b,0x07); //AGCCTRL2-AGC 控制
CC1101_WriteByte2(0x1c,0x00); //AGCCTRL1-AGC 控制
CC1101_WriteByte2(0x1d,0xb0); //AGCCTRL0-AGC 控制
CC1101_WriteByte2(0x1e,0x01); //WOREVT1- 高字节事件 0 工作暂停
CC1101_WriteByte2(0x1f,0xf1); //WOREVT0- 高字节事件 0 工作暂停
CC1101_WriteByte2(0x20,0x78);//WORCTRL 电磁波激活控制
CC1101_WriteByte2(0x21,0xb6); //FREND1- 前端 RX 配置
CC1101_WriteByte2(0x23,0xea);//FSCAL3 频率合成器校准
CC1101_WriteByte2(0x24,0x2a);//FSCAL2 频率合成器校准
CC1101_WriteByte2(0x25,0x00);//FSCAL1 频率合成器校准
CC1101_WriteByte2(0x26,0x1f);//FSCAL0 频率合成器校准
if(CC1101_CH>32)//判断为32频道过后 430.25之后的频道
{
CC1101_WriteByte2(0x2e,0x09); //TEST0- 可变测试设置
}
else
{
CC1101_WriteByte2(0x2e,0x0b); //TEST0- 可变测试设置
}
CC1101_WriteByte2(0x7e,0xc0); //设置输出功率
CC1101_WriteByte1(0x3a); //清空RX_FIFO
CC1101_WriteByte1(0x3b); //清空TX_FIFO
CC1101_WriteByte1(0x3a); //清空RX_FIFO
CC1101_WriteByte1(0x3b); //清空TX_FIFO
if(TX_RX_EN==0)
{
CC1101_WriteByte1(0x34); //开启RX
EX0 = 1;
}
else
{
CC1101_WriteByte1(0x36); //退出RX,TX
}
RX_EN_3=0;
} |