射频模块的控制与通讯软件设计

本次毕业设计使用了两个NRF24L01射频模块,两个ARM7系列的LPC2138微型计算芯片,外围电路一共使用了三百多个电子元器件。


摘要:无线射频技术是世界进入信息化时代后,构建起设备与设备之间信息传输的最重要技术。虽然国际上对大部分波段的通讯频率的使用需要申请许可证,但2.4GHz到2.5GHz的频率允许任何人免费使用。由讯通公司设计的Nrf24L01射频模块兼备低成本、体积小、通讯稳定、多通道同时工作的优点,使得MCU实现更多特殊环境下的需要。

该毕业设计将射频模块连接至ARM7芯片,并将测试程序烧录至ARM中以检测两个模块之间的工作状态,比如是否发射成功、是否接收的到数据、数据是否出现乱码情况。

对模块进行编程时,需对发射和接受分别设计。本论文除了对模块以及所使用的单片机进行简单讲解,还对两部分程序的设计思路进行讲解,其中包括重要的函数定义和两种模式下的主函数。

关键词  射频  通讯  ARM7   编程

毕业设计说明书外文摘要

Title  Design of Control and Communication Software for RF Module                    

Abstract:Radio frequency technology is the world into the information age, to build equipment and equipment between the most important information transmission technology. Although the international use of communication frequencies for most bands requires a license, the frequency of 2.4 GHz to 2.5 GHz allows anyone to use it for free. Nrf24L01 RF module designed by XunTong Company has the advantages of low cost, small size, stable communication and multi-channel working at the same time, which makes the MCU realize more special environment.

The graduation design connects the RF module to the ARM7 chip and logs the test program to the ARM to detect the working status between the two modules, such as whether the transmission is successful, whether the data is received, and the data is garbled.

When programming a module, the transmitter and receiver are designed separately. In addition to the module and the use of the microcontroller for a simple explanation, but also on the two parts of the program to explain the design ideas, including important function definition and the main function of the two models.

Keywords  Radio  communication  ARM7   programming

目   次

1  引言 2

1.1  选题背景 2

1.2  研究现状 3

2  LPC2138微处理器 5

2.1 微处理器特性概述 5

2.2 LPC2138功能概述 5

3 nRF24L01射频模块 7

3.1 模块概述 7

3.2 工作模式 7

3.3 工作模式的转换 9

3.4 SPI接口工作时序 9

3.5 射频模块内部结构及外部管脚 10

3.6 数据包识别和CRC校验 11

4 NRF24L01初始化程序 13

4.1 接收函数 RX_Mode 13

4.2发射模式 TX_Mode() 14

4.3延时函数 DelayMS 15

4.4 射频模块初始化函数 15

4.5 SPI通讯函数 SPI_RW() 15

4.6 配置reg寄存器SPI_RW_Reg() 16

4.7 读数据函数 SPI_Read() 17

4.8 接收端从NRF24L01读数据 SPI_Read_Buf() 17

4.9 发射端写数据至NRF24L01 SPI_Write_Buf() 18

4.10 自动应道函数 Check_ACK() 19

4.11 接收端检测状态寄存器 RF_RxPacket() 20

4.12 管脚配置与实物连接 21

5 实验结果 22

5.1 接收模式下射频模块的管脚信号 22

5.2 发射模式下射频模块的管脚信号 23

5.3 通讯流程图 23

5.4 射频通讯成功 24

结  论 26

致  谢 26

参 考 文 献 27

附录A  NRF24L01寄存器配置 28

1  引言

射频技术进入中国市场已经有一些年头了,随着应用的逐渐深入,越来越多的产品开始引入射频技术,增加无线通信功能,并且在嵌入式系统设计和开发领域取得不小的成就。NRF24L01是讯通公司设计的一款具有低成本、高稳定性能特点的无线射频芯片,一般外接在MCU上使用。本毕设采用ARM7系列的LPC2138处理器,其具有内核耗电少、低成本、功能强、16/32位指令集的优点广泛应用于汽车电子、安保设备、无线通信、便携式电子产品、游戏机、数码相机、GPS、智能手机的开发领域。通过检测管脚信号与串口通信的数据来实现射频的正常工作。