基于ARM嵌入式的以太网冗余通信程序设计毕业论文
2021-03-23 22:45:52
摘 要
本文针对数据采集系统设计了两种冗余通信方式,即热备份方式和同时运行方式,完成了系统试验板的硬件设计以及软件编写。在硬件上,采用STM32F407作为处理器,以太网通信模块选择WIZnet生产的W5500芯片,系统板上搭载了一路ADC作为数据采集的示例,采用DMA(Direct Memory Access,直接内存存取)读到STM32内存二维数组gDATABUF中。
在软件设计上,需要分别初始化两个SPI接口和两路W5500芯片,采用同时运行方式或者热备份方式发送gDATABUF中的数据。除此之外,还需要编写处理W5500芯片中断引脚和复位引脚的代码,以及系统板上的LED和BEEP等器件驱动。
研究结果表明:采用热备份方式和同时运行方式各有优缺点,在强调数据传输稳定可靠的情况下可选择同时运行方式,而热备份方式在保证一定的数据冗余安全的同时减少了功耗。
本文的特色:本文介绍的试验板是冗余通信的最小系统,只搭载了一路ADC用于数据采集,可根据需要增添功能模块,而以太网冗余通信模块可直接移植使用,本文也对W5500的寄存器和软件驱动进行了详细介绍。
关键词:以太网;冗余通信;ARM嵌入式;W5500程序
Abstract
In this paper, two kinds of redundant communication methods, namely the hot backup mode and the simultaneous operation mode, are designed for data acquisition system, and the hardware design and software writing of the system test board are completed. In the hardware, Used STM32F407 as a processor, Ethernet communication module selected WIZnet production W5500 chip, the system board equipped with one ADC as an example of data acquisition,and using DMA (Direct Memory Access) read to STM32 memory gDATABUF(Two-dimensional array).
In the software design, we need to initialize the two SPI interface and two W5500 chip, using the simultaneous operation mode or the hot backup mode to send gDATABUF data. In addition, need to write code dealing with W5500 chip interrupt pin and the reset pin, as well as LEDamp;BEEP and other device drivers in the system board.
The results show that the advantages and disadvantages of the hot backup mode and the simultaneous operation mode which can be chosen while the data transmission must be stable and reliable. The hot backup mode can reduce the power consumption while ensuring the redundancy of the data comparing with the simultaneous operation mode.
The characteristics of this paper: the test board describing in this paper is the smallest redundant communication system, only equipped with one ADC for data collection, depending on the need to add functional modules, Ethernet redundant communication module can be directly transplanted, this article is also describing in detail on the W5500’s register and the software driver.
Key Words: Ethernet;redundant communication;ARM embedded
目 录
摘 要 I
Abstract II
目 录 III
第一章 绪论 1
1.1研究背景及意义 1
1.2 国内外研究现状分析 1
1.2.1 国内研究现状分析 1
1.2.2 国外研究现状分析 2
1.3本论文的主要研究内容 3
第二章 以太网通信原理 5
2.1 以太网介绍 5
2.2 W5500芯片介绍 8
2.2.1 SPI数据帧读写 9
2.2.2 W5500寄存器介绍 13
第三章 以太网冗余通信硬件设计 19
3.1 W5500硬件电路 19
3.2 试验板外围电路 21
3.2.1 STM32.SchDoc 22
3.2.2 Source.SchDoc 23
3.2.3 USB-COMamp;BOOT.SchDoc 26
第四章 以太网冗余通信软件设计 29
4.1 试验板软件环境 29
4.1.1 beep.c和led.c 31
4.1.2 adc.c和dma.c 33
4.1.3中断寄存器解析以及exti.c 34
4.2 W5500官方驱动解析 41
4.2.1 内存读写解析 41
4.2.2 wizchip_conf.c 44
4.2.3 W5500.c 47
4.2.4 socket.c 50
4.3 以太网通信顶层函数 52
4.3.1 spi.c 52
4.3.2 net.c及两种冗余通信方案 56
4.3.3 main.c 65
4.3.4 移植到W5200芯片仿真细节及启发 66
总结与展望 69
参考文献 70
致 谢 72