johnny_dxj 发表于 2012-7-31 10:55:31

我在调试CC1100地址校验不起作用

本帖最后由 johnny_dxj 于 2012-7-31 11:01 编辑

我在调试CC1100E时,碰到个其怪问题,地址校验功能不起作用(无论什么地址,都能收到对方发来的包),请用过的朋友指点下,寄成存器如下:
#define IOCFG0       0x06    //GDO0 configuration
#define FIFOTHR   0x07    //RX attenuation and RXFIFO,TXFIFO threshold config
#define PKTLEN       0x3C    //Max use active date(not include sync.crc.ext...
#define PKTCTRL1   0x05    //Data frame mesg.eg add two stae and rssi,address check
#define PKTCTRL0   0x05    //Packet Automation Control eg.frame lenth
#define ADDR         0x01    //Unit address----(注目前测试一台为01,另一台为02)
#define CHANNR   0x01    //Physical Channel ----

以下是发送程序:Tx_buffer首字节为目标板地址
void Spi_Write_Packet(unsigned char *Tx_buffer,unsigned char size)
{   
   unsigned char i;
   Spi_Write_Byte(CC_TXFIFO,size);             //Write size to TXFIFO
   Spi_Write_Burst(CC_TXFIFO,Tx_buffer,size);//Write daat to TXFIFO
   Spi_Write_Strobe(CC_STX);                  //Start transmit   
   i = 0;
   
   while (GDO0_L)                                     //Wait GDO0 to be set
   {
      if (i > 10) break;                              //Overtime jump out---------------------
      delay_us(300);                              
      i++;                                       
   }
   i = 0;   
   while (GDO0_H)                                 //Wait GDO0 to be clear
   {
      if (i > 10) break;                               //Overtime jump out-------------------------
      delay_us(300);                           
      i++;                                    
   }
   delay_us(300);                                     //May be remove TBD test----------------------
   Spi_Write_Strobe(CC_SFTX);               //Clear TXFIFO
   Spi_Write_Strobe(CC_SIDLE);                //Go to sidle
   Spi_Write_Strobe(CC_SRX);                   //Go to RX mode
}

在中断接收中调用以下子程序:
//************************************************************//Spi_Read_Packet sub.
//Function name:Spi_Read_Packet                                 
//Input parameter:store_addr,read_byte_count                              
//Output parameter:Non                                          
//Function description:Spi_Read_Packet
unsigned char Spi_Read_Packet(unsigned char *Rx_buffer,unsigned char length)
{
   unsigned char status;
   unsigned char size = 0;      
   delay_us(300);                              //TBD test------------------------------
   size = Spi_Read_Byte(CC_RXFIFO);            //Read RXFIFO data count
         
   if ((size < length)&&size)
   {
      Spi_Read_Burst(CC_RXFIFO,Rx_buffer,size);//Read RXFIFO
      Spi_Read_Burst(CC_RXFIFO,status,2);      //Read CRC
页: [1]
查看完整版本: 我在调试CC1100地址校验不起作用