2.4G-多对1通信

引脚:

NRF-CE:RX或TX模式选择

CSN:SPI片选信号  初始化需要推挽输出 置高电平 因为低电平有效

SCK:SPI时钟

MOSI:从SPI数据输入引脚

MISO:SPI数据输出引脚

IRQ:可屏蔽中断脚

不同板子的引脚


2.4G-多对1通信_第1张图片


2.4G-多对1通信_第2张图片

NRF24L01最多可以发一收。

数据通道0有40位可配置地址,数据通道1-5的地址:32位公用的+各自的(最低位)

例如:

const u8 TX_ADDRESS0[TX_ADR_WIDTH]=   {0x01,0x43,0x10,0x10,0x01};

const u8 RX_ADDRESS0[RX_ADR_WIDTH]=   {0x01,0x43,0x10,0x10,0x01};

const u8 RX_RX_ADDRESS0[RX_ADR_WIDTH]={0x01,0x43,0x10,0x10,0x01};




const u8 TX_ADDRESS1[TX_ADR_WIDTH]=  {0x02,0x43,0x10,0x10,0x01};

const u8 RX_ADDRESS1[RX_ADR_WIDTH]=  {0x02,0x43,0x10,0x10,0x01};

const u8 RX_RX_ADDRESS1[RX_ADR_WIDTH]={0x02,0x43,0x10,0x10,0x01};

数组的TX_ADDRESS1【】的最高位为发送寄存器的最低位


2.4G-多对1通信_第3张图片
                                                                                                                                       

不同的通道更改一下第一位即可

数据包识别和CRC校验

发送方:每发送一包新的数据则发送方的PID值加一

接收方:接收的PID包与上一包进行比较,相同确认CRC的值与上一次的包相等?相同则舍弃

接受模式:

                 写RX-ADDR-P0                           5位                    数据通道地址

                  写RX-PW-P0                               32位                     写数据有效宽度

                  再写入其他通道同上,

                  写EN-AA                                     0x3f                       选择所有的通道

                   写EN-RXADDR                             0x3f                   所有通道都允许自动接受

                  写RF-CN                                         40                        射频设置

                  写Config(第0位的最后4位)                配置接受模式

发送模式:

                  写TX-ADDR                             5位                                   发送地址0

                写RX-ADDR-P0                          32位                               接受地址0

                 发送其他通道 同上更改即可,只能发送一个通道的,

         不同于接受       SETUP-RETR                 0x1a                           自动重发 ,重发延时及次数

                RF-SETUP                                 0x0f                                射频设置

                RF-Config                            0x0e                                       发送模式


 u8 careg【1】

2.4G-多对1通信_第4张图片


2.4G-多对1通信_第5张图片

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              

2.4G-多对1通信_第6张图片


2.4G能通信条件:

SPI配置相同

数据位数相同

通道相同包括接受地址等

射频相同

引脚配置没错,

你可能感兴趣的:(2.4G-多对1通信)