关于24L01多对一通信的调试问题

2020-01-27 11:35发布

本帖最后由 lijinhong190 于 2012-10-16 21:26 编辑

最近在调24L01的多对一通信,在调试过程中第一第二路可以调通,实现正常的无线通信,但是第三、四、五、六路就一直调不通,按资料手册上说是只要发射和接收的地址一致就可以,但是很奇怪一换到第三、四、五、六路地址通信就不行了,很是不解,想问下各位大神问题出在哪里?或者求指教24L01的多对一通信应该如何设置。
真心求教,万分感激!


附上我的程序地址码部分:
//PI   0
uchar const TX_ADDRESS[TX_ADR_WIDTH]  = {0x34,0x43,0x10,0x10,0x01};  // Define a static TX address
//PI  1
uchar const TX_ADDRESS[TX_ADR_WIDTH]  = {0xc2,0xc2,0xc2,0xc2,0xc1};// Define a static TX address
//PI 2
//uchar const TX_ADDRESS[TX_ADR_WIDTH]  =  {0xc2,0xc2,0xc2,0xc2,0xc2};// Define a static TX address
//PI 3
//uchar const TX_ADDRESS[TX_ADR_WIDTH]  = {0xc2,0xc2,0xc2,0xc2,0xc3};// Define a static TX address
//PI 4
//uchar const TX_ADDRESS[TX_ADR_WIDTH]  = {0xc2,0xc2,0xc2,0xc2,0xc4};// Define a static TX address
//PI 5
//uchar const TX_ADDRESS[TX_ADR_WIDTH]  = {0xc2,0xc2,0xc2,0xc2,0xc5};// Define a static TX address

/*
uchar const RxAddr0[5] = {0x34,0x43,0x10,0x10,0x01}; // Define a static TX address
uchar const RxAddr1[5] = {0xc2,0xc2,0xc2,0xc2,0xc1};
uchar const RxAddr2[5] = {0xc2,0xc2,0xc2,0xc2,0xc2};
uchar const RxAddr3[5] = {0xc2,0xc2,0xc2,0xc2,0xc3};
uchar const RxAddr4[5] = {0xc2,0xc2,0xc2,0xc2,0xc4};
uchar const RxAddr5[5] = {0xc2,0xc2,0xc2,0xc2,0xc5};

void RX_Mode(void)
{
        CE=0;
          SPI_Write_Buf(WRITE_REG + RX_ADDR_P0, TX_ADDRESS, TX_ADR_WIDTH); // Use the same address on the RX device as the TX device

          SPI_RW_Reg(WRITE_REG + EN_AA, 0x01);      // Enable Auto.Ack:Pipe0
          SPI_RW_Reg(WRITE_REG + EN_RXADDR, 0x01);  // Enable Pipe0
          SPI_RW_Reg(WRITE_REG + RF_CH, 40);        // Select RF channel 40
          SPI_RW_Reg(WRITE_REG + RX_PW_P0, TX_PLOAD_WIDTH); // Select same RX payload width as TX Payload width
          SPI_RW_Reg(WRITE_REG + RF_SETUP, 0x07);   // TX_PWR:0dBm, Datarate:2Mbps, LNA:HCURR
          SPI_RW_Reg(WRITE_REG + CONFIG, 0x0f);     // Set PWR_UP bit, enable CRC(2 bytes) & Prim:RX. RX_DR enabled..

          CE = 1; // Set CE pin high to enable RX device


}

/**************************************************/

void TX_Mode(void)
{
        CE=0;
       
          SPI_Write_Buf(WRITE_REG + TX_ADDR, TX_ADDRESS, TX_ADR_WIDTH);    // Writes TX_Address to nRF24L01
          SPI_Write_Buf(WRITE_REG + RX_ADDR_P0, TX_ADDRESS, TX_ADR_WIDTH); // RX_Addr0 same as TX_Adr for Auto.Ack
          SPI_Write_Buf(WR_TX_PLOAD, tx_buf, TX_PLOAD_WIDTH); // Writes data to TX payload

          SPI_RW_Reg(WRITE_REG + EN_AA, 0x01);      // Enable Auto.Ack:Pipe0
          SPI_RW_Reg(WRITE_REG + EN_RXADDR, 0x01);  // Enable Pipe0
          SPI_RW_Reg(WRITE_REG + SETUP_RETR, 0x1a); // 500us + 86us, 10 retrans...
          SPI_RW_Reg(WRITE_REG + RF_CH, 40);        // Select RF channel 40
          SPI_RW_Reg(WRITE_REG + RF_SETUP, 0x07);   // TX_PWR:0dBm, Datarate:2Mbps, LNA:HCURR
          SPI_RW_Reg(WRITE_REG + CONFIG, 0x0e);     // Set PWR_UP bit, enable CRC(2 bytes) & Prim:TX. MAX_RT & TX_DS enabled..
        CE=1;
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。