CC1101 OOK 异步直通模式
请问TI的各位大神:
我现在想要通过IO口直接控制CC1101的发送和接收,设置代码如下:
{CC1101_IOCFG2, 0x2E},
{CC1101_IOCFG1, 0x2E},
{CC1101_IOCFG0, 0x0D},
{CC1101_FIFOTHR, 0x47},
{CC1101_PKTCTRL0, 0x32},//使能串行异步模式
{CC1101_CHANNR, 0x01},
{CC1101_FSCTRL1, 0x06},
{CC1101_FREQ2, 0x10},
{CC1101_FREQ1, 0xA7},
{CC1101_FREQ0, 0x62},
{CC1101_MDMCFG4, 0xF6},
{CC1101_MDMCFG3, 0x43},
{CC1101_MDMCFG2, 0x30},
{CC1101_DEVIATN, 0x15},
{CC1101_MCSM0, 0x18},
{CC1101_FOCCFG, 0x16},
{CC1101_WORCTRL, 0xFB},
{CC1101_FSCAL3, 0xE9},
{CC1101_FSCAL2, 0x2A},
{CC1101_FSCAL1, 0x00},
{CC1101_FSCAL0, 0x1F},
{CC1101_TEST2, 0x81},
{CC1101_TEST1, 0x35},
{CC1101_MCSM1, 0x3B},
CC1101初始化代码如下:
CC1101Reset( );
for( i = 0; i < sizeof(CC1101InitData)/2; i++ )
{
CC1101WriteReg( CC1101InitData[i][0], CC1101InitData[i][1] );
}
#if 0
CC1101SetAddress( 0x05, BROAD_0AND255 );
CC1101SetSYNC( 0x8799 );
CC1101WriteReg(CC1101_MDMCFG1, 0x72); //Modem Configuration
#endif
CC1101WriteMultiReg(CC1101_PATABLE, PaTabel, 8 );
CC1101SetPA(SET_PA_10_DBM);
发送代码如下:
CC1101SetTRMode( TX_MODE );
while(1)
{
GPIO_ResetBits(CC1101_GOD0_PORT, CC1101_GOD0_PIN);
for(i=0;i!=500000;++i)
;
GPIO_SetBits(CC1101_GOD0_PORT, CC1101_GOD0_PIN);
for(i=0;i!=500000;++i)
;
}
请问上面的代码有没有什么问题呢?
现在的问题就是用频谱仪能检测到发射信号,但是用专门接收OOK信号的接收模块不能看到高低电平的变化,用其他OOK的遥控器能够看到高低电平规律的变化
你可以先用FIFO模式,看是否通上。然后使用异步模式,这里可能的问题是你的PA_TABLE的设置问题。
# Sync word qualifier mode = 30/32 sync word bits detected
# CRC autoflush = false
# Channel spacing = 199.951172
# Data format = Normal mode
# Data rate = 249.939
# RX filter BW = 541.666667
# PA ramping = false
# Preamble count = 4
# Whitening = false
# Address config = No address check
# Carrier frequency = 433.919830
# Device address = 0
# TX power = -15
# Manchester enable = true
# CRC enable = true
# Deviation = 126.953125
# Packet length mode = Variable packet length mode. Packet length configured by the first byte after sync word
# Packet length = 255
# Modulation format = ASK/OOK
# Base frequency = 433.919830
# Channel number = 0
# PA table
#define PA_TABLE {0x00,0x1d,0x00,0x00,0x00,0x00,0x00,0x00,}
void config2()
{
cc1101.writeReg(CC1101_IOCFG0,0x06);
cc1101.writeReg(CC1101_PKTCTRL0,0x05);
cc1101.writeReg(CC1101_FSCTRL1,0x0C);
cc1101.writeReg(CC1101_FREQ2,0x10);
cc1101.writeReg(CC1101_FREQ1,0xB0);
cc1101.writeReg(CC1101_FREQ0,0x71);
cc1101.writeReg(CC1101_MDMCFG4,0x2D);
cc1101.writeReg(CC1101_MDMCFG3,0x3B);
cc1101.writeReg(CC1101_MDMCFG2,0x3B);
cc1101.writeReg(CC1101_DEVIATN,0x62);
cc1101.writeReg(CC1101_MCSM0,0x18);
cc1101.writeReg(CC1101_FOCCFG,0x1D);
cc1101.writeReg(CC1101_BSCFG,0x1C);
cc1101.writeReg(CC1101_AGCCTRL2,0x04);
cc1101.writeReg(CC1101_AGCCTRL1,0x00);
cc1101.writeReg(CC1101_AGCCTRL0,0x92);
cc1101.writeReg(CC1101_WORCTRL,0xFB);
cc1101.writeReg(CC1101_FREND1,0xB6);
cc1101.writeReg(CC1101_FREND0,0x11);
cc1101.writeReg(CC1101_FSCAL3,0xEA);
cc1101.writeReg(CC1101_FSCAL2,0x2A);
cc1101.writeReg(CC1101_FSCAL1,0x00);
cc1101.writeReg(CC1101_FSCAL0,0x1F);
cc1101.writeReg(CC1101_TEST0,0x09);
}
请问PA_TABLE的设置为什么会影响接收呢?
您好,刚才我测试过了,使用您的OOK的FIFO配置代码,还是不能接收,PA表我已经全部初始化为0xC0了
-
PA_TABLE {0x00,0x1d,0x00,0x00,0x00,0x00,0x00,0x00,}
-
第一个要是0
您好,上面的配置可以使用FIFO发送和接收了,改成OOK调制方式,能够通过GIO0发射出去,但是切换为射频输入时,使用GIO2不能接收信号,看不到信号有输出,GIO2的配置为0x0D,请问是什么原因呢?望解答
您好,请问cc1101在FSK模式下,可以不用接收前导码和帧同步码吗?我把MDMCFG2=0x03(能接收)改成MDMCFG2=0x00(不能接收)后就无法通信了,不知道是什么原因,求TI的大神帮忙解决下,非常感谢