我正在努力使用CC2541的Proprietary mode作为BLE广播接收器,使用固定长度的basic mode,但是接收的数据一直不对,基本配置如下:
PRF_CHAN = 0x17; //PRF_CHAN set to 0x17 2402MHz
PRF_TASK_CONF = 0x00; //PRF_TASK_CONF configured for Basic mode, fixed length.
PRF_RADIO_CONF=0x00;
PRF_ADDR_ENTRY0.CONF.ENA0 = 1 //only use primary sync word
PRF_ADDR_ENTRY0.RXLENGTH = 19; //我要接收的广播数据,从access addr 后,到CRC前,有19字节
FRMCTRL0 = 0x40; //Magnitude:010 ; sync word is not included in CRC
MDMCTRL0 = 0x04; //GFSK 250 kHz deviation, 1 Mbit/s data rate
MDMCTRL1 = 0x48; //recommend value: Freeze frequency offset estimate after sync
MDMCTRL2 = 0x00; //transfer from SYNC_WORD[0]-[31];last bit of preamble is inverse of first bit of sync word; 1 leading preamble byte
MDMCTRL3 = 0x63; //Standard Gain and HIGH GAIN are both 0x63
SW0 = 0xD6; SW1 = 0xBE; SW2 = 0x89; SW3 = 0x8E; //sync word here for BLE broadcast access addr
PRF_CRC_LEN = 3; //set CRC 3Byte
PRF_CRC_INIT[3]=0x55;
PRF_CRC_INIT[2]=0x55;
PRF_CRC_INIT[1]=0x55;
PRF_CRC_INIT[0]=0x00;
BSP_P[0]=0x00; //BSP_Px= reset value;
BSP_P[1]=0x5B;
BSP_P[2]=0x06;
BSP_P[3]=0x00;
PRF_W_INIT=PRF_CHAN |0x40 ; //PRF_W_INIT set to channel number | 0x40 ,看蓝牙标准好像是这样设置但是实际程序运行时,BSP_W这个whitener寄存器的值会自动改变……不明白为什么
BSP_MODE=0x01; //使用7bit whitener,co-processor disable
每次广播时候程序会做出接收到数据的响应,但是接收的数据并不是期望值,CRC计算也不正确(寄存器RFIRQF1.RXNOK=1),希望有专家能够帮忙分析一下看看是哪里设置有问题,而且这个功能别人已经实现过的~
Viki Shi:
我们有个关于CC2541使用Proprietary mode的文档,请参考这边: http://processors.wiki.ti.com/index.php/CC2541_Dual_Stack#Proprietary_Application