久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 22759|回復: 4
打印 上一主題 下一主題
收起左側

stm8---SI4463模塊驅動程序(433M模塊)

[復制鏈接]
跳轉到指定樓層
樓主
ID:71477 發表于 2015-1-1 20:10 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
  1. STM8S103F3 驅動si4463 模塊程序框架 si4463模塊寄存器很多,用官方的WDS3 軟件配置好頻段,波特率,調制模式等,可以自動生成config.h 文件,甚至可以幫你生成一個完成Keil程序工程 。

  2. /***********************************************
  3. 函 數: main
  4. 功 能: 程序入口
  5. 輸 入: /
  6. 輸 出: /
  7. 描 述: /
  8. ***********************************************/
  9. void main(void)
  10. {
  11.   u8 i,length;
  12.   delay_ms(1000);
  13.   CLOCK_init();//時鐘8分頻 2M  RC
  14.   delay_ms(200);
  15.    InitializeSystem();
  16.   if(POWER_KEY==0)
  17.   {
  18.     POWER_EN6=1;
  19.     POWER_EN5=0;
  20.   }
  21.   else
  22.   {
  23.     POWER_EN6=0;
  24.     POWER_EN5=1;
  25.   }
  26.   LED_BIT=1;
  27.   //enableInterrupts();  //開總中斷
  28.    Get_ADC(4);//進行ADC轉換,獲得AD值
  29.   delay_ms(100);
  30.   SetTimer2(50000);
  31.   disableInterrupts();
  32.   
  33.   WakeUpFlag=1;
  34.   while( 1 )
  35.     {
  36.       if(! SI4463_IRQ_BIT)
  37.         {
  38.       
  39.       SI446X_INT_STATUS( SI4463_Buf );
  40.      
  41.       if( SI4463_Buf[3] & ( 1<<4 ) )
  42.       {  
  43.         // Get RSSI
  44.         SI446X_RSSI_INFO(&Rssi_Value);
  45.         //收到一個數據包,翻轉LED
  46.         length = SI446X_READ_PACKET( SI4463_Buf );
  47.      
  48.         if(modbus_cmd( SI4463_Buf , RW_Reg_Req_Len )==0)//檢查功能碼并計算校驗
  49.         {
  50.          
  51.           if((SI4463_Buf[1] == XIUGAI_433M_ID)&&(!POWER_KEY))
  52.           {
  53.             
  54.             LED_BIT=0;
  55.             RxOverTime=0;
  56.             WaitCnt=0;
  57.             SI4463_Txd[1]=XIUGAI_433M_ID;
  58.             LocationID[0]=SI4463_Buf[11];
  59.             LocationID[1]=SI4463_Buf[12];
  60.             LocationID[2]=SI4463_Buf[13];
  61.             LocationID[3]=SI4463_Buf[14];
  62.             EEPROM_Write(0x4002,LocationID[0]);
  63.             EEPROM_Write(0x4003,LocationID[1]);
  64.             EEPROM_Write(0x4004,LocationID[2]);
  65.             EEPROM_Write(0x4005,LocationID[3]);
  66.             RW_MultiReg_Ack(SI4463_Txd[1], LocationID[0] ,LocationID[1], LocationID[2], LocationID[3]); //發送輪詢命令
  67.             while(SI4463_IRQ_BIT);
  68.             SI446X_INT_STATUS( SI4463_Buf );
  69.          
  70.           }
  71.    
  72.           if( (SI4463_Buf[1] == XIUGAI_433M_MAC)&&(!POWER_KEY))  
  73.           {
  74.             LED_BIT=0;
  75.             RxOverTime=0;
  76.             WaitCnt=0;
  77.             SI4463_Txd[1]=XIUGAI_433M_MAC;
  78.             LocationMac[0]=SI4463_Buf[11];
  79.             LocationMac[1]=SI4463_Buf[12];
  80.             LocationMac[2]=SI4463_Buf[13];
  81.             LocationMac[3]=SI4463_Buf[14];
  82.             EEPROM_Write(0x4008,LocationMac[0]);
  83.             EEPROM_Write(0x4009,LocationMac[1]);
  84.             EEPROM_Write(0x400a,LocationMac[2]);
  85.             EEPROM_Write(0x400b,LocationMac[3]);
  86.             RW_MultiReg_Ack(SI4463_Txd[1], LocationMac[0] ,LocationMac[1], LocationMac[2], LocationMac[3]); //發送輪詢命令
  87.             while(SI4463_IRQ_BIT);
  88.             SI446X_INT_STATUS( SI4463_Buf );
  89.            
  90.           }
  91.          
  92.           if( (SI4463_Buf[1] == SET_433M_RF_POWER)&&(!POWER_KEY))  
  93.           {
  94.             LED_BIT=0;
  95.             RxOverTime=0;
  96.             WaitCnt=0;
  97.             SI4463_Txd[1]=SET_433M_RF_POWER;
  98.             RF_PA_POWER_SET[5]=SI4463_Buf[18];
  99.             EEPROM_Write(0x400c,RF_PA_POWER_SET[5]);//保存功率設置
  100.             SI446X_CMD( RF_PA_POWER_SET, 8 ); //發射功率設置     
  101.             RW_MultiReg_Ack(SI4463_Txd[1], RF_PA_POWER_SET[5] ,LocationMac[1], LocationMac[2], LocationMac[3]); //發送輪詢命令
  102.             while(SI4463_IRQ_BIT);
  103.             SI446X_INT_STATUS( SI4463_Buf );
  104.             
  105.           }
  106.           if( (SI4463_Buf[1] == SCAN_433M_ID)&&(SI4463_Buf[11]==LocationID[0]) )
  107.           {
  108.             LED_BIT=0;
  109.             RxOverTime=0;
  110.             WaitCnt=0;
  111.             RW_MultiReg_Ack(SI4463_Txd[1], LocationID[0] ,LocationID[1], LocationID[2], LocationID[3]); //發送輪詢命令
  112.             while(SI4463_IRQ_BIT);
  113.             SI446X_INT_STATUS( SI4463_Buf );
  114.            
  115.   
  116.           }
  117.           if( (SI4463_Buf[1] == MAC_SCAN_433M)&&(SI4463_Buf[11]==LocationID[0]))
  118.           //if( SI4463_Buf[1] == MAC_SCAN_433M)
  119.           {
  120.             LED_BIT=0;
  121.             RxOverTime=0;//接收超時時間清0
  122.             WaitCnt=0;//休眠時間清0
  123.             SI4463_Txd[1]=MAC_SCAN_433M;
  124.             RW_MultiReg_Ack(SI4463_Txd[1], LocationMac[0] ,LocationMac[1], LocationMac[2], LocationMac[3]); //發送輪詢命令
  125.             while(SI4463_IRQ_BIT);
  126.             SI446X_INT_STATUS( SI4463_Buf );
  127.             WakeUpFlag=0;
  128.           }
  129.           if( (SI4463_Buf[1] == VERSION_SCAN_433M)&&(SI4463_Buf[11]==LocationMac[0]) )//版本號命令
  130.           {
  131.             LED_BIT=0;
  132.             RxOverTime=0;
  133.             WaitCnt=0;
  134.             SI4463_Txd[1]=VERSION_SCAN_433M;
  135.             RW_Version_Ack(SI4463_Txd[1], LocationMac[0] ,LocationMac[1], LocationMac[2], LocationMac[3],LocationVersion); //發送輪詢命令
  136.             while(SI4463_IRQ_BIT);
  137.             SI446X_INT_STATUS( SI4463_Buf );
  138.           }
  139.    
  140.          
  141.           //回到接收模式,繼續等待信號
  142.           SI446X_START_RX( 0, 0, PACKET_LENGTH,0,3,3 );
  143.           Get_ADC(4);//進行ADC轉換,獲得AD值
  144.          
  145.         }
  146.   
  147.    
  148.       } //end if( buffer[3] & ( 1<<4 ) )
  149.       
  150.       SI446X_START_RX( 0, 0, PACKET_LENGTH,0,3,3 );
  151.       if( !WakeUpFlag )
  152.       {
  153.          WakeUpFlag=1;
  154.         WaitCnt=0;
  155.         RxOverTime=0;
  156.         SI_SDN_HIGH();//關閉射頻SI4463模塊,進入低功耗
  157.         WakeUpState=0;//模塊休眠狀態
  158.       }
  159.     } //end if((PD_IDR&0x04)==0x00)
  160.    
  161.     if(ELECTRIC_BIT)
  162.     {
  163.       ElectricValue=0xff;//市電接入
  164.     }
  165.     else
  166.     ElectricValue=0x0a; //市電斷開
  167.     if(TIM2_SR1&0x01)
  168.     {
  169.       TIM2_SR1=0x00;//清除第一次無效中斷
  170.       RxOverTime++;
  171.       WaitCnt++;
  172.     }
  173.     if((WaitCnt>140)&&(!WakeUpState) )//7.5S喚醒
  174.     {
  175.        WaitCnt=0;
  176.       WakeUpFlag=1;
  177.       SI446X_RESET();        //SI446X 模塊復位
  178.       SI446X_CONFIG_INIT();  //SI446X 模塊初始化配置函數
  179.       SI446X_START_RX( 0, 0, PACKET_LENGTH,0,3,3 );
  180.       WakeUpState=1;//模塊喚醒狀態
  181.     }
  182.     if(RxOverTime>260)//超過13S沒有收到輪詢,主動發送 一條
  183.     {
  184.       RxOverTime=0;
  185.        SI446X_RESET();        //SI446X 模塊復位
  186.       SI446X_CONFIG_INIT();  //SI446X 模塊初始化配置函數
  187.       SI446X_START_RX( 0, 0, PACKET_LENGTH,0,3,3 );
  188.        SI4463_Txd[1]=MAC_SCAN_433M;
  189.       RW_MultiReg_Ack(SI4463_Txd[1], LocationMac[0] ,LocationMac[1], LocationMac[2], LocationMac[3]); //發送輪詢命令
  190.       while(SI4463_IRQ_BIT);
  191.       SI446X_INT_STATUS( SI4463_Buf );
  192.       WaitCnt=0;
  193.       RxOverTime=0;
  194.       SI446X_INT_STATUS( SI4463_Buf );
  195.       SI446X_START_RX( 0, 0, PACKET_LENGTH,0,3,3 );
  196.     }
  197.    
  198.    
  199.     LED_BIT=1;
  200.   } //end while(1)
  201.   
  202. } //end main

  203. /******************************************************************************************************************/
  204. /*****************系統初始化*****************************/
  205. void InitializeSystem()
  206. {           
  207.     sbi(POWER_EN6_DDR,6);//電源使能-直接EN 輸出
  208.   sbi(POWER_EN6_CR1,6);
  209.   cbi(POWER_EN6_CR2,6);
  210.   
  211.   sbi(POWER_EN5_DDR,5);//電源使能腳PNP  輸出
  212.   sbi(POWER_EN5_CR1,5);
  213.   cbi(POWER_EN5_CR2,5);
  214.   
  215.   POWER_EN6=1;
  216.   POWER_EN5=0;
  217.    
  218.   sbi(LED_DDR,3);//LED控制腳PC3 輸出
  219.   sbi(LED_CR1,3);
  220.   cbi(LED_CR2,3);
  221.   LED_BIT=0;
  222.   
  223.   
  224.   cbi(POWER_KEY_DDR,4);//開機按鍵PD4 輸入
  225.   sbi(POWER_KEY_CR1,4);
  226.   cbi(POWER_KEY_CR2,4);
  227.   
  228.   cbi(ELECTRIC_DDR,4);//市電狀態PC4 輸入
  229.   sbi(ELECTRIC_CR1,4);
  230.   cbi(ELECTRIC_CR2,4);
  231.   
  232.   cbi(SI4463_IRQ_DDR,2);//SI4463中斷腳 輸入
  233.   sbi(SI4463_IRQ_CR1,2);
  234.   cbi(SI4463_IRQ_CR2,2);
  235.   
  236.   #if 0
  237.   LocationID[0]=EEPROM_Write(0x4002,1);
  238.   LocationMac[0]=EEPROM_Write(0x4008,0x66);
  239.   
  240.   #endif
  241.   #if 1
  242.   LocationID[0]=EEPROM_Read(0x4002);
  243.   LocationID[1]=EEPROM_Read(0x4003);
  244.   LocationID[2]=EEPROM_Read(0x4004);
  245.   LocationID[3]=EEPROM_Read(0x4005);
  246.   LocationMac[0]=EEPROM_Read(0x4008);
  247.   LocationMac[1]=EEPROM_Read(0x4009);
  248.   LocationMac[2]=EEPROM_Read(0x400a);
  249.   LocationMac[3]=EEPROM_Read(0x400b);
  250.   RF_PA_POWER_SET[5]=EEPROM_Read(0x400c);//讀取發射功率設 置
  251.   #endif
  252.   
  253.   SI4463_InterFace();
  254.   SI446X_RESET();        //SI446X 模塊復位
  255.   SI446X_CONFIG_INIT();  //SI446X 模塊初始化配置函數
  256.   SI446X_START_RX( 0, 0, PACKET_LENGTH,0,3,3 );
  257. }
  258. /******************************************************************************************************************/
  259. void SI446X_INT_STATUS( INT8U *buffer )
  260. {
  261.     INT8U cmd[4];
  262.     cmd[0] = GET_INT_STATUS;
  263.     cmd[1] = 0;
  264.     cmd[2] = 0;
  265.     cmd[3] = 0;
  266.     SI446X_CMD( cmd, 4 );
  267.     SI446X_READ_RESPONSE( buffer, 9 );
  268. }
  269. /******************************************************************************************************************/
  270. void SI446X_RSSI_INFO( INT8U *buffer )
  271. {
  272.     INT8U cmd = 0X53;//0x53快速訪問寄存器C
  273.     SI446X_WAIT_CTS( );
  274.     SI_CSN_LOW( );//片選腳
  275.   SPI_ExchangeByte( cmd );//傳送一個字節
  276.   *buffer = SPI_ExchangeByte( 0xFF );//讀取一個字節
  277.     SI_CSN_HIGH( );
  278.    
  279. }
  280. /******************************************************************************************************************/
  281. void SI446X_WAIT_CTS( void )
  282. {
  283.     INT8U cts;
  284.     do
  285.     {
  286.         SI_CSN_LOW( );
  287.         SPI_ExchangeByte( READ_CMD_BUFF );
  288.         cts = SPI_ExchangeByte( 0xFF );
  289.         SI_CSN_HIGH( );
  290.     }while( cts != 0xFF );
  291. }
  292. /******************************************************************************************************************/
  293. void SI446X_CMD( INT8U *cmd, INT8U cmdsize )
  294. {
  295.     SI446X_WAIT_CTS( );
  296.     SI_CSN_LOW( );
  297.     while( cmdsize -- )
  298.     {
  299.         SPI_ExchangeByte( *cmd++ );
  300.     }
  301.     SI_CSN_HIGH( );
  302. }
  303. /******************************************************************************************************************/
  304. INT8U SPI_ExchangeByte( INT8U input )
  305. {

  306. u8 data;

  307. while(!(SPI_SR & 0x02));
  308. SPI_DR=input;

  309. while(!(SPI_SR & 0x01));
  310. data=SPI_DR;


  311. return data;

  312. }
  313. /******************************************************************************************************************/     
  314. INT8U SI446X_READ_PACKET( INT8U *buffer )
  315. {
  316.     INT8U length, i;
  317.     SI446X_WAIT_CTS( );
  318.     SI_CSN_LOW( );
  319.     SPI_ExchangeByte( READ_RX_FIFO );
  320. #if PACKET_LENGTH == 0
  321.     length = SPI_ExchangeByte( 0xFF );
  322. #else
  323.     length = PACKET_LENGTH;
  324. #endif
  325.     i = length;
  326.     while( length -- )
  327.     {
  328.         *buffer++ = SPI_ExchangeByte( 0xFF );
  329.     }
  330.     SI_CSN_HIGH( );
  331.     return i;
  332. }
  333. /***********************************************發送一包數據*******************************************************************/     
  334. void SI446X_SEND_PACKET( INT8U *txbuffer, INT8U size, INT8U channel, INT8U condition )
  335. {
  336.     INT8U cmd[5];
  337.     INT8U tx_len = size;
  338.     SI446X_TX_FIFO_RESET( );
  339.     SI_CSN_LOW( );
  340.     SPI_ExchangeByte( WRITE_TX_FIFO );
  341. #if PACKET_LENGTH == 0
  342.     tx_len ++;
  343.     SPI_ExchangeByte( size );
  344. #endif
  345.     while( size -- )    { SPI_ExchangeByte( *txbuffer++ ); }
  346.     SI_CSN_HIGH( );
  347.     cmd[0] = START_TX;
  348.     cmd[1] = channel;
  349.     cmd[2] = condition;
  350.     cmd[3] = 0;
  351.     cmd[4] = tx_len;
  352.     SI446X_CMD( cmd, 5 );
  353.   while((PD_IDR&0x04)==0x04);
  354.   SI_CSN_HIGH();
  355.     cmd[0] = CHANGE_STATE;
  356.     cmd[1] = 0x03;
  357.     SI446X_CMD( cmd, 2 );
  358. }
  359. /********************************************讀中斷寄存器狀態**************************************************/     
  360. void SI446X_INT_STATUS( INT8U *buffer )
  361. {
  362.     INT8U cmd[4];
  363.     cmd[0] = GET_INT_STATUS;
  364.     cmd[1] = 0;
  365.     cmd[2] = 0;
  366.     cmd[3] = 0;
  367.     SI446X_CMD( cmd, 4 );
  368.     SI446X_READ_RESPONSE( buffer, 9 );
  369. }
  370. /******************************************************************************************************************/     
  371. void SI446X_START_RX( INT8U channel, INT8U condition, INT16U rx_len,
  372.                       INT8U n_state1, INT8U n_state2, INT8U n_state3 )
  373. {
  374.     INT8U cmd[8];
  375.     SI446X_RX_FIFO_RESET( );
  376.     SI446X_TX_FIFO_RESET( );
  377.     cmd[0] = START_RX;
  378.     cmd[1] = channel;
  379.     cmd[2] = condition;
  380.     cmd[3] = rx_len>>8;
  381.     cmd[4] = rx_len;
  382.     cmd[5] = n_state1;
  383.     cmd[6] = n_state2;
  384.     cmd[7] = n_state3;
  385.     SI446X_CMD( cmd, 8 );
  386. }
  387. /************************************************清緩存******************************************************************/     
  388. void SI446X_RX_FIFO_RESET( void )
  389. {
  390.     INT8U cmd[2];
  391.     cmd[0] = FIFO_INFO;
  392.     cmd[1] = 0x02;
  393.     SI446X_CMD( cmd, 2 );
  394. }
  395. /*
  396. =================================================================================
  397. */
  398. void SI446X_TX_FIFO_RESET( void )
  399. {
  400.     INT8U cmd[2];
  401.     cmd[0] = FIFO_INFO;
  402.     cmd[1] = 0x01;
  403.     SI446X_CMD( cmd, 2 );
  404. }
  405. /******************************************************************************************************************/      
  406. void SI4463_InterFace(void)
  407. {
  408.     //init io pin
  409.    
  410.   sbi(PA_DDR,3);//SCS OUTPUT
  411.   sbi(PA_CR1,3);
  412.   cbi(PA_CR2,3);
  413.   
  414.   sbi(PC_DDR,5);//SCK OUTPUT
  415.   sbi(PC_CR1,5);
  416.   cbi(PC_CR2,5);
  417.   
  418.   sbi(PC_DDR,6);//MOSI OUTPUT
  419.   sbi(PC_CR1,6);
  420.   cbi(PC_CR2,6);
  421.   
  422.   cbi(PC_DDR,7);//MISO INPUT
  423.   sbi(PC_CR1,7);
  424.   cbi(PC_CR2,7);
  425.   
  426.   sbi(PA_DDR,2);//GIO1 WTR INPUT
  427.   sbi(PA_CR1,2);
  428.   cbi(PA_CR2,2);
  429.   
  430.   cbi(PA_DDR,1);//GIO0 WTR INPUT
  431.   sbi(PA_CR1,1);
  432.   sbi(PA_CR2,1);  
  433.    
  434.   SPI_Init();
  435.   
  436. }
  437. /******************************************************************************************************************/   
  438. void SPI_Init(void)
  439. {

  440. SPI_CR1|=0x04;   //配置為主設備
  441. //SPI_CR2|=0xc0;   //選擇單線雙向數據模式(輸出模式)
  442. SPI_CR2|=0x03;   //配置NSS腳為1

  443. SPI_CR1|=0x40;   //開啟SPI

  444. }
  445. /******************************************************************************************************************/   
  446. void SI446X_CONFIG_INIT( void )
  447. {
  448.     INT8U i;
  449.     INT16U j = 0;
  450.     INT8U abApi_Write[8];
  451.     while( ( i = config_table[j] ) != 0 )
  452.     {
  453.         j += 1;
  454.         SI446X_CMD( config_table + j, i );
  455.         j += i;
  456.     }
  457. //////////////////////////////////////////////////////////////////////////////////
  458.   SI446X_CMD( RF_PA_POWER_SET, 8 );//重新設置發射功率   
  459.   
  460. #if PACKET_LENGTH > 0           //fixed packet length
  461.     SI446X_SET_PROPERTY_1( PKT_FIELD_1_LENGTH_7_0, PACKET_LENGTH );
  462.   SI446X_SET_PROPERTY_1( PKT_FIELD_1_CRC_CONFIG, 0xA2 );
  463.   SI446X_SET_PROPERTY_1( PKT_CRC_CONFIG, 0x05 );
  464.   
  465. #else                           //variable packet length
  466.     SI446X_SET_PROPERTY_1( PKT_CONFIG1, 0x00 );
  467.     SI446X_SET_PROPERTY_1( PKT_CRC_CONFIG, 0x00 );
  468.     SI446X_SET_PROPERTY_1( PKT_LEN_FIELD_SOURCE, 0x01 );
  469.     SI446X_SET_PROPERTY_1( PKT_LEN, 0x2A );
  470.     SI446X_SET_PROPERTY_1( PKT_LEN_ADJUST, 0x00 );
  471.     SI446X_SET_PROPERTY_1( PKT_FIELD_1_LENGTH_12_8, 0x00 );
  472.     SI446X_SET_PROPERTY_1( PKT_FIELD_1_LENGTH_7_0, 0x01 );
  473.     SI446X_SET_PROPERTY_1( PKT_FIELD_1_CONFIG, 0x00 );
  474.     SI446X_SET_PROPERTY_1( PKT_FIELD_1_CRC_CONFIG, 0x00 );
  475.     SI446X_SET_PROPERTY_1( PKT_FIELD_2_LENGTH_12_8, 0x00 );
  476.     SI446X_SET_PROPERTY_1( PKT_FIELD_2_LENGTH_7_0, 0x10 );
  477.     SI446X_SET_PROPERTY_1( PKT_FIELD_2_CONFIG, 0x00 );
  478.     SI446X_SET_PROPERTY_1( PKT_FIELD_2_CRC_CONFIG, 0x00 );
  479. #endif //PACKET_LENGTH
  480.   
  481.     //重要: 4463的GDO2,GDO3控制射頻開關,  0X20 ,0X21
  482.     //發射時必須: GDO2=1,GDO3=0
  483.     //接收時必須: GDO2=0,GDO3=1
  484.     SI446X_GPIO_CONFIG( 0, 0, 0x20, 0x21, 0, 0, 0 );//重要
  485. }
  486. /******************************************************************************************************************/   
  487. void SI446X_SET_PROPERTY_1( SI446X_PROPERTY GROUP_NUM, INT8U proirity )
  488. {
  489.     INT8U cmd[5];
  490.     cmd[0] = SET_PROPERTY;
  491.     cmd[1] = GROUP_NUM>>8;
  492.     cmd[2] = 1;
  493.     cmd[3] = GROUP_NUM;
  494.     cmd[4] = proirity;
  495.     SI446X_CMD( cmd, 5 );
  496. }
  497. /******************************************************************************************************************/   
  498. void SI446X_GPIO_CONFIG( INT8U G0, INT8U G1, INT8U G2, INT8U G3,
  499.                          INT8U IRQ, INT8U SDO, INT8U GEN_CONFIG )
  500. {
  501.     INT8U cmd[10];
  502.     cmd[0] = GPIO_PIN_CFG;
  503.     cmd[1] = G0;
  504.     cmd[2] = G1;
  505.     cmd[3] = G2;
  506.     cmd[4] = G3;
  507.     cmd[5] = IRQ;
  508.     cmd[6] = SDO;
  509.     cmd[7] = GEN_CONFIG;
  510.     SI446X_CMD( cmd, 8 );
  511.     SI446X_READ_RESPONSE( cmd, 8 );
  512. }
  513. /******************************************************************************************************************/   
  514. void SI446X_READ_RESPONSE( INT8U *buffer, INT8U size )
  515. {
  516.     SI446X_WAIT_CTS( );
  517.     SI_CSN_LOW( );
  518.   SPI_ExchangeByte( READ_CMD_BUFF );//0X44
  519.   while( size -- )
  520.     {
  521.         *buffer++ = SPI_ExchangeByte( 0xFF );
  522.     }
  523.     SI_CSN_HIGH( );
  524. }
  525. /******************************************************************************************************************/   
  526. 寄存器相關定義和命令宏
  527. /******************************************************************************************************************/   
  528. #ifndef _SI446X_DEFS_H_
  529. #define _SI446X_DEFS_H_
  530. //  commands for SI446x
  531. typedef enum
  532. {
  533.     /*BOOT COMMANDS-------------------------------------*/
  534.     POWER_UP                = 0x02, // Power up
  535.     /*COMMON COMMANDS-----------------------------------*/
  536.     NOP                     = 0x00, //No operation command.
  537.     PART_INFO               = 0x01, //Reports basic information about the device.
  538.     FUNC_INFO               = 0x10, //Returns the Function revision information of the device.
  539.     GET_INT_STATUS          = 0x20, //Returns the interrupt status of ALL the possible interrupt events
  540.                                     //(both STATUS and PENDING). Optionally, it may be used to
  541.                                     //clear latched (PENDING) interrupt events.
  542.     SET_PROPERTY            = 0x11, //Sets the value of a property.
  543.     GET_PROPERTY            = 0x12, //Retrieve a property's value.
  544.     FIFO_INFO               = 0x15, //Provides access to transmit and receive FIFO counts and reset.
  545.     GPIO_PIN_CFG            = 0x13, //Configures the gpio pins.
  546.     CHANGE_STATE            = 0x34, //Update state machine entries.
  547.     REQUEST_DEVICE_STATE    = 0x33, //Request current device state.
  548.     READ_CMD_BUFF           = 0x44, //Used to read CTS and the command response.
  549.     FRR_A_READ              = 0x50, //Reads the fast response registers starting with A.
  550.     FRR_B_READ              = 0x51, //Reads the fast response registers starting with B.
  551.     FRR_C_READ              = 0x53, //Reads the fast response registers starting with C.
  552.     FRR_D_READ              = 0x57, //Reads the fast response registers starting with D.
  553.     /*IR_CAL_COMMANDS----------------------------------*/
  554.     IRCAL                   = 0x17, //Image rejection calibration.
  555.     /*TX_COMMANDS--------------------------------------*/
  556.     START_TX                = 0x31, //Switches to TX state and starts packet transmission.
  557.     WRITE_TX_FIFO           = 0x66, //Writes the TX FIFO.
  558.     /*RX_COMMANDS--------------------------------------*/
  559.     GET_MODEM_STATUS        = 0x22, //Returns the interrupt status of the Modem Interrupt Group
  560.                                     //(both STATUS and PENDING). Optionally, it may be used
  561.                                     //to clear latched (PENDING) interrupt events.
  562.     PACKET_INFO             = 0x16, //Returns information about the last packet received and
  563.                                     //optionally overrides field length.
  564.     START_RX                = 0x32, //Switches to RX state. Command arguments are retained though
  565.                                     //sleep state, so these only need to be written when they change.
  566.     RX_HOP                  = 0x36, //Hop to a new frequency while in RX.
  567.     READ_RX_FIFO            = 0x77, //READ_RX_FIFO
  568.     /*ADVANCED_COMMANDS-------------------------------*/
  569.     GET_PH_STATUS           = 0x21, //Returns the interrupt status of the Packet Handler Interrupt
  570.                                     //Group (both STATUS and PENDING). Optionally, it may be used
  571.                                     //to clear latched (PENDING) interrupt events.
  572.     GET_CHIP_STATUS         = 0x23, //Returns the interrupt status of the Chip Interrupt Group
  573.                                     //(both STATUS and PENDING). Optionally, it may be used to
  574.                                     //clear latched (PENDING) interrupt events.
  575.     PROTOCOL_CFG            = 0x18, //Sets the chip up for specified protocol.
  576.     GET_ADC_READING         = 0x14  //Performs and retrieve the results of possible ADC conversions.
  577. }SI446X_CMD_X;

  578. //  priority for SI446x
  579. typedef enum
  580. {
  581.     GLOBAL_XO_TUNE          = 0x0000,
  582.     GLOBAL_CLK_CFG          = 0x0001,
  583.     GLOBAL_LOW_BATT_THRESH  = 0x0001,
  584.     GLOBAL_CONFIG           = 0x0003,
  585.     GLOBAL_WUT_CONFIG       = 0x0004,
  586.     GLOBAL_WUT_M_15_8       = 0x0005,
  587.     GLOBAL_WUT_M_7_0        = 0x0006,
  588.     GLOBAL_WUT_R            = 0x0007,
  589.     GLOBAL_WUT_LDC          = 0x0008,
  590.     GLOBAL_WUT_CAL          = 0x0009,
  591.     INT_CTL_ENABLE          = 0x0100,
  592.     INT_CTL_PH_ENABLE       = 0x0101,
  593.     INT_CTL_MODEM_ENABLE    = 0x0102,
  594.     INT_CTL_CHIP_ENABLE     = 0x0103,
  595.     FRR_CTL_A_MODE          = 0x0200,
  596.     FRR_CTL_B_MODE          = 0x0201,
  597.     FRR_CTL_C_MODE          = 0x0202,
  598.     FRR_CTL_D_MODE          = 0x0203,
  599.     PREAMBLE_TX_LENGTH      = 0x1000,
  600.     PREAMBLE_CONFIG_STD_1   = 0x1001,
  601.     PREAMBLE_CONFIG_NSTD    = 0x1002,
  602.     PREAMBLE_CONFIG_STD_2   = 0x1003,
  603.     PREAMBLE_CONFIG         = 0x1004,
  604.     PREAMBLE_PATTERN_31_24  = 0x1005,
  605.     PREAMBLE_PATTERN_23_16  = 0x1006,
  606.     PREAMBLE_PATTERN_15_8   = 0x1007,
  607.     PREAMBLE_PATTERN_7_0    = 0x1008,
  608.     PREAMBLE_POSTAMBLE_CONFIG           = 0x1009,
  609.     PREAMBLE_POSTAMBLE_PATTERN_31_24    = 0x100A,
  610.     PREAMBLE_POSTAMBLE_PATTERN_23_16 = 0x100B,
  611.     PREAMBLE_POSTAMBLE_PATTERN_15_8     = 0x100C,
  612.     PREAMBLE_POSTAMBLE_PATTERN_7_0      = 0x100D,
  613.     SYNC_CONFIG             = 0x1100,
  614.     SYNC_BITS_31_24         = 0x1101,
  615.     SYNC_BITS_23_16         = 0x1102,
  616.     SYNC_BITS_15_8          = 0x1103,
  617.     SYNC_BITS_7_0           = 0x1104,
  618.     PKT_CRC_CONFIG          = 0x1200,
  619.     PKT_CONFIG1             = 0x1206,
  620.     PKT_LEN                 = 0x1208,
  621.     PKT_LEN_FIELD_SOURCE    = 0x1209,
  622.     PKT_LEN_ADJUST          = 0x120A,
  623.     PKT_TX_THRESHOLD        = 0x120B,
  624.     PKT_RX_THRESHOLD        = 0x120C,
  625.     PKT_FIELD_1_LENGTH_12_8 = 0x120D,
  626.     PKT_FIELD_1_LENGTH_7_0  = 0x120E,
  627.     PKT_FIELD_1_CONFIG      = 0x120F,
  628.     PKT_FIELD_1_CRC_CONFIG  = 0x1210,
  629.     PKT_FIELD_2_LENGTH_12_8 = 0x1211,
  630.     PKT_FIELD_2_LENGTH_7_0  = 0x1212,
  631.     PKT_FIELD_2_CONFIG      = 0x1213,
  632.     PKT_FIELD_2_CRC_CONFIG  = 0x1214,
  633.     PKT_FIELD_3_LENGTH_12_8 = 0x1215,
  634.     PKT_FIELD_3_LENGTH_7_0  = 0x1216,
  635.     PKT_FIELD_3_CONFIG      = 0x1217,
  636.     PKT_FIELD_3_CRC_CONFIG  = 0x1218,
  637.     PKT_FIELD_4_LENGTH_12_8 = 0x1219,
  638.     PKT_FIELD_4_LENGTH_7_0  = 0x121A,
  639.     PKT_FIELD_4_CONFIG      = 0x121B,
  640.     PKT_FIELD_4_CRC_CONFIG  = 0x121C,
  641.     PKT_FIELD_5_LENGTH_12_8 = 0x121D,
  642.     PKT_FIELD_5_LENGTH_7_0  = 0x121E,
  643.     PKT_FIELD_5_CONFIG      = 0x121F,
  644.     PKT_FIELD_5_CRC_CONFIG  = 0x1220,
  645.     PKT_RX_FIELD_1_LENGTH_12_8  = 0x1221,
  646.     PKT_RX_FIELD_1_LENGTH_7_0   = 0x1222,
  647.     PKT_RX_FIELD_1_CONFIG       = 0x1223,
  648.     PKT_RX_FIELD_1_CRC_CONFIG   = 0x1224,
  649.     PKT_RX_FIELD_2_LENGTH_12_8  = 0x1225,
  650.     PKT_RX_FIELD_2_LENGTH_7_0   = 0x1226,
  651.     PKT_RX_FIELD_2_CONFIG   = 0x1227,
  652.     PKT_RX_FIELD_2_CRC_CONFIG   = 0x1228,
  653.     PKT_RX_FIELD_3_LENGTH_12_8 = 0x1229,
  654.     PKT_RX_FIELD_3_LENGTH_7_0   = 0x122A,
  655.     PKT_RX_FIELD_3_CONFIG       = 0x122B,
  656.     PKT_RX_FIELD_3_CRC_CONFIG   = 0x122C,
  657.     PKT_RX_FIELD_4_LENGTH_12_8 = 0x122D,
  658.     PKT_RX_FIELD_4_LENGTH_7_0   = 0x122E,
  659.     PKT_RX_FIELD_4_CONFIG   = 0x122F,
  660.     PKT_RX_FIELD_4_CRC_CONFIG   = 0x1230,
  661.     PKT_RX_FIELD_5_LENGTH_12_8 = 0x1231,
  662.     PKT_RX_FIELD_5_LENGTH_7_0   = 0x1232,
  663.     PKT_RX_FIELD_5_CONFIG       = 0x1233,
  664.     PKT_RX_FIELD_5_CRC_CONFIG   = 0x1234,
  665.     MODEM_MOD_TYPE          = 0x2000,
  666.     MODEM_MAP_CONTROL       = 0x2001,
  667.     MODEM_DATA_RATE_2       = 0x2003,
  668.     MODEM_DATA_RATE_1       = 0x2004,
  669.     MODEM_DATA_RATE_0       = 0x2005,
  670.     MODEM_TX_NCO_MODE_3     = 0x2006,
  671.     MODEM_TX_NCO_MODE_2     = 0x2007,
  672.     MODEM_TX_NCO_MODE_1     = 0x2008,
  673.     MODEM_TX_NCO_MODE_0     = 0x2009,
  674.     MODEM_FREQ_DEV_2        = 0x200A,
  675.     MODEM_FREQ_DEV_1        = 0x200B,
  676.     MODEM_FREQ_DEV_0        = 0x200C,
  677.     MODEM_FREQ_OFFSET_1     = 0x200D,
  678.     MODEM_FREQ_OFFSET_0     = 0x200E,
  679.     MODEM_TX_FILTER_COEFF_8 = 0x200F,
  680.     MODEM_TX_FILTER_COEFF_7 = 0x2010,
  681.     MODEM_TX_FILTER_COEFF_6 = 0x2011,
  682.     MODEM_TX_FILTER_COEFF_5 = 0x2012,
  683.     MODEM_TX_FILTER_COEFF_4 = 0x2013,
  684.     MODEM_TX_FILTER_COEFF_3 = 0x2014,
  685.     MODEM_TX_FILTER_COEFF_2 = 0x2015,
  686.     MODEM_TX_FILTER_COEFF_1 = 0x2016,
  687.     MODEM_TX_FILTER_COEFF_0 = 0x2017,
  688.     MODEM_TX_RAMP_DELAY     = 0x2018,
  689.     MODEM_MDM_CTRL          = 0x2019,
  690.     MODEM_IF_CONTROL        = 0x201A,
  691.     MODEM_IF_FREQ_2         = 0x201B,
  692.     MODEM_IF_FREQ_1         = 0x201C,
  693.     MODEM_IF_FREQ_0         = 0x201D,
  694.     MODEM_DECIMATION_CFG1   = 0x201E,
  695.     MODEM_DECIMATION_CFG0   = 0x201F,
  696.     MODEM_BCR_OSR_1         = 0x2022,
  697.     MODEM_BCR_OSR_0         = 0x2023,
  698.     MODEM_BCR_NCO_OFFSET_2  = 0x2024,
  699.     MODEM_BCR_NCO_OFFSET_1  = 0x2025,
  700.     MODEM_BCR_NCO_OFFSET_0  = 0x2026,
  701.     MODEM_BCR_GAIN_1        = 0x2027,
  702.     MODEM_BCR_GAIN_0        = 0x2028,
  703.     MODEM_BCR_GEAR          = 0x2029,
  704.     MODEM_BCR_MISC1         = 0x202A,
  705.     MODEM_BCR_MISC0         = 0x202B,
  706.     MODEM_AFC_GEAR          = 0x202C,
  707.     MODEM_AFC_WAIT          = 0x202D,
  708.     MODEM_AFC_GAIN_1        = 0x202E,
  709.     MODEM_AFC_GAIN_0        = 0x202F,
  710.     MODEM_AFC_LIMITER_1     = 0x2030,
  711.     MODEM_AFC_LIMITER_0     = 0x2031,
  712.     MODEM_AFC_MISC          = 0x2032,
  713.     MODEM_AFC_ZIFOFF        = 0x2033,
  714.     MODEM_ADC_CTRL          = 0x2034,
  715.     MODEM_AGC_WINDOW_SIZE   = 0x2038,
  716.     MODEM_AGC_RFPD_DECAY    = 0x2039,
  717.     MODEM_AGC_IFPD_DECAY    = 0x203A,
  718.     MODEM_FSK4_GAIN1        = 0x203B,
  719.     MODEM_FSK4_GAIN0        = 0x203C,
  720.     MODEM_FSK4_TH1          = 0x203D,
  721.     MODEM_FSK4_TH0          = 0x203E,
  722.     MODEM_FSK4_MAP          = 0x203F,
  723.     MODEM_OOK_PDTC          = 0x2040,
  724.     MODEM_OOK_BLOPK         = 0x2041,
  725.     MODEM_OOK_CNT1          = 0x2042,
  726.     MODEM_OOK_MISC          = 0x2043,
  727.     MODEM_RAW_SEARCH        = 0x2044,
  728.     MODEM_RAW_CONTROL       = 0x2045,
  729.     MODEM_RAW_EYE_1         = 0x2046,
  730.     MODEM_RAW_EYE_0         = 0x2047,
  731.     MODEM_ANT_DIV_MODE      = 0x2048,
  732.     MODEM_ANT_DIV_CONTROL   = 0x2049,
  733.     MODEM_RSSI_THRESH       = 0x204A,
  734.     MODEM_RSSI_JUMP_THRESH  = 0x204B,
  735.     MODEM_RSSI_CONTROL      = 0x204C,
  736.     MODEM_RSSI_CONTROL2     = 0x204D,
  737.     MODEM_RSSI_COMP         = 0x204E,
  738.     MODEM_CLKGEN_BAND       = 0x2051,
  739.     MODEM_CHFLT_RX1_CHFLT_COE13_7_0 = 0x2100,
  740.     MODEM_CHFLT_RX1_CHFLT_COE12_7_0 = 0x2101,
  741.     MODEM_CHFLT_RX1_CHFLT_COE11_7_0 = 0x2102,
  742.     MODEM_CHFLT_RX1_CHFLT_COE10_7_0 = 0x2103,
  743.     MODEM_CHFLT_RX1_CHFLT_COE9_7_0  = 0x2104,
  744.     MODEM_CHFLT_RX1_CHFLT_COE8_7_0  = 0x2105,
  745.     MODEM_CHFLT_RX1_CHFLT_COE7_7_0  = 0x2106,
  746.     MODEM_CHFLT_RX1_CHFLT_COE6_7_0  = 0x2107,
  747.     MODEM_CHFLT_RX1_CHFLT_COE5_7_0  = 0x2108,
  748.     MODEM_CHFLT_RX1_CHFLT_COE4_7_0  = 0x2109,
  749.     MODEM_CHFLT_RX1_CHFLT_COE3_7_0 = 0x210A,
  750.     MODEM_CHFLT_RX1_CHFLT_COE2_7_0  = 0x210B,
  751.     MODEM_CHFLT_RX1_CHFLT_COE1_7_0  = 0x210C,
  752.     MODEM_CHFLT_RX1_CHFLT_COE0_7_0 = 0x210D,
  753.     MODEM_CHFLT_RX1_CHFLT_COEM0     = 0x210E,
  754.     MODEM_CHFLT_RX1_CHFLT_COEM1     = 0x210F,
  755.     MODEM_CHFLT_RX1_CHFLT_COEM2     = 0x2110,
  756.     MODEM_CHFLT_RX1_CHFLT_COEM3     = 0x2111,
  757.     MODEM_CHFLT_RX2_CHFLT_COE13_7_0 = 0x2112,
  758.     MODEM_CHFLT_RX2_CHFLT_COE12_7_0 = 0x2113,
  759.     MODEM_CHFLT_RX2_CHFLT_COE11_7_0 = 0x2114,
  760.     MODEM_CHFLT_RX2_CHFLT_COE10_7_0 = 0x2115,
  761.     MODEM_CHFLT_RX2_CHFLT_COE9_7_0  = 0x2116,
  762.     MODEM_CHFLT_RX2_CHFLT_COE8_7_0  = 0x2117,
  763.     MODEM_CHFLT_RX2_CHFLT_COE7_7_0  = 0x2118,
  764.     MODEM_CHFLT_RX2_CHFLT_COE6_7_0  = 0x2119,
  765.     MODEM_CHFLT_RX2_CHFLT_COE5_7_0  = 0x211A,
  766.     MODEM_CHFLT_RX2_CHFLT_COE4_7_0  = 0x211B,
  767.     MODEM_CHFLT_RX2_CHFLT_COE3_7_0  = 0x211C,
  768.     MODEM_CHFLT_RX2_CHFLT_COE2_7_0  = 0x211D,
  769.     MODEM_CHFLT_RX2_CHFLT_COE1_7_0 = 0x211E,
  770.     MODEM_CHFLT_RX2_CHFLT_COE0_7_0  = 0x211F,
  771.     MODEM_CHFLT_RX2_CHFLT_COEM0     = 0x2120,
  772.     MODEM_CHFLT_RX2_CHFLT_COEM1     = 0x2121,
  773.     MODEM_CHFLT_RX2_CHFLT_COEM2     = 0x2122,
  774.     MODEM_CHFLT_RX2_CHFLT_COEM3     = 0x2123,
  775.     PA_MODE                 = 0x2200,
  776.     PA_PWR_LVL              = 0x2201,
  777.     PA_BIAS_CLKDUTY         = 0x2202,
  778.     PA_TC                   = 0x2203,
  779.     PA_RAMP_EX              = 0x2204,
  780.     PA_RAMP_DOWN_DELAY      = 0x2205,
  781.     SYNTH_PFDCP_CPFF        = 0x2300,
  782.     SYNTH_PFDCP_CPINT       = 0x2301,
  783.     SYNTH_VCO_KV            = 0x2302,
  784.     SYNTH_LPFILT3           = 0x2303,
  785.     SYNTH_LPFILT2           = 0x2304,
  786.     SYNTH_LPFILT1           = 0x2305,
  787.     SYNTH_LPFILT0           = 0x2306,
  788.     SYNTH_VCO_KVCAL         = 0x2307,
  789.     MATCH_VALUE_1           = 0x3000,
  790.     MATCH_MASK_1            = 0x3001,
  791.     MATCH_CTRL_1            = 0x3002,
  792.     MATCH_VALUE_2           = 0x3003,
  793.     MATCH_MASK_2            = 0x3004,
  794.     MATCH_CTRL_2            = 0x3005,
  795.     MATCH_VALUE_3           = 0x3006,
  796.     MATCH_MASK_3            = 0x3007,
  797.     MATCH_CTRL_3            = 0x3008,
  798.     MATCH_VALUE_4           = 0x3009,
  799.     MATCH_MASK_4            = 0x300A,
  800.     MATCH_CTRL_4            = 0x300B,
  801.     FREQ_CONTROL_INTE       = 0x4000,
  802.     FREQ_CONTROL_FRAC_2     = 0x4001,
  803.     FREQ_CONTROL_FRAC_1     = 0x4002,
  804.     FREQ_CONTROL_FRAC_0     = 0x4003,
  805.     FREQ_CONTROL_CHANNEL_STEP_SIZE_1    = 0x4004,
  806.     FREQ_CONTROL_CHANNEL_STEP_SIZE_0 = 0x4005,
  807.     FREQ_CONTROL_W_SIZE     = 0x4006,
  808.     FREQ_CONTROL_VCOCNT_RX_ADJ          = 0x4007,
  809.     RX_HOP_CONTROL          = 0x5000,
  810.     RX_HOP_TABLE_SIZE       = 0x5001,
  811.     RX_HOP_TABLE_ENTRY_0    = 0x5002,
  812.     RX_HOP_TABLE_ENTRY_1    = 0x5003,
  813.     RX_HOP_TABLE_ENTRY_2    = 0x5004,
  814.     RX_HOP_TABLE_ENTRY_3    = 0x5005,
  815.     RX_HOP_TABLE_ENTRY_4    = 0x5006,
  816.     RX_HOP_TABLE_ENTRY_5    = 0x5007,
  817.     RX_HOP_TABLE_ENTRY_6    = 0x5008,
  818.     RX_HOP_TABLE_ENTRY_7    = 0x5009,
  819.     RX_HOP_TABLE_ENTRY_8    = 0x500A,
  820.     RX_HOP_TABLE_ENTRY_9    = 0x500B,
  821.     RX_HOP_TABLE_ENTRY_10   = 0x500C,
  822.     RX_HOP_TABLE_ENTRY_11   = 0x500D,
  823.     RX_HOP_TABLE_ENTRY_12   = 0x500E,
  824.     RX_HOP_TABLE_ENTRY_13   = 0x500F,
  825.     RX_HOP_TABLE_ENTRY_14   = 0x5010,
  826.     RX_HOP_TABLE_ENTRY_15   = 0x5011,
  827.     RX_HOP_TABLE_ENTRY_16   = 0x5012,
  828.     RX_HOP_TABLE_ENTRY_17   = 0x5013,
  829.     RX_HOP_TABLE_ENTRY_18   = 0x5014,
  830.     RX_HOP_TABLE_ENTRY_19   = 0x5015,
  831.     RX_HOP_TABLE_ENTRY_20   = 0x5016,
  832.     RX_HOP_TABLE_ENTRY_21   = 0x5017,
  833.     RX_HOP_TABLE_ENTRY_22   = 0x5018,
  834.     RX_HOP_TABLE_ENTRY_23   = 0x5019,
  835.     RX_HOP_TABLE_ENTRY_24   = 0x501A,
  836.     RX_HOP_TABLE_ENTRY_25   = 0x501B,
  837.     RX_HOP_TABLE_ENTRY_26   = 0x501C,
  838.     RX_HOP_TABLE_ENTRY_27   = 0x501D,
  839.     RX_HOP_TABLE_ENTRY_28   = 0x501E,
  840.     RX_HOP_TABLE_ENTRY_29   = 0x501F,
  841.     RX_HOP_TABLE_ENTRY_30   = 0x5020,
  842.     RX_HOP_TABLE_ENTRY_31   = 0x5021,
  843.     RX_HOP_TABLE_ENTRY_32   = 0x5022,
  844.     RX_HOP_TABLE_ENTRY_33   = 0x5023,
  845.     RX_HOP_TABLE_ENTRY_34   = 0x5024,
  846.     RX_HOP_TABLE_ENTRY_35   = 0x5025,
  847.     RX_HOP_TABLE_ENTRY_36   = 0x5026,
  848.     RX_HOP_TABLE_ENTRY_37   = 0x5027,
  849.     RX_HOP_TABLE_ENTRY_38   = 0x5028,
  850.     RX_HOP_TABLE_ENTRY_39   = 0x5029,
  851.     RX_HOP_TABLE_ENTRY_40   = 0x502A,
  852.     RX_HOP_TABLE_ENTRY_41   = 0x502B,
  853.     RX_HOP_TABLE_ENTRY_42   = 0x502C,
  854.     RX_HOP_TABLE_ENTRY_43   = 0x502D,
  855.     RX_HOP_TABLE_ENTRY_44   = 0x502E,
  856.     RX_HOP_TABLE_ENTRY_45   = 0x502F,
  857.     RX_HOP_TABLE_ENTRY_46   = 0x5030,
  858.     RX_HOP_TABLE_ENTRY_47   = 0x5031,
  859.     RX_HOP_TABLE_ENTRY_48   = 0x5032,
  860.     RX_HOP_TABLE_ENTRY_49   = 0x5033,
  861.     RX_HOP_TABLE_ENTRY_50   = 0x5034,
  862.     RX_HOP_TABLE_ENTRY_51   = 0x5035,
  863.     RX_HOP_TABLE_ENTRY_52   = 0x5036,
  864.     RX_HOP_TABLE_ENTRY_53   = 0x5037,
  865.     RX_HOP_TABLE_ENTRY_54   = 0x5038,
  866.     RX_HOP_TABLE_ENTRY_55   = 0x5039,
  867.     RX_HOP_TABLE_ENTRY_56   = 0x503A,
  868.     RX_HOP_TABLE_ENTRY_57   = 0x503B,
  869.     RX_HOP_TABLE_ENTRY_58   = 0x503C,
  870.     RX_HOP_TABLE_ENTRY_59   = 0x503D,
  871.     RX_HOP_TABLE_ENTRY_60   = 0x503E,
  872.     RX_HOP_TABLE_ENTRY_61   = 0x503F,
  873.     RX_HOP_TABLE_ENTRY_62   = 0x5040,
  874.     RX_HOP_TABLE_ENTRY_63   = 0x5041
  875. }SI446X_PROPERTY;
  876. #endif //_SI446X_DEFS_H_
  877. /*
  878. =================================================================================
  879. ------------------------------------End of FILE----------------------------------
  880. =================================================================================
  881. */
復制代碼


分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏1 分享淘帖 頂 踩
回復

使用道具 舉報

沙發
ID:71477 發表于 2015-1-1 20:10 | 只看該作者
  1. /****************************************************************************************************************************/
  2. /*! @file radio_config.h
  3. * @brief This file contains the automatically generated
  4. * configurations.
  5. *
  6. * @n WDS GUI Version: 3.2.2.0
  7. * @n Device: Si4463 Rev.: B1                                
  8. *
  9. * @b COPYRIGHT
  10. * @n Silicon Laboratories Confidential
  11. * @n Copyright 2013 Silicon Laboratories, Inc.
  12. */
  13. #ifndef RADIO_CONFIG_H_
  14. #define RADIO_CONFIG_H_
  15. // USER DEFINED PARAMETERS
  16. // Define your own parameters here
  17. // INPUT DATA
  18. /*
  19. //%% Crys_freq(Hz) Crys_tol(ppm) IF_mode High_perf_Ch_Fil OSRtune Ch_Fil_Bw_AFC ANT_DIV PM_pattern
  20. //  30000000 10 2 1 0 1 0 0
  21. //%% MOD_type Rsymb(sps) Fdev(Hz) RXBW(Hz) Mancheste AFC_en Rsymb_error Chip-Version
  22. //  3 10000 20000 150000 0 1 0.0 2
  23. //%% RF Freq.(MHz) API_TC fhst inputBW BERT RAW_dout D_source Hi_pfm_div
  24. //  433 29 250000 0 0 0 0 1
  25. //
  26. // # WB filter 2 (BW =  68.71 kHz);  NB-filter 4 (BW = 55.09 kHz)
  27. //
  28. // Modulation index: 4
  29. */

  30. // CONFIGURATION PARAMETERS
  31. #define RADIO_CONFIGURATION_DATA_RADIO_XO_FREQ                     {30000000L}
  32. #define RADIO_CONFIGURATION_DATA_CHANNEL_NUMBER                    {0x00}
  33. #define RADIO_CONFIGURATION_DATA_RADIO_PACKET_LENGTH               {0x07}
  34. #define RADIO_CONFIGURATION_DATA_RADIO_STATE_AFTER_POWER_UP        {0x03}
  35. #define RADIO_CONFIGURATION_DATA_RADIO_DELAY_CNT_AFTER_RESET       {0xF000}
  36. #define RADIO_CONFIGURATION_DATA_CUSTOM_PAYLOAD        {0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5}

  37. // CONFIGURATION COMMANDS
  38. /*
  39. // Command:                  RF_POWER_UP
  40. // Description:              Power-up the device with the specified function. Power-up is complete when the CTS bit is set. This command may take longer to set the CTS bit than other commands.
  41. */
  42. #define RF_POWER_UP 0x02, 0x01, 0x00, 0x01, 0xC9, 0xC3, 0x80
  43. /*
  44. // Command:                  RF_GPIO_PIN_CFG
  45. // Description:              Configures the gpio pins.
  46. */
  47. #define RF_GPIO_PIN_CFG 0x13, 0x00, 0x00, 0x20, 0x21, 0x00, 0x00
  48. /*
  49. // Set properties:           RF_GLOBAL_XO_TUNE_1
  50. // Number of properties:     1
  51. // Group ID:                 00
  52. // Start ID:                 00
  53. // Default values:           0x40,
  54. // Descriptions:
  55. //   GLOBAL_XO_TUNE - Crystal oscillator frequency tuning value. 0x00 is maximum frequency value and 0x7F is lowest frequency value. Each LSB code corresponds to a 70 fF capacitance change. The total adjustment range assuming a 30 MHz XTAL is +/-100 ppm.
  56. */
  57. #define RF_GLOBAL_XO_TUNE_1 0x11, 0x00, 0x01, 0x00, 0x52
  58. /*
  59. // Set properties:           RF_GLOBAL_CONFIG_1
  60. // Number of properties:     1
  61. // Group ID:                 00
  62. // Start ID:                 03
  63. // Default values:           0x20,
  64. // Descriptions:
  65. //   GLOBAL_CONFIG - Various settings that affect entire chip. If PROTOCOL is specified, the chip is placed into protocol aware state.
  66. */
  67. #define RF_GLOBAL_CONFIG_1 0x11, 0x00, 0x01, 0x03, 0x40
  68. /*
  69. // Set properties:           RF_INT_CTL_ENABLE_2
  70. // Number of properties:     2
  71. // Group ID:                 01
  72. // Start ID:                 00
  73. // Default values:           0x04, 0x00,
  74. // Descriptions:
  75. //   INT_CTL_ENABLE - Enables top-level interrupt sources to generate HW interrupts at the NIRQ pin. The three interrupt groups are Chip, Modem and Packet Handler. Each of them contains multiple possible interrupt sources that must be individually enabled via the INT_CTL_PH_ENABLE, INT_CTL_MODEM_ENABLE, INT_CTL_CHIP_ENABLE properties. Note that this property only provides for global enabling/disabling of the HW interrupt indication on the NIRQ output pin. An internal interrupt event may still be generated even if the indication on the NIRQ output pin is disabled. The interrupt event may always be monitored by polling a GPIO pin, or via GET_INT_STATUS, GET_CHIP_STATUS, GET_PH_STATUS, or GET_MODEM_STATUS commands.
  76. //   INT_CTL_PH_ENABLE - Enable individual interrupt sources within the Packet Handler Interrupt Group in order to generate a HW interrupt at the NIRQ output pin. In order to fully enable a HW interrupt, it is necessary to enable both the individual interrupt source (within this property) as well as the corresponding interrupt group (e.g., set INT_CTL_ENABLE:PH_INT_STATUS_EN). Note that even if an interrupt source is not enabled to generate a HW NIRQ interrupt, the given interrupt event still may occur inside the chip and may be monitored by polling a GPIO pin, or via the GET_INT_STATUS or GET_PH_STATUS commands.
  77. */
  78. #define RF_INT_CTL_ENABLE_2 0x11, 0x01, 0x04, 0x00, 0x01, 0x38,0x00,0x00  //第一個字節代表屬性配置入口,第2個字節代表組ID 0X0100就是1組,第3個字節代表要配置的寄存器個數
  79.                                 //第4個字節代表起始寄存器的地址,后面依次是要寫入寄存器的值
  80. /*
  81. // Set properties:           RF_FRR_CTL_A_MODE_4
  82. // Number of properties:     4
  83. // Group ID:                 02
  84. // Start ID:                 00
  85. // Default values:           0x01, 0x02, 0x09, 0x00,
  86. // Descriptions:
  87. //   FRR_CTL_A_MODE - Set the data that is present in fast response register A.
  88. //   FRR_CTL_B_MODE - Set the data that is present in fast response register B.
  89. //   FRR_CTL_C_MODE - Set the data that is present in fast response register C.
  90. //   FRR_CTL_D_MODE - Set the data that is present in fast response register D.
  91. */
  92. //#define RF_FRR_CTL_A_MODE_4 0x11, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 //快速響應寄存器配置,4個都禁用
  93. #define RF_FRR_CTL_A_MODE_4 0x11, 0x02, 0x04, 0x00, 0x04, 0x06, 0x0a, 0x00 //快速響應寄存器配置,A包處理程序中斷掛起,MODEM 1T Pending,Latched RSSI
  94. /*
  95. // Set properties:           RF_PREAMBLE_TX_LENGTH_9
  96. // Number of properties:     9
  97. // Group ID:                 10
  98. // Start ID:                 00
  99. // Default values:           0x08, 0x14, 0x00, 0x0F, 0x21, 0x00, 0x00, 0x00, 0x00,
  100. // Descriptions:
  101. //   PREAMBLE_TX_LENGTH - This property is used to configure the length of the Preamble field in TX mode for both Standard and Non-Standard Preambles. This property is not used by the chip in RX mode except when receiving a Non-Standard Preamble. In such a case, this property must be configured with the expected Preamble length (to provide an upper timeout limit on the Sync Word search algorithm). This property is only applicable in TX Packet Handler FIFO mode; if TX Direct Synchronous or TX Direct Asynchronous mode is selected (see MODEM_MOD_TYPE property), the entire transmission is obtained from a real-time TXDATA input stream on a GPIO pin and no automatic field construction is possible. The units of this property are in either nibbles or bytes, depending upon the value of PREAMBLE_CONFIG:LENGTH_CONFIG. Setting PREAMBLE_TX_LENGTH = 0x00 is a valid value, and will result in skipping transmission of the Preamble field; in such a case, the Sync Word will be the first transmitted field.
  102. //   PREAMBLE_CONFIG_STD_1 - The fields in this property are applicable only in RX mode, and apply primarily to reception of Standard Preamble patterns (e.g., 1010 or 0101 patterns). However, see note on required configuration of RX_THRESH during reception of Non-Standard Preamble patterns.
  103. //   PREAMBLE_CONFIG_NSTD - The fields in this property apply only to transmission and reception of packets with Non-Standard Preamble patterns (e.g., other than 1010 or 0101 patterns).
  104. //   PREAMBLE_CONFIG_STD_2 - During initial reception and acquisition of a packet, it is often useful to define a timeout period to limit the amount of time the chip remains on-channel awaiting the incoming packet. This property allows configuration of this preamble search timeout period. If a valid preamble is not found within the specified timeout period, an INVALID_PREAMBLE event is generated and may be used to generate an interrupt and/or exit automatically from RX mode. The fields in this property are applicable only in RX mode, and only apply to reception of Standard Preamble patterns (e.g., 1010 or 0101 patterns). Detection of INVALID_PREAMBLE is not possible when configured to receive a Non-Standard Preamble pattern. Two different timeout configuration fields are provided to allow definition of timeout periods with significantly different lengths and bit resolution.
  105. //   PREAMBLE_CONFIG - Miscellaneous preamble configuration bits.
  106. //   PREAMBLE_PATTERN_31_24 - The PREAMBLE_PATTERN_XX properties define the pattern to be transmitted in TX mode and the pattern expected to be received in RX mode, but only when PREAMBLE_CONFIG:STANDARD_PREAM has been set to 0x0 (i.e., use Non-Standard Preamble). The PREAMBLE_PATTERN_XX properties are used to define the actual bit values describing the Non-Standard Preamble pattern; PREAMBLE_CONFIG_NSTD:PATTERN_LENGTH is used to define how many bits of the PREAMBLE_PATTERN_XX values are used. In TX mode, if the value of PREAMBLE_TX_LENGTH is larger than PREAMBLE_CONFIG_NSTD:PATTERN_LENGTH, the PREAMBLE_PATTERN will be transmitted repeatedly until the full number of bits has been sent. In RX mode, the full number of bits defined by PREAMBLE_CONFIG_NSTD:PATTERN_LENGTH must be received once before the PREAMBLE_VALID signal/interrupt is generated. If Manchester encoding/decoding is enabled, the values of the PREAMBLE_PATTERN_XX properties are expressed in chips (i.e., after Manchester encoding in TX mode, or before Manchester decoding in RX mode). The bits of the PREAMBLE_PATTERN_XX are always sent bits 0-31 time-wise (e.g., PREAMBLE_PATTERN_7_0 bit 0 is sent first).
  107. //   PREAMBLE_PATTERN_23_16 - Bits 23-16 of the Non-Standard Preamble pattern to be transmitted or expected to be received. Please refer to the text description for PREAMBLE_PATTERN_31_24 for more details regarding the Non-Standard Preamble functionality.
  108. //   PREAMBLE_PATTERN_15_8 - Bits 15-8 of the Non-Standard Preamble pattern to be transmitted or expected to be received. Please refer to the text description for PREAMBLE_PATTERN_31_24 for more details regarding the Non-Standard Preamble functionality.
  109. //   PREAMBLE_PATTERN_7_0 - Bits 7-0 of the Non-Standard Preamble pattern to be transmitted or expected to be received. Please refer to the text description for PREAMBLE_PATTERN_31_24 for more details regarding the Non-Standard Preamble functionality.
  110. */
  111. #define RF_PREAMBLE_TX_LENGTH_9 0x11, 0x10, 0x09, 0x00, 0x0A, 0x14, 0x00, 0x10, 0x31, 0x00, 0x00, 0x00, 0x00  //前同步碼配置
  112. /*
  113. // Set properties:           RF_SYNC_CONFIG_5
  114. // Number of properties:     5
  115. // Group ID:                 11
  116. // Start ID:                 00
  117. // Default values:           0x01, 0x2D, 0xD4, 0x2D, 0xD4,
  118. // Descriptions:
  119. //   SYNC_CONFIG - Configuration of miscellaneous Sync Word bits. NOTE: each byte of the Sync Word is transmitted/received in little-endian fashion (i.e., least significant bit first). Byte(s) of the Sync Word are transmitted/received in descending order (i.e., Byte 3 first, followed by Byte 2, etc.)
  120. //   SYNC_BITS_31_24 - Define the value of Byte 3 of the Sync Word for both TX and RX operation. NOTE: Although the Sync Word byte(s) are transmitted/received in descending order (i.e., Byte 3 first, followed by Byte 2, etc.), each byte is transmitted/received in little-endian fashion (i.e., least significant bit first).
  121. //   SYNC_BITS_23_16 - Sync bytes are always sent bit 0 first.
  122. //   SYNC_BITS_15_8 - Sync bytes are always sent bit 0 first.
  123. //   SYNC_BITS_7_0 - Sync bytes are always sent bit 0 first.
  124. */
  125. //同步字配置,0x1100,0x1101,0x1102,0x1103,0x1104 5個寄存器  同步字使用2和3,共2個字節,同步字3為0XB4,同步字2為0X2B,同步字1為0x00,同步字0為0X00
  126. #define RF_SYNC_CONFIG_5 0x11, 0x11, 0x05, 0x00, 0x01, 0xB4, 0x2B, 0x00, 0x00  //第一個字節代表屬性配置入口,第2個字節代表組ID 0X0100就是1組,第3個字節代表要配置的寄存器個數
  127.                                 //第4個字節代表起始寄存器的地址,后面依次是要寫入寄存器的值
  128. /*
  129. // Set properties:           RF_PKT_CRC_CONFIG_1
  130. // Number of properties:     1
  131. // Group ID:                 12
  132. // Start ID:                 00
  133. // Default values:           0x00,
  134. // Descriptions:
  135. //   PKT_CRC_CONFIG - The chip contains a 32-bit CRC engine for the purpose of generating and comparing a checksum across selected data fields. This property is used to select the desired CRC polynomial and CRC seed value. If a 8-bit CRC polynomial is selected, the length of the resulting checksum is 1-bytes. If a 16-bit CRC polynomial is selected, the length of the resulting checksum is 2-bytes. If a 32-bit CRC polynomial is selected, the length of the resulting checksum is 4-bytes. The configuration bits in this property are common to both TX and RX modes; however, this property is only applicable when automatic Packet Handling is enabled (e.g., when using the TX FIFO as the modulation source in TX mode, or when PKT_CONFIG1:PH_RX_DISABLE is cleared in RX mode).
  136. */
  137. #define RF_PKT_CRC_CONFIG_1 0x11, 0x12, 0x01, 0x00, 0x84  //CRC校驗設置,使用1s作為CRC種子,CRC16(IBM)校驗方式
  138. /*
  139. // Set properties:           RF_PKT_CONFIG1_1
  140. // Number of properties:     1
  141. // Group ID:                 12
  142. // Start ID:                 06
  143. // Default values:           0x00,
  144. // Descriptions:
  145. //   PKT_CONFIG1 - General packet configuration bits.
  146. */
  147. #define RF_PKT_CONFIG1_1 0x11, 0x12, 0x01, 0x06, 0x12  //通 用包配置 ,數據包接收完后離開接收通道,CRC高字節先傳送 0X1206寄存器
  148. /*
  149. // Set properties:           RF_PKT_LEN_3
  150. // Number of properties:     3
  151. // Group ID:                 12
  152. // Start ID:                 08
  153. // Default values:           0x00, 0x00, 0x00,
  154. // Descriptions:
  155. //   PKT_LEN - This property configures the chip for reception of a variable length packet. This property is applicable only in RX mode, and only when the automatic Packet Handler is enabled (i.e., PKT_CONFIG1:PH_RX_DISABLE is cleared). If enabled, the extracted length can be retrieved using the PACKET_INFO command.
  156. //   PKT_LEN_FIELD_SOURCE - This property configures the chip for reception of a variable length packet, and defines where the length field is in the packet. The packet length byte(s) must be the last byte(s) in a fixed length field and must precede the variable length field. This property is applicable only in RX mode, and only when the automatic Packet Handler is enabled (i.e., the PH_RX_DISABLE bit in the PKT_CONFIG1 property is cleared).
  157. //   PKT_LEN_ADJUST - It is possible to define the total length of a packet in a variety of ways (e.g., including/excluding the packet length bytes, including/excluding the CRC bytes, etc.) This property provides a means of adjusting/offsetting the received packet length value in order to comply with a wide range of packet length implementations. This property is applicable only in RX mode, and only when the automatic Packet Handler is enabled (i.e., the PH_RX_DISABLE bit in the PKT_CONFIG1 property is cleared). The value of the LEN_ADJUST field is added to the received value of the packet length byte(s), extracted from the field specified by the SRC_FIELD value in the PKT_LEN_FIELD_SOURCE property. The resulting value is then used to configure the length of the variable length field specified by PKT_LEN:DST_FIELD. The required constant value of the LEN_ADJUST field is typically defined in a protocol specification or regulatory standard, or can be derived from the specification. The default processing mode of the chip is that the received packet length value does NOT include the packet length bytes, and does NOT include CRC bytes. In such a case, the LEN_ADJUST field should be set to 0x00. If the received packet length value includes the packet length bytes and/or the CRC bytes, its effective value must be reduced by adding a negative offset. In such a case, the LEN_ADJUST field should be set to the negative value of the extra byte count (in 2's complement format). Example: the transmitted packet has a 2-byte packet length field followed by a 10-byte Payload field, and the value contained in the packet length bytes = 0x000C = 12 bytes. The value of LEN_ADJUST should be set = 0xFE = -2. The LEN_ADJUST field is a signed value.
  158. */
  159. #define RF_PKT_LEN_3 0x11, 0x12, 0x03, 0x08, 0x00, 0x00, 0x00  //包長度設置,長度字段至少一個字節,設置為1個有效字節,
  160. /*
  161. // Set properties:           RF_PKT_FIELD_1_LENGTH_12_8_12
  162. // Number of properties:     12
  163. // Group ID:                 12
  164. // Start ID:                 0D
  165. // Default values:           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  166. // Descriptions:
  167. //   PKT_FIELD_1_LENGTH_12_8 - The PKT_FIELD_1_LENGTH_XX properties specify the length of Field 1 in bytes. The field length is an unsigned 13-bit value; this property is Byte 1 of the length value, and is used along with the PKT_FIELD_1_LENGTH_7_0 property. Partitioning of the Payload into separate fields is provided to support variable length packets, and to allow different forms of data processing (e.g., Manchester encoding, data whitening, etc) across different fields. These properties are applicable in TX mode only if the START_TX command is sent with the parameter TX_LEN=0. These properties are applicable in RX mode only under the following conditions: RX Packet Handling is enabled by clearing PKT_CONFIG1:PH_RX_DISABLE, and The START_RX command is sent with the parameter RX_LEN=0, and PKT_CONFIG1:PH_FIELD_SPLIT is cleared. If the PH_FIELD_SPLIT bit is set, the lengths of the various fields in RX mode are determined by the PKT_RX_FIELD_LENGTH_XX properties. A value of zero in this property means that the field is not used. During TX mode, data will be retrieved from the TX FIFO until encountering the first field whose length has been set to zero. During RX mode, data will be stored in the RX FIFO until again encountering the first field whose length has been set to zero. It is possible (although not common) to set the length of Field 1 = 0 bytes, as this would indicate transmission/reception of a packet with no Payload data at all. Field 1 cannot be configured as a variable length field, as there is no preceding field that may contain the variable length byte(s).
  168. //   PKT_FIELD_1_LENGTH_7_0 - Byte 0 of the unsigned 13-bit Field 1 length value. Please refer to the text description for PKT_FIELD_1_LENGTH_12_8 for more details regarding Field 1 length configuration.
  169. //   PKT_FIELD_1_CONFIG - Partitioning of the Payload into separate fields is provided to support features such as variable length packets and field-specific data processing (e.g., Manchester encoding, data whitening, etc). This property provides configuration bits for field-specific processing on Field 1. The configuration bits in this property are common to both TX and RX modes dependent on PKT_CONFIG1:PH_FIELD_SPLIT; however, this property is only applicable when automatic Packet Handling is enabled (e.g., when using the TX FIFO as the modulation source in TX mode, or when PKT_CONFIG1:PH_RX_DISABLE is cleared in RX mode).
  170. //   PKT_FIELD_1_CRC_CONFIG - This property is use to control the calculation, transmission, and checking of CRC across Field 1.
  171. //   PKT_FIELD_2_LENGTH_12_8 - The PKT_FIELD_2_LENGTH_XX properties specify the length of Field 2 in bytes. The field length is an unsigned 13-bit value; this property is Byte 1 of the length value, and is used along with the PKT_FIELD_2_LENGTH_7_0 property. Field 2 may be configured as a variable length field by setting the appropriate value of DST_FIELD (in the PKT_LEN property); however, it is also necessary that a previous field contain the variable length byte(s). If configured as a variable length field, this property must be set with a value that represents the maximum expected length of the field. Please refer to the text description for PKT_FIELD_1_LENGTH_12_8 for more details regarding field length configuration.
  172. //   PKT_FIELD_2_LENGTH_7_0 - Byte 0 of the unsigned 13-bit Field 2 length value. Please refer to the text description for PKT_FIELD_2_LENGTH_12_8 for more details regarding Field 2 length configuration.
  173. //   PKT_FIELD_2_CONFIG - This property provides configuration bits for field-specific processing on Field 2. Please refer to the text description for PKT_FIELD_1_CONFIG for more details regarding enabling/disabling of field-specific processing.
  174. //   PKT_FIELD_2_CRC_CONFIG - This property is use to control the calculation, transmission, and checking of CRC across Field 2. Please refer to the text description for PKT_FIELD_1_CRC_CONFIG for more details regarding configuration of field-specific CRC calculation.
  175. //   PKT_FIELD_3_LENGTH_12_8 - The PKT_FIELD_3_LENGTH_XX properties specify the length of Field 3 in bytes. The field length is an unsigned 13-bit value; this property is Byte 1 of the length value, and is used along with the PKT_FIELD_3_LENGTH_7_0 property. Field 3 may be configured as a variable length field by setting the appropriate value of DST_FIELD (in the PKT_LEN property); however, it is also necessary that a previous field contain the variable length byte(s). If configured as a variable length field, this property must be set with a value that represents the maximum expected length of the field. Please refer to the text description for PKT_FIELD_1_LENGTH_12_8 for more details regarding field length configuration.
  176. //   PKT_FIELD_3_LENGTH_7_0 - Byte 0 of the unsigned 13-bit Field 3 length value. Please refer to the text description for PKT_FIELD_3_LENGTH_12_8 for more details regarding Field 3 length configuration.
  177. //   PKT_FIELD_3_CONFIG - This property provides configuration bits for field-specific processing on Field 3. Please refer to the text description for PKT_FIELD_1_CONFIG for more details regarding enabling/disabling of field-specific processing.
  178. //   PKT_FIELD_3_CRC_CONFIG - This property is use to control the calculation, transmission, and checking of CRC across Field 3. Please refer to the text description for PKT_FIELD_1_CRC_CONFIG for more details regarding configuration of field-specific CRC calculation.
  179. */
  180. #define RF_PKT_FIELD_1_LENGTH_12_8_12 0x11, 0x12, 0x0C, 0x0D, 0x00, 0x07, 0x04, 0x8A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00  //字段長度設置
  181. /*
  182. // Set properties:           RF_PKT_FIELD_4_LENGTH_12_8_8
  183. // Number of properties:     8
  184. // Group ID:                 12
  185. // Start ID:                 19
  186. // Default values:           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  187. // Descriptions:
  188. //   PKT_FIELD_4_LENGTH_12_8 - The PKT_FIELD_4_LENGTH_XX properties specify the length of Field 4 in bytes. The field length is an unsigned 13-bit value; this property is Byte 1 of the length value, and is used along with the PKT_FIELD_4_LENGTH_7_0 property. Field 4 may be configured as a variable length field by setting the appropriate value of DST_FIELD (in the PKT_LEN property); however, it is also necessary that a previous field contain the variable length byte(s). If configured as a variable length field, this property must be set with a value that represents the maximum expected length of the field. Please refer to the text description for PKT_FIELD_1_LENGTH_12_8 for more details regarding field length configuration.
  189. //   PKT_FIELD_4_LENGTH_7_0 - Byte 0 of the unsigned 13-bit Field 4 length value. Please refer to the text description for PKT_FIELD_4_LENGTH_12_8 for more details regarding Field 4 length configuration.
  190. //   PKT_FIELD_4_CONFIG - This property provides configuration bits for field-specific processing on Field 4. Please refer to the text description for PKT_FIELD_1_CONFIG for more details regarding enabling/disabling of field-specific processing.
  191. //   PKT_FIELD_4_CRC_CONFIG - This property is use to control the calculation, transmission, and checking of CRC across Field 4. Please refer to the text description for PKT_FIELD_1_CRC_CONFIG for more details regarding configuration of field-specific CRC calculation.
  192. //   PKT_FIELD_5_LENGTH_12_8 - The PKT_FIELD_5_LENGTH_XX properties specify the length of Field 5 in bytes. The field length is an unsigned 13-bit value; this property is Byte 1 of the length value, and is used along with the PKT_FIELD_5_LENGTH_7_0 property. Field 5 may be configured as a variable length field by setting the appropriate value of DST_FIELD (in the PKT_LEN property); however, it is also necessary that a previous field contain the variable length byte(s). If configured as a variable length field, this property must be set with a value that represents the maximum expected length of the field. Please refer to the text description for PKT_FIELD_1_LENGTH_12_8 for more details regarding field length configuration.
  193. //   PKT_FIELD_5_LENGTH_7_0 - Byte 0 of the unsigned 13-bit Field 5 length value. Please refer to the text description for PKT_FIELD_5_LENGTH_12_8 for more details regarding Field 5 length configuration.
  194. //   PKT_FIELD_5_CONFIG - This property provides configuration bits for field-specific processing on Field 5. Please refer to the text description for PKT_FIELD_1_CONFIG for more details regarding enabling/disabling of field-specific processing.
  195. //   PKT_FIELD_5_CRC_CONFIG - This property is use to control the calculation, transmission, and checking of CRC across Field 5. Please refer to the text description for PKT_FIELD_1_CRC_CONFIG for more details regarding configuration of field-specific CRC calculation.
  196. */
  197. #define RF_PKT_FIELD_4_LENGTH_12_8_8 0x11, 0x12, 0x08, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  198. /*
  199. // Set properties:           RF_MODEM_MOD_TYPE_12
  200. // Number of properties:     12
  201. // Group ID:                 20
  202. // Start ID:                 00
  203. // Default values:           0x02, 0x80, 0x07, 0x0F, 0x42, 0x40, 0x01, 0xC9, 0xC3, 0x80, 0x00, 0x06,
  204. // Descriptions:
  205. //   MODEM_MOD_TYPE - This property configures the Modem in the chip for transmission/reception of the following modulation types: OOK, 2(G)FSK, and 4(G)FSK (if supported) modulation. In TX mode, this property is additionally used to select the source of the TX data stream, and whether that TX data stream is from a synchronous or asynchronous source (in Direct mode only). The Modem must be configured for transmission/reception of only one type of modulation throughout the entire packet; it is not possible (for example) to use OOK modulation over certain fields and (G)FSK modulation over other fields. If 4(G)FSK is supported, it is possible to switch between 2(G)FSK and 4(G)FSK on a field-specific basis; however, this is accomplished by configuring the Modem to 4(G)FSK mode for the entire packet and then performing special data processing in the Packet Handler.
  206. //   MODEM_MAP_CONTROL - Modem Mapping Control.
  207. //   MODEM_DSM_CTRL - Delta Sigma Modulator control.
  208. //   MODEM_DATA_RATE_2 - Data rate, unsigned 24-bit, 100 kbps by default.
  209. //   MODEM_DATA_RATE_1 - Data rate, unsigned 24-bit, 100 kbps by default.
  210. //   MODEM_DATA_RATE_0 - Data rate, unsigned 24-bit, 100 kbps by default.
  211. //   MODEM_TX_NCO_MODE_3 - TX NCOs modulo, unsigned 26-bit, default value is 0x1C9C380. Together with the crystal frequency and data rate, this number will set the symbol rate. If data rate is greater than 50 kbps, it should be set to 0x1C9C380. Otherwise it will be 0x2DC6C0.
  212. //   MODEM_TX_NCO_MODE_2 - TX NCOs modulo, unsigned 26-bit, default value is 0x1C9C380. Together with the crystal frequency and data rate, this number will set the symbol rate. If data rate is greater than 50 kbps, it should be set to 0x1C9C380. Otherwise it will be 0x2DC6C0.
  213. //   MODEM_TX_NCO_MODE_1 - TX NCOs modulo, unsigned 26-bit, default value is 0x1C9C380. Together with the crystal frequency and data rate, this number will set the symbol rate. If data rate is greater than 50 kbps, it should be set to 0x1C9C380. Otherwise it will be 0x2DC6C0.
  214. //   MODEM_TX_NCO_MODE_0 - TX NCOs modulo, unsigned 26-bit, default value is 0x1C9C380. Together with the crystal frequency and data rate, this number will set the symbol rate. If data rate is greater than 50 kbps, it should be set to 0x1C9C380. Otherwise it will be 0x2DC6C0.
  215. //   MODEM_FREQ_DEV_2 - The TX frequency deviation is specified by an unsigned 17-bit value. This property defines Byte 2 of the frequency deviation value. The units of the MODEM_FREQ_DEV_X property are in increments of the LSB tuning resolution of the PLL Synthesizer, and are therefore a function of the crystal frequency and output frequency band. The formula for calculating the value of the MODEM_FREQ_DEV property is given by the following equation: For 2(G)FSK mode, the specified value is the peak deviation. For 4(G)FSK mode (if supported), the specified value is the inner deviation (i.e., between channel center frequency and the nearest symbol deviation level). The MODEM_FREQ_DEV_X properties are only used in TX mode.
  216. //   MODEM_FREQ_DEV_1 - The TX frequency deviation is specified by an unsigned 17-bit value. This property defines Byte 1 of the frequency deviation value. Please refer to the text description for MODEM_FREQ_DEV_2 for more details regarding TX frequency deviation.
  217. */
  218. #define RF_MODEM_MOD_TYPE_12 0x11, 0x20, 0x0C, 0x00, 0x03, 0x00, 0x07, 0x00, 0x9C, 0x40, 0x04, 0x2D, 0xC6, 0xC0, 0x00, 0x05 //調制類型設置2GFSK  0x03,禁用曼徹斯特編碼
  219.                                                  //波特率設置 40KHZ 0x009c40 ,3M時鐘速率0x002DC6C0
  220.                                                 //波特率設置:0x009C40 10KHZ,頻偏高8位設置0X05***********/
  221. /***********
  222. #define RF_MODEM_MOD_TYPE_12 0x11, 0x20, 0x0C, 0x00, 0x03, 0x00, 0x07, 0x06, 0x1A, 0x80, 0x05, 0xC9, 0xC3, 0x80, 0x00, 0x05////調制類型設置2GFSK  0x03,禁用曼徹斯特編碼
  223.                                                  //波特率設置 40KHZ 0x009c40  30M時鐘速率 0x01C9C38
  224.                                                 //波特率設置: 0x06, 0x1A, 0x80 10KHZ,頻偏高8位設置0X05
  225. ***********************/
  226. /*
  227. // Set properties:           RF_MODEM_FREQ_DEV_0_1
  228. // Number of properties:     1
  229. // Group ID:                 20
  230. // Start ID:                 0C
  231. // Default values:           0xD3,
  232. // Descriptions:
  233. //   MODEM_FREQ_DEV_0 - The TX frequency deviation is specified by an unsigned 17-bit value. This property defines Byte 0 of the frequency deviation value. Please refer to the text description for MODEM_FREQ_DEV_2 for more details regarding TX frequency deviation.
  234. */
  235. #define RF_MODEM_FREQ_DEV_0_1 0x11, 0x20, 0x01, 0x0C, 0x76  //頻偏字節0設置  0X000576 頻偏20kHZ
  236. /*
  237. // Set properties:           RF_MODEM_TX_RAMP_DELAY_8
  238. // Number of properties:     8
  239. // Group ID:                 20
  240. // Start ID:                 18
  241. // Default values:           0x01, 0x00, 0x08, 0x03, 0xC0, 0x00, 0x10, 0x20,
  242. // Descriptions:
  243. //   MODEM_TX_RAMP_DELAY - Unit in TX bit cycle, it is calculated according to modulation type.
  244. //   MODEM_MDM_CTRL - Detector selection and PM pattern configuration.
  245. //   MODEM_IF_CONTROL - Specifies fixed-IF(468.75 kHz), zero-IF, or scalable IF.
  246. //   MODEM_IF_FREQ_2 - Bits 16 an 17 of the 18-bit IF frequency. Specify fixed-IF(468.75kHz), zero-IF, or scalable IF.
  247. //   MODEM_IF_FREQ_1 - IF frequency is 18-bit.
  248. //   MODEM_IF_FREQ_0 - IF frequency is 18-bit.
  249. //   MODEM_DECIMATION_CFG1 - Specifies the exponent of decimation ratios of the three CIC decimators in RX filter chain.
  250. //   MODEM_DECIMATION_CFG0 - This property specifies the selection of the two polyphase filters preceding CIC filters, the droop compensation filter, the RX decimate by 8 2x filter and the channel filter power mode.
  251. */
  252. #define RF_MODEM_TX_RAMP_DELAY_8 0x11, 0x20, 0x08, 0x18, 0x01, 0x80, 0x08, 0x03, 0x80, 0x00, 0x20, 0x10
  253. /*
  254. // Set properties:           RF_MODEM_BCR_OSR_1_9
  255. // Number of properties:     9
  256. // Group ID:                 20
  257. // Start ID:                 22
  258. // Default values:           0x00, 0x4B, 0x06, 0xD3, 0xA0, 0x06, 0xD3, 0x02, 0xC0,
  259. // Descriptions:
  260. //   MODEM_BCR_OSR_1 - High byte of RX symbol oversampling rate at BCR/Slicer (12-bit unsigned number).
  261. //   MODEM_BCR_OSR_0 - Low byte of RX symbol oversampling rate at BCR/Slicer, total 12 bits.
  262. //   MODEM_BCR_NCO_OFFSET_2 - Specifies the 6 MSBs of the BCR NCO offset.
  263. //   MODEM_BCR_NCO_OFFSET_1 - Byte 1 of RX BCR NCO offset (an unsigned 22-bit number).
  264. //   MODEM_BCR_NCO_OFFSET_0 - Low byte of RX NCO offset.
  265. //   MODEM_BCR_GAIN_1 - High byte of clock recovery timing loop gain value.
  266. //   MODEM_BCR_GAIN_0 - Low byte of clock recovery timing loop gain value.
  267. //   MODEM_BCR_GEAR - RX BCR loop gear control. A reduced value of bit clock recovery gain is often desired after gear shifting (to reduce clock jitter). The BCR loop gain in both gear modes is obtained from a baseline clock recovery gain value (crgain in the MODEM_BCR_GAIN_x properties), scaled by the crfast and crslow values specified in this property. NOTE: larger values of crfast or crslow result in lower values of bit clock recovery gain.
  268. //   MODEM_BCR_MISC1 - This property configures miscellaneous options within the RX BCR loop.
  269. */
  270. #define RF_MODEM_BCR_OSR_1_9 0x11, 0x20, 0x09, 0x22, 0x00, 0xFA, 0x02, 0x0C, 0x4A, 0x01, 0x06, 0x02, 0xC2
  271. /*
  272. // Set properties:           RF_MODEM_AFC_GEAR_7
  273. // Number of properties:     7
  274. // Group ID:                 20
  275. // Start ID:                 2C
  276. // Default values:           0x00, 0x23, 0x83, 0x69, 0x00, 0x40, 0xA0,
  277. // Descriptions:
  278. //   MODEM_AFC_GEAR - Selection of gear switching source for both RX AFC and BCR. Control of gain for RX AFC in both FAST and SLOW modes (i.e., before and after gear switching)
  279. //   MODEM_AFC_WAIT - Short and long wait periods after AFC correction.
  280. //   MODEM_AFC_GAIN_1 - High byte of 13-bit AFC loop gain value. Enabling of AFC frequency error estimation. Enabling of dynamic IF bandwidth switching during the packet.
  281. //   MODEM_AFC_GAIN_0 - Low byte of 13-bit AFC loop gain value
  282. //   MODEM_AFC_LIMITER_1 - High byte of 15-bit AFC limiter value.
  283. //   MODEM_AFC_LIMITER_0 - Low byte of 15-bit AFC limiter value.
  284. //   MODEM_AFC_MISC - Specifies misc AFC control bits.
  285. */
  286. #define RF_MODEM_AFC_GEAR_7 0x11, 0x20, 0x07, 0x2C, 0x04, 0x36, 0xC0, 0x1D, 0x0D, 0x58, 0xC0
  287. /*
  288. // Set properties:           RF_MODEM_AGC_CONTROL_1
  289. // Number of properties:     1
  290. // Group ID:                 20
  291. // Start ID:                 35
  292. // Default values:           0xE0,
  293. // Descriptions:
  294. //   MODEM_AGC_CONTROL - AGC control.
  295. */
  296. #define RF_MODEM_AGC_CONTROL_1 0x11, 0x20, 0x01, 0x35, 0xE2 //AGC增益控制
  297. /*
  298. // Set properties:           RF_MODEM_AGC_WINDOW_SIZE_9
  299. // Number of properties:     9
  300. // Group ID:                 20
  301. // Start ID:                 38
  302. // Default values:           0x11, 0x10, 0x10, 0x0B, 0x1C, 0x40, 0x00, 0x00, 0x2B,
  303. // Descriptions:
  304. //   MODEM_AGC_WINDOW_SIZE - Sets PGA and LNA settling time window and measurement time window.
  305. //   MODEM_AGC_RFPD_DECAY - Sets RF detector decay time.
  306. //   MODEM_AGC_IFPD_DECAY - Sets IF detector decay time.
  307. //   MODEM_FSK4_GAIN1 - Controls 4(G)FSK suppression gain.
  308. //   MODEM_FSK4_GAIN0 - Controls 4(G)FSK suppression gain.
  309. //   MODEM_FSK4_TH1 - High byte of 4(G)FSK slicer threshold.
  310. //   MODEM_FSK4_TH0 - Low byte of 4(G)FSK slicer threshold.
  311. //   MODEM_FSK4_MAP - 4(G)FSK symbol mapping code.
  312. //   MODEM_OOK_PDTC - OOK peak detector decay and attack time.
  313. */
  314. #define RF_MODEM_AGC_WINDOW_SIZE_9 0x11, 0x20, 0x09, 0x38, 0x11, 0x37, 0x37, 0x00, 0x1A, 0x10, 0x00, 0x00, 0x29
  315. /*
  316. // Set properties:           RF_MODEM_OOK_CNT1_11
  317. // Number of properties:     11
  318. // Group ID:                 20
  319. // Start ID:                 42
  320. // Default values:           0xA4, 0x03, 0x56, 0x02, 0x00, 0xA3, 0x02, 0x80, 0xFF, 0x0C, 0x01,
  321. // Descriptions:
  322. //   MODEM_OOK_CNT1 - OOK control.
  323. //   MODEM_OOK_MISC - Control OOK Peak Detector.
  324. //   MODEM_RAW_SEARCH - Searching period for high and low gear.
  325. //   MODEM_RAW_CONTROL - Defines gain and enable controls for raw / nonstandard mode.
  326. //   MODEM_RAW_EYE_1 - Eye-open detector threshold.
  327. //   MODEM_RAW_EYE_0 - Eye-open detector threshold. The reset of bits are set by property RAW_EYE_1.
  328. //   MODEM_ANT_DIV_MODE - Antenna diversity mode settings.
  329. //   MODEM_ANT_DIV_CONTROL - Specifies pm detection threshold and GPIO configuration in antenna diversity mode.
  330. //   MODEM_RSSI_THRESH - Selects the threshold for Clear Channel Assessment (CCA) and generation of the RSSI interrupt. If the Current RSSI value is above this threshold, a GPIO pin configured to output the CCA signal will be high. If the Current RSSI value crosses above this threshold, the RSSI interrupt will be generated. NOTE: the Latched RSSI value exceeding this threshold will not generate an RSSI interrupt. If enabled in the MODEM_RSSI_CONTROL property, the Latched RSSI value may also be compared against this threshold. The purpose of the comparison is to determine if the Latched RSSI value is below (not above) the threshold; if so, the chip proceeds to the specified START_RX:RXTIMEOUT_STATE and generates a PREAMBLE_INVALID interrupt.
  331. //   MODEM_RSSI_JUMP_THRESH - RSSI jumping detection threshold, step in 1 dB.
  332. //   MODEM_RSSI_CONTROL - Selects if the RSSI value is latched, and at what point in the packet it is latched. The Latched RSSI value may be read by a Fast Response Register, or returned by the GET_MODEM_STATUS command. Selects whether the RSSI value is updated every 1*Tb bit period, or whether the RSSI value is averaged over the previous 4*Tb bit periods. Selects if the Latched RSSI value is compared against the MODEM_RSSI_THRESH value, for the purpose of exiting to the RXTIMEOUT_STATE if below threshold.
  333. */
  334. #define RF_MODEM_OOK_CNT1_11 0x11, 0x20, 0x0B, 0x42, 0xA4, 0x02, 0xD6, 0x83, 0x01, 0xFF, 0x01, 0x80, 0xFF, 0x0C, 0x12 //RSSI average over 4 bits, latches at sync word detect
  335. /*
  336. // Set properties:           RF_MODEM_RSSI_COMP_1
  337. // Number of properties:     1
  338. // Group ID:                 20
  339. // Start ID:                 4E
  340. // Default values:           0x32,
  341. // Descriptions:
  342. //   MODEM_RSSI_COMP - Offsets RSSI curve in 1 dB steps. 32 is no offset, lower will adjust RSSI down, and higher will adjust RSSI up.
  343. */
  344. #define RF_MODEM_RSSI_COMP_1 0x11, 0x20, 0x01, 0x4E, 0x40  //RSSI 補償
  345. /*
  346. // Set properties:           RF_MODEM_CLKGEN_BAND_1
  347. // Number of properties:     1
  348. // Group ID:                 20
  349. // Start ID:                 51
  350. // Default values:           0x08,
  351. // Descriptions:
  352. //   MODEM_CLKGEN_BAND - Selects the divide ratio of the configurable divider at the output of the PLL Synthesizer as a function of the desired operating frequency band. Configures the PLL Synthesizer for High Performance or Low Power operating mode, allowing a tradeoff between tuning resolution and current consumption.
  353. */
  354. #define RF_MODEM_CLKGEN_BAND_1 0x11, 0x20, 0x01, 0x51, 0x0A
  355. /*
  356. // Set properties:           RF_MODEM_CHFLT_RX1_CHFLT_COE13_7_0_12
  357. // Number of properties:     12
  358. // Group ID:                 21
  359. // Start ID:                 00
  360. // Default values:           0xFF, 0xBA, 0x0F, 0x51, 0xCF, 0xA9, 0xC9, 0xFC, 0x1B, 0x1E, 0x0F, 0x01,
  361. // Descriptions:
  362. //   MODEM_CHFLT_RX1_CHFLT_COE13_7_0 - The chip implements the RX channel selection bandpass filtering in the digital domain as an FIR filter. The MODEM_CHFLT_RX_CHFLT_COEXX properties define the values for the filter tap coefficients. The chip provides for two different sets of RX filter coefficients (MODEM_CHFLT_RX1 and MODEM_CHFLT_RX2). These properties define the values for the first set of filter coefficients; see also the text description for the MODEM_CHFLT_RX2_CHFLT_COEXX properties for a discussion of the second set of filter coefficients and use of adaptive RX filter bandwidth across the packet. By default, the digital filter is 27 taps in length. However, it is possible to configure the RX Modem for a channel selection filter with only 15 taps; the advantage of the 15-tap filter is a reduction in filter processing delay at the expense of reduced filtering performance (e.g., adjacent channel selectivity). Please contact Silicon Labs for assistance with configuring the reduced performance filter. The values of the tap coefficients are symmetrical; that is, the value of COEFF26=COEFF0, COEFF25=COEFF1, and so on. Thus it is only necessary to store 14 filter coefficients; the internal circuitry obtains the remaining coefficients through symmetry. Each filter tap coefficient is a 10-bit signed value. The lower 8-bits of each coefficient are held in the MODEM_CHFLT_RX1_CHFLT_COEXX properties; the top two bits are packed into the MODEM_CHFLT_RX1_CHFLT_COEMXX properties. Silicon Labs has pre-calculated 15 different sets of filter tap coefficients. The WDS Calculator will recommend one of these filter sets, based upon the RX filter bandwidth required to receive the desired signal. The filter bandwidth is a function of both the selected filter set, as well as the filter clock decimation ratio (see the MODEM_DECIMATION_CFG1/0 properties). This property sets the lower 8-bits of the 13th filter coefficient for the first set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX1_CHFLT_COEM0 property.
  363. //   MODEM_CHFLT_RX1_CHFLT_COE12_7_0 - This property sets the lower 8-bits of the 12th filter coefficient for the first set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX1_CHFLT_COEM0 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  364. //   MODEM_CHFLT_RX1_CHFLT_COE11_7_0 - This property sets the lower 8-bits of the 11th filter coefficient for the first set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX1_CHFLT_COEM0 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  365. //   MODEM_CHFLT_RX1_CHFLT_COE10_7_0 - This property sets the lower 8-bits of the 10th filter coefficient for the first set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX1_CHFLT_COEM0 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  366. //   MODEM_CHFLT_RX1_CHFLT_COE9_7_0 - This property sets the lower 8-bits of the 9th filter coefficient for the first set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX1_CHFLT_COEM1 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  367. //   MODEM_CHFLT_RX1_CHFLT_COE8_7_0 - This property sets the lower 8-bits of the 8th filter coefficient for the first set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX1_CHFLT_COEM1 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  368. //   MODEM_CHFLT_RX1_CHFLT_COE7_7_0 - This property sets the lower 8-bits of the 7th filter coefficient for the first set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX1_CHFLT_COEM1 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  369. //   MODEM_CHFLT_RX1_CHFLT_COE6_7_0 - This property sets the lower 8-bits of the 6th filter coefficient for the first set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX1_CHFLT_COEM1 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  370. //   MODEM_CHFLT_RX1_CHFLT_COE5_7_0 - This property sets the lower 8-bits of the 5th filter coefficient for the first set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX1_CHFLT_COEM2 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  371. //   MODEM_CHFLT_RX1_CHFLT_COE4_7_0 - This property sets the lower 8-bits of the 4th filter coefficient for the first set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX1_CHFLT_COEM2 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  372. //   MODEM_CHFLT_RX1_CHFLT_COE3_7_0 - This property sets the lower 8-bits of the 3rd filter coefficient for the first set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX1_CHFLT_COEM2 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  373. //   MODEM_CHFLT_RX1_CHFLT_COE2_7_0 - This property sets the lower 8-bits of the 2nd filter coefficient for the first set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX1_CHFLT_COEM2 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  374. */
  375. #define RF_MODEM_CHFLT_RX1_CHFLT_COE13_7_0_12 0x11, 0x21, 0x0C, 0x00, 0xFF, 0xC4, 0x30, 0x7F, 0xF5, 0xB5, 0xB8, 0xDE, 0x05, 0x17, 0x16, 0x0C
  376. /*
  377. // Set properties:           RF_MODEM_CHFLT_RX1_CHFLT_COE1_7_0_12
  378. // Number of properties:     12
  379. // Group ID:                 21
  380. // Start ID:                 0C
  381. // Default values:           0xFC, 0xFD, 0x15, 0xFF, 0x00, 0x0F, 0xFF, 0xC4, 0x30, 0x7F, 0xF5, 0xB5,
  382. // Descriptions:
  383. //   MODEM_CHFLT_RX1_CHFLT_COE1_7_0 - This property sets the lower 8-bits of the 1st filter coefficient for the first set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX1_CHFLT_COEM3 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  384. //   MODEM_CHFLT_RX1_CHFLT_COE0_7_0 - This property sets the lower 8-bits of the 0th filter coefficient for the first set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX1_CHFLT_COEM3 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  385. //   MODEM_CHFLT_RX1_CHFLT_COEM0 - There are 14 filter tap coefficient values; each value is a signed 10-bit value. The lower 8-bits of each coefficient are set in the MODEM_CHFLT_RX_CHFLT_COEXX properties, while the top two bits are packed into the MODEM_CHFLT_RX_CHFLT_COEMXX properties. This property contains the top two bits of the 13th through 10th filter coefficients for the first set of filter coefficients.
  386. //   MODEM_CHFLT_RX1_CHFLT_COEM1 - There are 14 filter tap coefficient values; each value is a signed 10-bit value. The lower 8-bits of each coefficient are set in the MODEM_CHFLT_RX_CHFLT_COEXX properties, while the top two bits are packed into the MODEM_CHFLT_RX_CHFLT_COEMXX properties. This property contains the top two bits of the 9th through 6th filter coefficients for the first set of filter coefficients.
  387. //   MODEM_CHFLT_RX1_CHFLT_COEM2 - There are 14 filter tap coefficient values; each value is a signed 10-bit value. The lower 8-bits of each coefficient are set in the MODEM_CHFLT_RX_CHFLT_COEXX properties, while the top two bits are packed into the MODEM_CHFLT_RX_CHFLT_COEMXX properties. This property contains the top two bits of the 5th through 2nd filter coefficients for the first set of filter coefficients.
  388. //   MODEM_CHFLT_RX1_CHFLT_COEM3 - There are 14 filter tap coefficient values; each value is a signed 10-bit value. The lower 8-bits of each coefficient are set in the MODEM_CHFLT_RX_CHFLT_COEXX properties, while the top two bits are packed into the MODEM_CHFLT_RX_CHFLT_COEMXX properties. This property contains the top two bits of the 1st through 0th filter coefficients for the first set of filter coefficients.
  389. //   MODEM_CHFLT_RX2_CHFLT_COE13_7_0 - The chip provides for two different sets of RX filter coefficients (MODEM_CHFLT_RX1 and MODEM_CHFLT_RX2). These properties define the values for the second set of filter coefficients; see also the text description for the MODEM_CHFLT_RX1_CHFLT_COEXX properties for a general discussion of the configuration of filter tap coefficients. Two different sets of filter tap coefficients (i.e., filter bandwidths) are provided to allow narrowing the RX bandwidth after the PLL-based AFC algorithm has acquired the signal and centered it in the filter passband. With no residual frequency error, the filter bandwidth may be reduced to pass only the modulation bandwidth of the signal, thus improving sensitivity over the remainder of the packet. This adaptive RX bandwidth feature is only applicable when PLL AFC is enabled (by setting MODEM_AFC_MISC:ENFBPLL), and the adaptive RX bandwidth function is enabled (by setting MODEM_AFC_GAIN_1:AFCBD). When the adaptive RX bandwidth feature is enabled, the first set of filter coefficients (defined in the MODEM_CHFLT_RX1 properties) is effective prior to gear-switching (e.g., detection of PREAMBLE_VALID) while the second set of filter coefficients (defined in the MODEM_CHFLT_RX2 properties) is effective after gear-switching. When the adaptive RX bandwidth feature is disabled, the first set of filter coefficients is used for the entire packet. This property sets the lower 8-bits of the 13th filter coefficient for the second set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX2_CHFLT_COEM0 property.
  390. //   MODEM_CHFLT_RX2_CHFLT_COE12_7_0 - This property sets the lower 8-bits of the 12th filter coefficient for the second set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX2_CHFLT_COEM0 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  391. //   MODEM_CHFLT_RX2_CHFLT_COE11_7_0 - This property sets the lower 8-bits of the 11th filter coefficient for the second set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX2_CHFLT_COEM0 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  392. //   MODEM_CHFLT_RX2_CHFLT_COE10_7_0 - This property sets the lower 8-bits of the 10th filter coefficient for the second set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX2_CHFLT_COEM0 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  393. //   MODEM_CHFLT_RX2_CHFLT_COE9_7_0 - This property sets the lower 8-bits of the 9th filter coefficient for the second set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX2_CHFLT_COEM1 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_1 for more details regarding programming of the channel selection filter tap coefficients.
  394. //   MODEM_CHFLT_RX2_CHFLT_COE8_7_0 - This property sets the lower 8-bits of the 8th filter coefficient for the second set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX2_CHFLT_COEM1 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  395. */
  396. #define RF_MODEM_CHFLT_RX1_CHFLT_COE1_7_0_12 0x11, 0x21, 0x0C, 0x0C, 0x03, 0x00, 0x15, 0xFF, 0x00, 0x00, 0xA2, 0x81, 0x26, 0xAF, 0x3F, 0xEE
  397. /*
  398. // Set properties:           RF_MODEM_CHFLT_RX2_CHFLT_COE7_7_0_12
  399. // Number of properties:     12
  400. // Group ID:                 21
  401. // Start ID:                 18
  402. // Default values:           0xB8, 0xDE, 0x05, 0x17, 0x16, 0x0C, 0x03, 0x00, 0x15, 0xFF, 0x00, 0x00,
  403. // Descriptions:
  404. //   MODEM_CHFLT_RX2_CHFLT_COE7_7_0 - This property sets the lower 8-bits of the 7th filter coefficient for the second set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX2_CHFLT_COEM1 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_1 for more details regarding programming of the channel selection filter tap coefficients.
  405. //   MODEM_CHFLT_RX2_CHFLT_COE6_7_0 - This property sets the lower 8-bits of the 6th filter coefficient for the second set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX2_CHFLT_COEM1 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_1 for more details regarding programming of the channel selection filter tap coefficients.
  406. //   MODEM_CHFLT_RX2_CHFLT_COE5_7_0 - This property sets the lower 8-bits of the 5th filter coefficient for the second set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX2_CHFLT_COEM2 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  407. //   MODEM_CHFLT_RX2_CHFLT_COE4_7_0 - This property sets the lower 8-bits of the 4th filter coefficient for the second set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX2_CHFLT_COEM2 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  408. //   MODEM_CHFLT_RX2_CHFLT_COE3_7_0 - This property sets the lower 8-bits of the 3rd filter coefficient for the second set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX2_CHFLT_COEM2 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  409. //   MODEM_CHFLT_RX2_CHFLT_COE2_7_0 - This property sets the lower 8-bits of the 2nd filter coefficient for the second set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX2_CHFLT_COEM2 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  410. //   MODEM_CHFLT_RX2_CHFLT_COE1_7_0 - This property sets the lower 8-bits of the 1st filter coefficient for the second set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX2_CHFLT_COEM3 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  411. //   MODEM_CHFLT_RX2_CHFLT_COE0_7_0 - This property sets the lower 8-bits of the 0th filter coefficient for the second set of filter coefficients; the top two bits are packed into the MODEM_CHFLT_RX2_CHFLT_COEM3 property. Please refer to the text description for MODEM_CHFLT_RX1_CHFLT_COE13_7_0 for more details regarding programming of the channel selection filter tap coefficients.
  412. //   MODEM_CHFLT_RX2_CHFLT_COEM0 - There are 14 filter tap coefficient values; each value is a signed 10-bit value. The lower 8-bits of each coefficient are set in the MODEM_CHFLT_RX_CHFLT_COEXX properties, while the top two bits are packed into the MODEM_CHFLT_RX_CHFLT_COEMXX properties. This property contains the top two bits of the 13th through 10th filter coefficients for the second set of filter coefficients.
  413. //   MODEM_CHFLT_RX2_CHFLT_COEM1 - There are 14 filter tap coefficient values; each value is a signed 10-bit value. The lower 8-bits of each coefficient are set in the MODEM_CHFLT_RX_CHFLT_COEXX properties, while the top two bits are packed into the MODEM_CHFLT_RX_CHFLT_COEMXX properties. This property contains the top two bits of the 9th through 6th filter coefficients for the second set of filter coefficients.
  414. //   MODEM_CHFLT_RX2_CHFLT_COEM2 - There are 14 filter tap coefficient values; each value is a signed 10-bit value. The lower 8-bits of each coefficient are set in the MODEM_CHFLT_RX_CHFLT_COEXX properties, while the top two bits are packed into the MODEM_CHFLT_RX_CHFLT_COEMXX properties. This property contains the top two bits of the 5th through 2nd filter coefficients for the second set of filter coefficients.
  415. //   MODEM_CHFLT_RX2_CHFLT_COEM3 - There are 14 filter tap coefficient values; each value is a signed 10-bit value. The lower 8-bits of each coefficient are set in the MODEM_CHFLT_RX_CHFLT_COEXX properties, while the top two bits are packed into the MODEM_CHFLT_RX_CHFLT_COEMXX properties. This property contains the top two bits of the 1st through 0th filter coefficients for the second set of filter coefficients.
  416. */
  417. #define RF_MODEM_CHFLT_RX2_CHFLT_COE7_7_0_12 0x11, 0x21, 0x0C, 0x18, 0xC8, 0xC7, 0xDB, 0xF2, 0x02, 0x08, 0x07, 0x03, 0x15, 0xFC, 0x0F, 0x00
  418. /*
  419. // Set properties:           RF_PA_MODE_4
  420. // Number of properties:     4
  421. // Group ID:                 22
  422. // Start ID:                 00
  423. // Default values:           0x08, 0x7F, 0x00, 0x5D,
  424. // Descriptions:
  425. //   PA_MODE - Specify PA mode and HPA/MPA groups.
  426. //   PA_PWR_LVL - Set the PA output power level with higher value as larger output power.
  427. //   PA_BIAS_CLKDUTY -
  428. //   PA_TC - Configuration control for PA power ramping in order to minimize switching spectrum noise. In (G)FSK mode, the values of TC and FSK_MOD_DLY should be programmed together so data modulation only occurs after the PA power ramping has been completed.
  429. */
  430. #define RF_PA_MODE_4 0x11, 0x22, 0x04, 0x00, 0x08, 0x7F, 0x00, 0x3D  //PA操作模式和組,2組開,PA模式:Switch, for Square Wave or Class E,TX功率7F,發射占空比1/2,
  431.                                   //PA調制時間14US, 間歇時間:Ramp time = 20 s/(32-TC)
  432. /*
  433. // Set properties:           RF_SYNTH_PFDCP_CPFF_7
  434. // Number of properties:     7
  435. // Group ID:                 23
  436. // Start ID:                 00
  437. // Default values:           0x2C, 0x0E, 0x0B, 0x04, 0x0C, 0x73, 0x03,
  438. // Descriptions:
  439. //   SYNTH_PFDCP_CPFF - The charge pump and loop filter in the PLL Synthesizer have two paths: an integral path and a feed-forward path. This property adjusts the charge pump gain (i.e., current) for the feed-forward path. The coding of the MSB (bit 5) of the CP_FF_CUR field is inverted. As a result, the minimum charge pump gain setting is obtained for a value of CP_FF_CUR=0x20, while CP_FF_CUR=0x00 corresponds to a mid-range charge pump gain setting and 0x1F corresponds to the maximum charge pump gain setting. The step size or resolution of the charge pump feed-forward current is in increments of 5 uA. Thus the range of values provided by the CP_FF_CUR field is from 0 uA to 315 uA. CP_FF_CUR_TEST is a test bit and is not recommended for general customer applications. The CP_FF_CUR_TEST bit is not binary-weighted with the CP_FF_CUR field but instead provides an additional 160 uA, when set. NOTE: the primary purpose of the SYNTH group of properties is to adjust the PLL loop bandwidth to a value appropriate for the selected data rate. Silicon Labs does not recommend modifying these properties away from the values suggested by the WDS Calculator.
  440. //   SYNTH_PFDCP_CPINT - The charge pump and loop filter in the PLL Synthesizer have two paths: an integral path and a feed-forward path. This property adjusts the charge pump gain (i.e., current) for the integral path. The coding of the MSB (bit 3) of the CP_INT_CUR field is inverted. As a result, the minimum charge pump gain setting is obtained for a value of CP_INT_CUR=0x08, while CP_INT_CUR=0x00 corresponds to a mid-range charge pump gain setting and 0x07 corresponds to the maximum charge pump gain setting. The step size or resolution of the charge pump feed-forward current is in increments of 5 uA. Thus the range of values provided by the CP_INT_CUR field is from 0 uA to 75 uA. NOTE: the primary purpose of the SYNTH group of properties is to adjust the PLL loop bandwidth to a value appropriate for the selected data rate. Silicon Labs does not recommend modifying these properties away from the values suggested by the WDS Calculator.
  441. //   SYNTH_VCO_KV - The charge pump, loop filter, and VCO tuning varactors in the PLL Synthesizer have two paths: an integral path and a feed-forward path. This property adjusts the gain scaling factors (Kv) for the tuning varactors in both the integral path and the feed-forward path. The adjustment of the gain factors is accomplished internally by switching in different number of varactor devices. NOTE: the primary purpose of the SYNTH group of properties is to adjust the PLL loop bandwidth to a value appropriate for the selected data rate. Silicon Labs does not recommend modifying these properties away from the values suggested by the WDS Calculator.
  442. //   SYNTH_LPFILT3 - The loop filter in the feed-forward path contains three lowpass filter poles: R1-C1, R2-C2, and R3-C3. The LPF_FF_R2 field adjusts the value of resistor R2, and thus adjusts the cutoff frequency of the R2-C2 lowpass filter pole. Additionally, the resistor R2 affects the DC gain of the transistor Gm stage in the feed-forward path. Increasing the value of R2 has the effect of increasing the feed-forward path gain. The value of R2 is in increments of 18 kOhm, ranging from a minimum value of 18 kOhm to a maximum of 144 kOhm. NOTE: the primary purpose of the SYNTH group of properties is to adjust the PLL loop bandwidth to a value appropriate for the selected data rate. Silicon Labs does not recommend modifying these properties away from the values suggested by the WDS Calculator.
  443. //   SYNTH_LPFILT2 - The loop filter in the feed-forward path contains three lowpass filter poles: R1-C1, R2-C2, and R3-C3. The LPF_FF_C2 field adjusts the value of capacitor C2, and thus adjusts the cutoff frequency of the R2-C2 lowpass filter pole. The value of C2 is in increments of 335 fF, ranging from a minimum value of 877 fF to a maximum of 11.25 pF. NOTE: the primary purpose of the SYNTH group of properties is to adjust the PLL loop bandwidth to a value appropriate for the selected data rate. Silicon Labs does not recommend modifying these properties away from the values suggested by the WDS Calculator.
  444. //   SYNTH_LPFILT1 - The loop filter in the feed-forward path contains three lowpass filter poles: R1-C1, R2-C2, and R3-C3. The LPF_FF_C3 field adjusts the value of capacitor C3, and thus adjusts the cutoff frequency of the R3-C3 lowpass filter pole. The value of resistor R3 is not adjustable and is fixed at R3=3.94 kOhm. The value of C3 is in increments of 1 pF, ranging from a minimum value of 9 pF to a maximum of 12 pF. The total value of capacitor C1 is determined by a 3-bit binary-weighted field LPF_FF_C1 in increments of 380 fF, and a 2-bit offset field LPF_FF_C1_CODE in increments of 1 pF, plus an additional fixed capacitance of 4.55 pF. Thus the total value of capacitor C1 may be described by the following equation: C1 = 4.55pF + 380fF*LPF_FF_C1 + 1pF*LPF_FF_C1_CODE The value of resistor R1 is not adjustable and is fixed at R1=9.86 kOhm. NOTE: the primary purpose of the SYNTH group of properties is to adjust the PLL loop bandwidth to a value appropriate for the selected data rate. Silicon Labs does not recommend modifying these properties away from the values suggested by the WDS Calculator.
  445. //   SYNTH_LPFILT0 - Bias current of the loop filter, 25 uA, 34 uA, 50 uA or 100 uA.
  446. */
  447. #define RF_SYNTH_PFDCP_CPFF_7 0x11, 0x23, 0x07, 0x00, 0x2C, 0x0E, 0x0B, 0x04, 0x0C, 0x73, 0x03
  448. /*
  449. // Set properties:           RF_MATCH_VALUE_1_12
  450. // Number of properties:     12
  451. // Group ID:                 30
  452. // Start ID:                 00
  453. // Default values:           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  454. // Descriptions:
  455. //   MATCH_VALUE_1 -
  456. //   MATCH_MASK_1 -
  457. //   MATCH_CTRL_1 - Enable packet match processing and pattern 1 matches or not.
  458. //   MATCH_VALUE_2 -
  459. //   MATCH_MASK_2 -
  460. //   MATCH_CTRL_2 - Enable pattern 2 matches or not.
  461. //   MATCH_VALUE_3 -
  462. //   MATCH_MASK_3 -
  463. //   MATCH_CTRL_3 - Enable pattern 3 matches or not.
  464. //   MATCH_VALUE_4 -
  465. //   MATCH_MASK_4 -
  466. //   MATCH_CTRL_4 - Enable pattern 4 matches or not.
  467. */
  468. #define RF_MATCH_VALUE_1_12 0x11, 0x30, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  469. /*
  470. // Set properties:           RF_FREQ_CONTROL_INTE_8
  471. // Number of properties:     8
  472. // Group ID:                 40
  473. // Start ID:                 00
  474. // Default values:           0x3C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x20, 0xFF,
  475. // Descriptions:
  476. //   FREQ_CONTROL_INTE - The total divide ratio for the Fractional-N PLL Synthesizer consists of an integer portion and a fractional portion. This property defines the integer divide number; the fractional divide value is specified in properties FREQ_CONTROL_FRAC_2, FREQ_CONTROL_FRAC_1, and FREQ_CONTROL_FRAC_0. The formula for calculating RF channel frequency as a function of integer and fractional divide values is as follows: The output divider value OUTDIV is configured as a function of the desired frequency band, and is specified in property MODEM_CLKGEN_BAND:BAND. The entire FC_FRAC word is 20-bits in length, but the MSB should always be set to 1, and thus the term FC_FRAC/2^19 will always be between 1 and 2 in value. As a result, the integer term FC_INTE should be reduced by 1. Example: a total desired divide ratio of N = 60.135 should be implemented as FC_INTE = 59, FC_FRAC/2^19 = 1.135. Modifying this property will have no effect until the chip exits from TX or RX state, and then re-enters the state.
  477. //   FREQ_CONTROL_FRAC_2 - Please refer to the text description for FREQ_CONTROL_INTE for more details regarding frequency calculation.
  478. //   FREQ_CONTROL_FRAC_1 - Please refer to the text description for FREQ_CONTROL_INTE for more details regarding frequency calculation.
  479. //   FREQ_CONTROL_FRAC_0 - Please refer to the text description for FREQ_CONTROL_INTE for more details regarding frequency calculation.
  480. //   FREQ_CONTROL_CHANNEL_STEP_SIZE_1 - The EZ Frequency Programming method allows the user to control the frequency by selecting a desired channel number, given a base frequency and a channel step size. This property defines Byte 1 of the unsigned 16-bit channel step size value. The units of the FREQ_CONTROL_CHANNEL_STEP_SIZE_1/0 property are in increments of the LSB tuning resolution of the PLL Synthesizer, and are therefore a function of the crystal reference frequency and output frequency band. The formula for calculating the value of the FREQ_CONTROL_CHANNEL_STEP_SIZE property is given by the following equation: The base frequency is specified by the FREQ_CONTROL_INTE and FREQ_CONTROL_FRAC_2/1/0 properties. The channel number is specified by the CHANNEL parameter byte passed to the START_TX command. The commanded channel frequency is given by the formula:
  481. //   FREQ_CONTROL_CHANNEL_STEP_SIZE_0 - The EZ Frequency Programming method allows the user to control the frequency by selecting a desired channel number, given a base frequency and a channel step size. This property defines Byte 0 of the unsigned 16-bit channel step size value. Please refer to the text description for FREQ_CONTROL_CHANNEL_STEP_SIZE_1 for more details regarding the channel step size function.
  482. //   FREQ_CONTROL_W_SIZE - The chip performs a calibration of the VCO at each new commanded frequency. This is accomplished by counting cycles of the VCO frequency and comparing to an expected target count value. The length of the window during which cycles of the VCO frequency are counted is specified by this property. The units are in cycles of the crystal reference frequency (e.g., 30 MHz clock periods). This property does not need to change as a function of crystal reference frequency; the chip automatically calculates the target VCO count value as a function of crystal reference frequency and thus this property may remain constant. Silicon Labs recommends setting this property always to 0x20.
  483. //   FREQ_CONTROL_VCOCNT_RX_ADJ - The chip performs a calibration of the VCO at each new commanded frequency. This is accomplished by counting cycles of the VCO frequency and comparing to an expected target count value. As the chip's default mode of operation uses a low-IF architecture with low-side Mixer injection, the RX LO must shift downwards in frequency during RX mode. The expected target count value changes as a result of this shift in frequency. This field is a signed value that represents the amount by which the target count value must be adjusted in RX mode.
  484. */
  485. #define RF_FREQ_CONTROL_INTE_8 0x11, 0x40, 0x08, 0x00, 0x38, 0x0D, 0xDD, 0xDD, 0x44, 0x44, 0x20, 0xFE //工作頻段設置0X4000

  486. // AUTOMATICALLY GENERATED CODE!
  487. // DO NOT EDIT/MODIFY BELOW THIS LINE!
  488. // --------------------------------------------
  489. #ifndef FIRMWARE_LOAD_COMPILE
  490. #define RADIO_CONFIGURATION_DATA_ARRAY { \
  491.         0x07, RF_POWER_UP, \
  492.         0x07, RF_GPIO_PIN_CFG, \
  493.         0x05, RF_GLOBAL_XO_TUNE_1, \
  494.         0x05, RF_GLOBAL_CONFIG_1, \
  495.         0x08, RF_INT_CTL_ENABLE_2, \
  496.         0x08, RF_FRR_CTL_A_MODE_4, \
  497.         0x0D, RF_PREAMBLE_TX_LENGTH_9, \
  498.         0x09, RF_SYNC_CONFIG_5, \
  499.         0x05, RF_PKT_CRC_CONFIG_1, \
  500.         0x05, RF_PKT_CONFIG1_1, \
  501.         0x07, RF_PKT_LEN_3, \
  502.         0x10, RF_PKT_FIELD_1_LENGTH_12_8_12, \
  503.         0x0C, RF_PKT_FIELD_4_LENGTH_12_8_8, \
  504.         0x10, RF_MODEM_MOD_TYPE_12, \
  505.         0x05, RF_MODEM_FREQ_DEV_0_1, \
  506.         0x0C, RF_MODEM_TX_RAMP_DELAY_8, \
  507.         0x0D, RF_MODEM_BCR_OSR_1_9, \
  508.         0x0B, RF_MODEM_AFC_GEAR_7, \
  509.         0x05, RF_MODEM_AGC_CONTROL_1, \
  510.         0x0D, RF_MODEM_AGC_WINDOW_SIZE_9, \
  511.         0x0F, RF_MODEM_OOK_CNT1_11, \
  512.         0x05, RF_MODEM_RSSI_COMP_1, \
  513.         0x05, RF_MODEM_CLKGEN_BAND_1, \
  514.         0x10, RF_MODEM_CHFLT_RX1_CHFLT_COE13_7_0_12, \
  515.         0x10, RF_MODEM_CHFLT_RX1_CHFLT_COE1_7_0_12, \
  516.         0x10, RF_MODEM_CHFLT_RX2_CHFLT_COE7_7_0_12, \
  517.         0x08, RF_PA_MODE_4, \
  518.         0x0B, RF_SYNTH_PFDCP_CPFF_7, \
  519.         0x10, RF_MATCH_VALUE_1_12, \
  520.         0x0C, RF_FREQ_CONTROL_INTE_8, \
  521.         0x00 \
  522. }
  523. #else
  524. #define RADIO_CONFIGURATION_DATA_ARRAY { 0 }
  525. #endif
  526. // DEFAULT VALUES FOR CONFIGURATION PARAMETERS
  527. #define RADIO_CONFIGURATION_DATA_RADIO_XO_FREQ_DEFAULT                     30000000L
  528. #define RADIO_CONFIGURATION_DATA_CHANNEL_NUMBER_DEFAULT                    0x00
  529. #define RADIO_CONFIGURATION_DATA_RADIO_PACKET_LENGTH_DEFAULT               0x10
  530. #define RADIO_CONFIGURATION_DATA_RADIO_STATE_AFTER_POWER_UP_DEFAULT        0x01
  531. #define RADIO_CONFIGURATION_DATA_RADIO_DELAY_CNT_AFTER_RESET_DEFAULT       0x1000
  532. #define RADIO_CONFIGURATION_DATA_CUSTOM_PAYLOAD_DEFAULT        0x42, 0x55, 0x54, 0x54, 0x4F, 0x4E, 0x31 // BUTTON1
  533. #define RADIO_CONFIGURATION_DATA_RADIO_PATCH_INCLUDED                      0x00
  534. #define RADIO_CONFIGURATION_DATA_RADIO_PATCH_SIZE                          0x00
  535. #define RADIO_CONFIGURATION_DATA_RADIO_PATCH                               {  }
  536. #ifndef RADIO_CONFIGURATION_DATA_ARRAY
  537. #error "This property must be defined!"
  538. #endif
  539. #ifndef RADIO_CONFIGURATION_DATA_RADIO_XO_FREQ
  540. #define RADIO_CONFIGURATION_DATA_RADIO_XO_FREQ         { RADIO_CONFIGURATION_DATA_RADIO_XO_FREQ_DEFAULT }
  541. #endif
  542. #ifndef RADIO_CONFIGURATION_DATA_CHANNEL_NUMBER
  543. #define RADIO_CONFIGURATION_DATA_CHANNEL_NUMBER        { RADIO_CONFIGURATION_DATA_CHANNEL_NUMBER_DEFAULT }
  544. #endif
  545. #ifndef RADIO_CONFIGURATION_DATA_RADIO_PACKET_LENGTH
  546. #define RADIO_CONFIGURATION_DATA_RADIO_PACKET_LENGTH   { RADIO_CONFIGURATION_DATA_RADIO_PACKET_LENGTH_DEFAULT }
  547. #endif
  548. #ifndef RADIO_CONFIGURATION_DATA_RADIO_STATE_AFTER_POWER_UP
  549. #define RADIO_CONFIGURATION_DATA_RADIO_STATE_AFTER_POWER_UP  { RADIO_CONFIGURATION_DATA_RADIO_STATE_AFTER_POWER_UP_DEFAULT }
  550. #endif
  551. #ifndef RADIO_CONFIGURATION_DATA_RADIO_DELAY_CNT_AFTER_RESET
  552. #define RADIO_CONFIGURATION_DATA_RADIO_DELAY_CNT_AFTER_RESET { RADIO_CONFIGURATION_DATA_RADIO_DELAY_CNT_AFTER_RESET_DEFAULT }
  553. #endif
  554. #ifndef RADIO_CONFIGURATION_DATA_CUSTOM_PAYLOAD
  555. #define RADIO_CONFIGURATION_DATA_CUSTOM_PAYLOAD        { RADIO_CONFIGURATION_DATA_CUSTOM_PAYLOAD_DEFAULT }
  556. #endif
  557. #define RADIO_CONFIGURATION_DATA { \
  558.                             Radio_Configuration_Data_Array,                            \
  559.                             RADIO_CONFIGURATION_DATA_CHANNEL_NUMBER,                   \
  560.                             RADIO_CONFIGURATION_DATA_RADIO_PACKET_LENGTH,              \
  561.                             RADIO_CONFIGURATION_DATA_RADIO_STATE_AFTER_POWER_UP,       \
  562.                             RADIO_CONFIGURATION_DATA_RADIO_DELAY_CNT_AFTER_RESET,       \
  563.                             RADIO_CONFIGURATION_DATA_CUSTOM_PAYLOAD                   \
  564.                             }
  565. #endif /* RADIO_CONFIG_H_ */
  566. /************************************************************************************************************/
復制代碼
回復

使用道具 舉報

板凳
ID:76619 發表于 2015-4-10 20:42 | 只看該作者
這么復雜嗎,有keil的程序嗎
回復

使用道具 舉報

地板
ID:225832 發表于 2017-8-8 17:42 | 只看該作者
請問一下,你這個程序中的RSSI是當前的,還是latch的
回復

使用道具 舉報

5#
ID:1023716 發表于 2023-1-16 16:46 | 只看該作者
寡人正在學習STM8S, 這個對我來說是個好東西, 樓主在深圳嗎? 寡人想當面請求.或有其它聯系方法,那樣也可以遠程求教.
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 一级黄色夫妻生活 | 国产精品亚洲综合 | 亚洲一区中文字幕在线观看 | 久久综合一区 | 久久久成人一区二区免费影院 | 成人特级毛片 | 欧美国产视频 | 欧美成人精品一区二区三区 | 成人中文网 | 99精品电影 | 成人乱人乱一区二区三区软件 | 亚洲精品乱码久久久久v最新版 | 国产精品麻 | 亚洲国产成人精品久久久国产成人一区 | 国产精品自拍视频网站 | a级在线观看 | 亚洲免费一 | 综合在线视频 | 麻豆久久久久久久久久 | 中文在线一区二区 | 欧美日韩国产精品激情在线播放 | 中文无吗 | 天天操天天拍 | 日本精品视频在线观看 | 精品久久ai电影 | 久久精品国产99国产精品 | 97日韩精品 | 中文字幕第一页在线 | 97高清国语自产拍 | 国产精品国产精品国产专区不蜜 | 蜜桃av鲁一鲁一鲁一鲁 | av一区二区三区四区 | 亚洲一区二区三区免费在线观看 | 可以看黄的视频 | 超碰97在线免费 | 在线国产一区 | 蜜桃av一区二区三区 | 精品久久久久久亚洲综合网 | 国产精品成人在线 | av天天看 | 91观看|