CN102158882B - Two-channel data detection and protocol analysis meter based on 6LowPAN and method - Google Patents

Two-channel data detection and protocol analysis meter based on 6LowPAN and method Download PDF

Info

Publication number
CN102158882B
CN102158882B CN201110140443.7A CN201110140443A CN102158882B CN 102158882 B CN102158882 B CN 102158882B CN 201110140443 A CN201110140443 A CN 201110140443A CN 102158882 B CN102158882 B CN 102158882B
Authority
CN
China
Prior art keywords
data
wireless
channel
frame
6lowpan
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201110140443.7A
Other languages
Chinese (zh)
Other versions
CN102158882A (en
Inventor
谢昊飞
王平
沈杰
陈庆华
陆楠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chongqing University of Post and Telecommunications
Original Assignee
Chongqing University of Post and Telecommunications
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chongqing University of Post and Telecommunications filed Critical Chongqing University of Post and Telecommunications
Priority to CN201110140443.7A priority Critical patent/CN102158882B/en
Publication of CN102158882A publication Critical patent/CN102158882A/en
Application granted granted Critical
Publication of CN102158882B publication Critical patent/CN102158882B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Mobile Radio Communication Systems (AREA)

Abstract

本发明请求保护一种基于6LowPAN的两信道数据检测与协议分析仪及方法,涉及无线传感器网络技术领域。该分析仪包括无线数据采集模块和上位机解码分析部分,无线RF收发器1和无线RF收发器2,持续监听信道是否有无线数据报文,主控制器对数据报文进行封装报文头和信道号,上传到上位机;上位机数据处理模块根据接收的数据报文的MAC层报文头的帧控制域中的帧类型子段确定帧类型,若为6LowPAN数据包,将6LowPAN数据包的协议报头根据6LowPAN协议模型的协议规则逐层解析,并进行分析统计送入人机界面显示。

The invention claims protection of a 6LowPAN-based two-channel data detection and protocol analyzer and method, and relates to the technical field of wireless sensor networks. The analyzer includes a wireless data acquisition module and an upper computer decoding analysis part, a wireless RF transceiver 1 and a wireless RF transceiver 2, and continuously monitors whether there is a wireless data message in the channel, and the main controller encapsulates the data message header and The channel number is uploaded to the upper computer; the upper computer data processing module determines the frame type according to the frame type subsection in the frame control domain of the MAC layer header of the received data message, if it is a 6LowPAN data packet, the 6LowPAN data packet The protocol header is analyzed layer by layer according to the protocol rules of the 6LowPAN protocol model, and the analysis and statistics are sent to the man-machine interface for display.

Description

一种基于6LowPAN的两信道数据检测与协议分析仪及方法A 6LowPAN-based two-channel data detection and protocol analyzer and method

技术领域 technical field

本发明涉及无线传感器网络技术领域,尤其针对于6LowPAN(IPv6 over LR_WPAN,简称6LowPAN)的无线传感器网络的数据检测、协议分析。 The present invention relates to the technical field of wireless sensor networks, especially for data detection and protocol analysis of 6LowPAN (IPv6 over LR_WPAN, referred to as 6LowPAN) wireless sensor networks.

背景技术 Background technique

随着无线通信技术在工业控制领域的快速发展,产生了一种面向设备间信息交互的工业无线通信技术。在对无线传感技术的研发和测试中,都要求对无线传感器网络中的设备之间进行数据检测和协议分析。 With the rapid development of wireless communication technology in the field of industrial control, an industrial wireless communication technology for information interaction between devices has emerged. In the research and development and testing of wireless sensor technology, data detection and protocol analysis between devices in the wireless sensor network are required.

通讯网络协议分析设备有很多,主要是对协议进行分析,为网络系统的可靠性和稳定性提供具体的数据支持。但是当前的协议分析仪存在较多缺陷。首先,如最常用的就是嗅探器,主要是对网络状态和数据流动进行监视,并且是单一信道的监测,缺乏对无线传感网进行检测。其次,现有对无线传感网的协议主要是针对单一协议ZigBee进行检测和分析,缺乏可扩展性。再次,IPv6技术在无线传感网中的渗透,对新的无线传感网技术基于IEEE802.15.4实现IPv6通信的6LowPAN进行检测和分析,需要新的数据检测和协议分析,来为6LowPAN开发和研究提供可靠的数据支持。因此,传统的分析仪不能满足新技术的需求,需要更新数据检测和协议分析技术。 There are many communication network protocol analysis devices, mainly to analyze the protocol and provide specific data support for the reliability and stability of the network system. However, current protocol analyzers have many defects. First of all, the most commonly used one is the sniffer, which mainly monitors the network status and data flow, and it is a single channel monitoring, which lacks the detection of the wireless sensor network. Secondly, the existing protocols for wireless sensor networks are mainly for the detection and analysis of the single protocol ZigBee, which lacks scalability. Thirdly, the penetration of IPv6 technology in the wireless sensor network, the detection and analysis of the new wireless sensor network technology based on IEEE802.15.4 to achieve IPv6 communication 6LowPAN requires new data detection and protocol analysis to develop and research for 6LowPAN Provide reliable data support. Therefore, traditional analyzers cannot meet the needs of new technologies, and it is necessary to update data detection and protocol analysis technologies.

发明内容 Contents of the invention

为解决现有技术中存在的上述技术问题,本发明提出一种基于6LowPAN的两信道数据检测与协议分析仪(以下简称“分析仪”)。该分析仪基于USB接口的多功能分析仪。该分析仪能自配置两信道,对无线传感网数据报文进行同时检测,并对协议数据报文进行解码分析。支持兼容对ZigBee协议分析和可扩展对WIA-PA、ISA100.11a报文的检测和解码分析。 In order to solve the above-mentioned technical problems in the prior art, the present invention proposes a 6LowPAN-based two-channel data detection and protocol analyzer (hereinafter referred to as "analyzer"). The analyzer is a multifunction analyzer based on USB interface. The analyzer can self-configure two channels, simultaneously detect the wireless sensor network data message, and decode and analyze the protocol data message. Support compatible ZigBee protocol analysis and expandable detection and decoding analysis of WIA-PA and ISA100.11a messages.

本数据检测与协议分析仪,包括两部分:无线数据采集模块部分、上位机解码分析部分。无线数据采集模块由主控制器、2.4GHz无线射频接收器模块1、2.4GHz无线射频接收器模块2、USB接口模块、电源管理模块组成。上位机解码分析部分包括系统设置模块、数据处理模块和人机界面,主控制器通过同步串行端口控制器的两个串行外围设备接口进行总线操作,分别控制无线RF接收器1和无线RF收发器2,通过不断轮询持续监听信道是否有无线数据报文,并把有效的数据报文存储在各自的无线RF收发器的数据缓存中,主控制器对数据报文封装报文头和信道号,上传到上位机;上位机解码分析部分数据解析模块对检测到的数据包进行解码分析,按照其协议类型解析后,将解析的数据报文送数据显示模块,系统设置部分通过串口下发命令修改接收数据报文的信道。所述轮询持续监听信道是否有无线数据报文具体包括,通过两个无线射频接收器对16个原始信道序列表进行轮询扫描,在扫描每个信道时,当监测每个信道数据的最大时间值内仍没有数据报文,按照原始信道序列表自动切换到相邻的下一个信道号。对检测到的数据包进行解码分析具体为,上位机数据处理模块根据接收的数据报文的MAC层报文头的帧控制域中的帧类型子段确定帧类型。若接收到的MAC层报文头是MAC命令帧和信标帧,则该数据包是WIA-PA或ZigBee的数据包;若是报文头是数据帧,则是6LowPAN、ISA100.11a、WIA-PA和ZigBee中之一的数据包,则优先采用6LowPAN协议模型的协议规则逐层解析。 This data detection and protocol analyzer includes two parts: the wireless data acquisition module part, and the upper computer decoding analysis part. The wireless data acquisition module is composed of a main controller, a 2.4GHz wireless radio frequency receiver module 1, a 2.4GHz wireless radio frequency receiver module 2, a USB interface module, and a power management module. The upper computer decoding and analysis part includes system setting module, data processing module and man-machine interface. The main controller performs bus operation through the two serial peripheral device interfaces of the synchronous serial port controller, and controls the wireless RF receiver 1 and the wireless RF receiver respectively. Transceiver 2, by constantly polling whether there is a wireless data message in the continuous monitoring channel, and storing the effective data message in the data cache of the respective wireless RF transceiver, the main controller encapsulates the header and the data message of the data message The channel number is uploaded to the host computer; the data analysis module of the decoding analysis part of the host computer decodes and analyzes the detected data packets, and after analyzing according to the protocol type, sends the analyzed data message to the data display module, and the system setting part downloads it through the serial port. Send commands to modify the channel for receiving data packets. Whether the polling continuous monitoring channel has a wireless data message specifically includes, polling and scanning the 16 original channel sequence tables through two radio frequency receivers, and when scanning each channel, when monitoring the maximum of each channel data If there is still no data message within the time value, it will automatically switch to the next adjacent channel number according to the original channel sequence table. Decoding and analyzing the detected data packets specifically includes that the data processing module of the upper computer determines the frame type according to the frame type subsection in the frame control field of the MAC layer header of the received data message. If the received MAC layer header is a MAC command frame and a beacon frame, the data packet is a WIA-PA or ZigBee data packet; if the header is a data frame, it is 6LowPAN, ISA100.11a, WIA-PA and one of the data packets in ZigBee, the protocol rules of the 6LowPAN protocol model are preferentially analyzed layer by layer.

本发明还提出一种基于6LowPAN的两信道数据检测与协议分析方法,其特征在于,无线数据采集部分的主控制器通过同步串行端口控制器的两个串行外围设备接口进行总线操作,分别控制无线RF接收器1和无线RF收发器2,通过不断轮询持续监听信道是否有无线数据报文,并把有效的数据报文存储在各自的无线RF收发器的数据缓存中,主控制器对数据报文封装报文头和信道号,上传到上位机;上位机解码分析部分数据解析模块对检测到的数据包进行解码分析,按照其协议类型解析后,将解析的数据报文送数据显示模块,系统设置部分通过串口下发命令修改接收数据报文的信道。 The present invention also proposes a two-channel data detection and protocol analysis method based on 6LowPAN, which is characterized in that the main controller of the wireless data acquisition part performs bus operation through two serial peripheral device interfaces of the synchronous serial port controller, respectively Control the wireless RF receiver 1 and the wireless RF transceiver 2, by continuously polling whether there is a wireless data message in the continuous monitoring channel, and storing the valid data message in the data cache of the respective wireless RF transceiver, the main controller Encapsulate the header and channel number of the data message, and upload it to the host computer; the data analysis module of the host computer decoding and analysis part decodes and analyzes the detected data packet, parses it according to its protocol type, and sends the parsed data message to the data The display module and the system setting part send commands through the serial port to modify the channel for receiving data packets.

本发明提出的协议分析仪,独立于无线传感网系统以外,能同时进行两信道的数据监测和协议分析,也可调整两个信道同时对一个信道检测,降低了丢包率,可以对6LowPAN进行检测和协议的解码分析,并兼容对ZigBee的协议分析和可扩展对WIA-PA、ISA100.11a进行协议解码分析。 The protocol analyzer proposed by the present invention is independent of the wireless sensor network system, and can simultaneously perform two-channel data monitoring and protocol analysis, and can also adjust two channels to detect one channel at the same time, which reduces the packet loss rate and can be used for 6LowPAN Perform detection and protocol decoding analysis, and compatible with ZigBee protocol analysis and expandable WIA-PA, ISA100.11a protocol decoding analysis.

附图说明 Description of drawings

图1 本发明原理框图; Fig. 1 schematic block diagram of the present invention;

图2无线数据采集模块部分原理结构图; Fig. 2 partial principle structure diagram of wireless data acquisition module;

图3上位机解码分析部分结构图; Figure 3 is a structural diagram of the upper computer decoding analysis part;

图4 本发明工作流程图; Fig. 4 work flow chart of the present invention;

图5 串口数据接收流程图; Figure 5 Serial port data receiving flow chart;

图 6 6LowPAN解析流程图。 Figure 6 6LowPAN analysis flow chart.

图1中标号:A为主控制器,B为2.4GHz无线RF收发器1,C为2.4GHz无线RF收发器2,D为USB接口,E为上位机解码分析部分。 Labels in Figure 1: A is the main controller, B is the 2.4GHz wireless RF transceiver 1, C is the 2.4GHz wireless RF transceiver 2, D is the USB interface, and E is the decoding and analysis part of the upper computer.

具体实施方式 Detailed ways

下面参照附图和具体实例,对本发明的技术方案做进一步的详细分析。 The technical scheme of the present invention will be further analyzed in detail below with reference to the accompanying drawings and specific examples.

如图1所示为分析仪的原理框图。包括两部分:无线数据采集模块和上位机解码分析部分。无线数据采集部分包括主控制器、2.4GHz无线射频收发器1、2.4GHz无线射频收发器2、USB接口模块、电源管理模块。上位机解码分析部分包括系统设置模块、数据处理模块和人机界面。 Figure 1 shows the block diagram of the analyzer. It includes two parts: the wireless data acquisition module and the upper computer decoding analysis part. The wireless data acquisition part includes a main controller, a 2.4GHz wireless radio frequency transceiver 1, a 2.4GHz wireless radio frequency transceiver 2, a USB interface module, and a power management module. The upper computer decoding analysis part includes system setting module, data processing module and man-machine interface.

图2所示为无线数据采集模块原理结构图。主控制器采用微处理芯片ARM公司最新发布的Cortex-M0内核,它是市场上现有的最小、能耗最低的ARM处理器。无线射频接收器采用UZ2400模块,UZ2400模块工作在2.4GHz的频段上具有16个信道,是一种符合IEEE802.15.4标准协议的射频模块。此时,Cortex-M0处理器就通过串行外围设备接口(SPI0和SPI1)总线分别控制的UZ2400无线射频接收器1和UZ2400无线射频接收器2,轮询读取缓存器(FIFO)中的数据,Cortex-M0处理器对数据报文进行处理。 Figure 2 shows the schematic structure diagram of the wireless data acquisition module. The main controller adopts the newly released Cortex-M0 core of the microprocessor chip ARM Company, which is the smallest and lowest energy consumption ARM processor in the market. The wireless radio frequency receiver adopts the UZ2400 module. The UZ2400 module works in the 2.4GHz frequency band and has 16 channels. It is a radio frequency module that conforms to the IEEE802.15.4 standard protocol. At this time, the Cortex-M0 processor polls the data in the read buffer (FIFO) through the UZ2400 wireless RF receiver 1 and UZ2400 wireless RF receiver 2 respectively controlled by the serial peripheral interface (SPI0 and SPI1) bus. , the Cortex-M0 processor processes the data packets.

设置2.4GHz无线射频收发器1、2.4GHz无线射频收发器2保证同时进行两信道的数据报文的检测,支持对工作在频段为2.4GHz,从2.405GHz-2.480GHz间分布,共16个信道的射频接收装置。主控制器无线数据采集模块部分的核心,通过同步串行端口控制器(SSP)的两个串行外围设备接口(SPI)进行总线操作,以主控制器为主机模式,无线射频接收器为从模式,分别控制无线射频收发器1、2工作。主控制器通过总线对无线数据模块的寄存器进行设置,通过不断轮询两个无线射频收发器,持续监听两个信道是否有无线数据报文。 Set 2.4GHz radio frequency transceiver 1 and 2.4GHz radio frequency transceiver 2 to ensure simultaneous detection of two-channel data packets, support for working in the frequency band of 2.4GHz, distributed from 2.405GHz-2.480GHz, a total of 16 channels radio frequency receiver. The core of the wireless data acquisition module part of the main controller, the bus operation is performed through two serial peripheral interfaces (SPI) of the synchronous serial port controller (SSP), the main controller is the host mode, and the wireless radio frequency receiver is the slave mode to control the work of radio frequency transceivers 1 and 2 respectively. The main controller sets the registers of the wireless data module through the bus, continuously polls the two wireless radio frequency transceivers, and continuously monitors whether there are wireless data messages in the two channels.

主控制器通过串口转USB,实现无线采集模块和上位机之间的通信。电源管理模块,通过串口转USB接口电路,提供对整个分析仪的供电。 The main controller realizes the communication between the wireless acquisition module and the upper computer through the serial port to USB. The power management module provides power to the entire analyzer through the serial port to USB interface circuit.

无线数据报文经过基带滤波把有效的数据报文存储在无线射频接收器的数据缓存(FIFO)中,主控制器通过总线操作读取数据缓存(FIFO)中的有效数据报文,并对读取到的报文进行报文长度识别,检测是否是一个完整的数据报文。对完整报文送入上位机解码分析部分。 The wireless data message is stored in the data buffer (FIFO) of the wireless radio frequency receiver through baseband filtering, and the main controller reads the valid data message in the data buffer (FIFO) through the bus operation, and reads The received message is identified by the length of the message to check whether it is a complete data message. Send the complete message to the decoding and analysis part of the upper computer.

图3所示为上位机解码分析部分结构图。上位机由数据处理模块、系统设置模块和人机界面三部分构成,对接收的报文进行进行判断,识别是何种协议的数据报文,数据处理模块对协议栈的数据报文逐层解码分析,获得协议栈数据报文的源地址、目的地址、帧类型、协议各层的负载等数据报文信息,提供数据图显示,能对数据报文进行实时或事后监测分析,提供详细的数据,对研发和应用提供可靠的支持。 Figure 3 shows the structure diagram of the upper computer decoding and analysis part. The upper computer is composed of three parts: data processing module, system setting module and human-machine interface. It judges the received message and identifies the data message of the protocol. The data processing module decodes the data message of the protocol stack layer by layer. Analyze, obtain data message information such as source address, destination address, frame type, and load of each layer of the protocol stack data message, provide data graph display, and perform real-time or post-event monitoring and analysis on data messages, and provide detailed data , to provide reliable support for R&D and application.

如图4所示为两信道数据检测和协议分析仪工作流程图。以默认两信道分别为0x0B,0x0C为例,详细说明信道切换过程。上电后,对主控制器Cortex-M0处理器进行初始化,通过Cortex-M0处理器的串行外围设备接口(SPI)进行对无线射频接收器1、2的寄存器进行写操作,完成数据采集配置。通过两个无线射频接收器对16个原始信道(显示为十六进制数值从ch11(0B)至ch26(1A),0B=11,0C=12...10=16,...19=25,1A=26)序列表进行轮询扫描。在扫描每个信道时,当监测每个信道数据的最大时间值(系统设定的监测时间阈值)内仍没有数据报文,按照原始信道序列表0x0B-0x1A自动切换到相邻的下一个信道号0x0D,0x0E继续对空中无线数据进行监测。 As shown in Figure 4, it is the working flow diagram of two-channel data detection and protocol analyzer. Take the default two channels as 0x0B and 0x0C as an example to describe the channel switching process in detail. After power-on, initialize the main controller Cortex-M0 processor, and write the registers of the wireless radio frequency receiver 1 and 2 through the serial peripheral interface (SPI) of the Cortex-M0 processor to complete the data acquisition configuration . 16 raw channels (displayed as hexadecimal values from ch11 (0B) to ch26 (1A), 0B=11,0C=12...10=16,...19= 25,1A=26) The sequence table is polled and scanned. When scanning each channel, if there is still no data packet within the maximum time value (monitoring time threshold set by the system) of monitoring each channel data, it will automatically switch to the next adjacent channel according to the original channel sequence table 0x0B-0x1A No. 0x0D, 0x0E continue to monitor the air wireless data.

数据报文经过无线射频接收器的基带滤波后,送入接收数据缓存(RXFIFO)中,同时帧校验序列(FCS)对数据报文进行合法性检查。每个无线射频接收器的接收数据缓存(RXFIFO)中有两个144-byte(RXFIFO_0和RXFIFO_1)组成的接收数据缓存来存储即将到来的数据报文,每当Cortex-M0处理器读取其中的一个RXFIFO中数据时,另外一个RXFIFO就会继续接收存储即将到来的数据报文,这样就能有效减小数据的丢包率。无线数据检测模块每次接收到一个数据报文时会自动将接收信号强度指示和链路质量指示值加到该数据报文的后面。Cortex-M0处理器通过不断轮询读取无线RF收发器,把接收数据缓存(RXFIFO)中的数据读取出来。根据该报文的长度值,主控制器读取到一个完整数据报文以后,在该报文前封装报文有效性报文头(如:0x66 、0xAB),以方便上位机进行对数据有效性进行识别判断,然后通过串口上传给上位机进行协议的解码分析。控制器向上位机传送的数据格式如下所示: After the data message is filtered by the baseband of the wireless radio frequency receiver, it is sent to the receiving data buffer (RXFIFO), and the frame check sequence (FCS) checks the legality of the data message at the same time. There are two 144-byte (RXFIFO_0 and RXFIFO_1) receive data buffers in the receive data buffer (RXFIFO) of each wireless radio receiver to store upcoming data packets, whenever the Cortex-M0 processor reads the When there is data in one RXFIFO, the other RXFIFO will continue to receive and store the upcoming data packets, which can effectively reduce the data packet loss rate. Each time the wireless data detection module receives a data message, it will automatically add the received signal strength indicator and the link quality indicator value to the back of the data message. The Cortex-M0 processor reads the data in the receive data buffer (RXFIFO) by continuously polling and reading the wireless RF transceiver. According to the length value of the message, after the main controller reads a complete data message, it will encapsulate the message validity header (such as: 0x66, 0xAB) in front of the message, so as to facilitate the host computer to validate the data. Identify and judge the nature of the protocol, and then upload it to the host computer through the serial port for decoding and analysis of the protocol. The data format transmitted by the controller to the host computer is as follows:

   

注:0x表示十六进制;字节即byte,由8个bit位构成。 Note: 0x means hexadecimal; byte means byte, which consists of 8 bits.

其中,起始位——表示捕获到的数据包的帧头,占2字节,取值为0x66,0xAB。 Among them, the start bit—represents the frame header of the captured data packet, which occupies 2 bytes, and the value is 0x66, 0xAB.

信道号——表示捕获的数据的信道编号,占1字节,取值范围:0x0B-0x1A(即十进制的11-26)。 Channel number——Indicates the channel number of the captured data, occupying 1 byte, and the value range: 0x0B-0x1A (that is, 11-26 in decimal).

PPDU——是物理层协议数据单元。其中,帧长度由一个字节的低7位表示,其值表示物理帧负载的长度,因此物理帧负载的长度不会超过127个字节;Payload,即有效载荷,其长度可变,根据包长度确定其大小。 PPDU - is the physical layer protocol data unit. Among them, the frame length is represented by the lower 7 bits of a byte, and its value represents the length of the physical frame load, so the length of the physical frame load will not exceed 127 bytes; The length determines its size.

LQI——是链路质量指示,表示了所接收的数据包强度和质量的特性。LQI占1字节,其取值范围:0x00-0xFF。 LQI - is the Link Quality Indicator, which characterizes the received packet strength and quality. LQI occupies 1 byte, and its value range: 0x00-0xFF.

RSSI——是接收信号强度指示,它用来判定链接质量以及是否增大广播发送强度。RSSI占1字节。 RSSI——is the received signal strength indicator, which is used to determine the link quality and whether to increase the broadcast transmission strength. RSSI occupies 1 byte.

如图6所示为本发明上位机解码分析结构图,本发明上位机解码分析由数据处理、系统设置和人机界面三部分功能模块组成。下面分别对这三部分功能模块进行详细说明: As shown in Fig. 6, it is a structural diagram of the upper computer decoding analysis of the present invention. The upper computer decoding analysis of the present invention consists of three functional modules: data processing, system setting and man-machine interface. The three functional modules are described in detail below:

数据处理部分包括,数据接收模块、数据解码分析模块、数据存储模块、数据显示模块。 The data processing part includes a data receiving module, a data decoding and analyzing module, a data storage module, and a data display module.

数据接收模块接收无线数据采集模块通过串口上传的数据报文,传送给数据解析模块;数据解析模块对检测到的数据包进行解码分析,包括信道号、数据长度、协议类型、链路质量指示值、信号包的强度值、接收时间戳,以及对检测到的数据包的个数的统计,按照其协议类型解析后,送数据显示模块以表格形式显示,提供直观的数据分析结果。系统设置部分包括信道配置模块和数据类型诊断模块。信道配置模块通过串口进行命令下发修改接收数据报文的信道。其中, The data receiving module receives the data message uploaded by the wireless data acquisition module through the serial port, and transmits it to the data analysis module; the data analysis module decodes and analyzes the detected data packets, including channel number, data length, protocol type, and link quality indicator value , the strength value of the signal packet, the receiving time stamp, and the statistics of the number of detected data packets, after analyzing according to the protocol type, the sending data display module displays it in table form, providing intuitive data analysis results. The system setup part includes a channel configuration module and a data type diagnosis module. The channel configuration module issues commands through the serial port to modify the channel for receiving data packets. in,

命令的格式如下所示: The format of the command is as follows:

控制命令序列是以十六进制的形式向下发送的。比如修改为信道15和信道17,则向下发送的控制命令为:0xCA 0x04 0x0F 0x11(0x表示十六进制)。数据诊断类型模块对捕获的数据报文提供过滤器,判断是否是基于IEEE802.15.4协议的数据报文,并进行事后触发,以便分析仪有选择地捕获数据。数据处理部分对数据进行实时或事后监测分析,下面详细论述其分析处理过程: The control command sequence is sent down in hexadecimal form. For example, if it is changed to channel 15 and channel 17, the control command sent down is: 0xCA 0x04 0x0F 0x11 (0x means hexadecimal). The data diagnosis type module provides a filter for the captured data message, judges whether it is a data message based on the IEEE802.15.4 protocol, and triggers afterwards, so that the analyzer can selectively capture data. The data processing part performs real-time or post-event monitoring and analysis on the data, and the analysis and processing process is discussed in detail below:

无线数据采集模块与上位机以串口方式进行通信。在上位机的数据接收模块中,通过串口接收函数Rtn=ReadFile()(C++中的API函数,该函数从文件指针指示的位置开始从文件读数据)持续从串口缓存中读取数据报文,存储到缓冲区中,交由数据处理模块进行进一步的解析处理。串口数据接收流程如图5所示。在Visual C++环境中,通过创建UI线程(即用户界面线程)从串口接收数据,并通过线程消息PostThreadMessage将接收到的原始数据传送到主线程,再进行解析、显示。使用线程可以在进行数据处理及其它操作时,不会影响到数据报文的检测。 The wireless data acquisition module communicates with the upper computer through the serial port. In the data receiving module of the host computer, the serial port receiving function Rtn=ReadFile() (API function in C++, which reads data from the file from the position indicated by the file pointer) continues to read data messages from the serial port buffer, It is stored in the buffer and handed over to the data processing module for further parsing and processing. Serial port data receiving process is shown in Figure 5. In the Visual C++ environment, the UI thread (that is, the user interface thread) is created to receive data from the serial port, and the received original data is transmitted to the main thread through the thread message PostThreadMessage, and then parsed and displayed. The thread can be used for data processing and other operations without affecting the detection of data packets.

例如,对捕获的6LowPAN数据报文按照协议类型进层层解析,在对每一层进行数据报文的解析时,都借助下层解析的结果。在协议数据解析的过程中,当协议类型不能确定时,采用以用户设定的协议类型为优先级进行解析。默认的优先解析协议类型是6LowPAN及ZigBee,即优先使用6LowPAN协议对数据帧进行解析,对信标帧和MAC命令帧优先使用ZigBee协议进行解析,这样保证了对ZigBee的兼容性。 For example, the captured 6LowPAN data message is analyzed layer by layer according to the protocol type, and when analyzing the data message of each layer, the analysis results of the lower layer are used. During the protocol data parsing process, when the protocol type cannot be determined, the protocol type set by the user is used as the priority for parsing. The default priority parsing protocol type is 6LowPAN and ZigBee, that is, the 6LowPAN protocol is preferentially used to parse the data frame, and the beacon frame and MAC command frame are preferentially parsed using the ZigBee protocol, which ensures the compatibility with ZigBee.

首先,解码分析模块根据数据报文头的标志位来判别各种不同协议。然后MAC层报文头的帧控制域中的帧类型子段(3bit位)来确定帧类型。 First, the decoding analysis module distinguishes various protocols according to the flag bits of the data packet header. Then the frame type is determined by the frame type subfield (3 bits) in the frame control field of the MAC layer message header.

帧类型子段值如下所示 The frame type subfield values are as follows

因为ISA100.11a和6LowPAN两种协议都只有数据帧类型,而ZigBee和WIA-PA两种协议都包括数据帧、MAC命令帧、信标帧。因此若接收到的数据包的类型是MAC命令帧和信标帧,则该数据包可能是ZigBee或WIA-PA的数据包,此时采用设定的优先协议类型进行逐层逐字节解析,若优先协议类型是ZigBee则按ZigBee进行逐层逐字节解析;若是WIA-PA则按WIA-PA进行逐层逐字节解析。若数据包的类型是数据帧,则按照优先类型进行逐层逐字节解析,这样就能对不同协议WIA-PA、ISA100.11a进行扩展解析。 Because both the ISA100.11a and 6LowPAN protocols only have data frame types, while the ZigBee and WIA-PA protocols include data frames, MAC command frames, and beacon frames. Therefore, if the type of the received data packet is a MAC command frame and a beacon frame, the data packet may be a ZigBee or WIA-PA data packet. At this time, the set priority protocol type is used to analyze layer by layer and byte by byte. If the preferred protocol type is ZigBee, it will be analyzed layer by layer and byte by ZigBee; if it is WIA-PA, it will be analyzed layer by layer and byte by WIA-PA. If the type of the data packet is a data frame, it will be analyzed layer by layer and byte by byte according to the priority type, so that the extended analysis of different protocols WIA-PA and ISA100.11a can be performed.

下面以6LowPAN为例,数据包解析的流程图如图6所示,解析详细流程步骤如下: Taking 6LowPAN as an example, the flowchart of data packet parsing is shown in Figure 6. The detailed process steps of parsing are as follows:

(1)打开串口接收缓存的数据,并将接收到的数据取第一、二个字节,分别与报头封装的起始位两字节0x66、0xAB进行比较。若不相等则丢弃接收到的数据。否则继续解析数据。 (1) Open the serial port to receive the buffered data, and take the first and second bytes of the received data, and compare them with the two bytes 0x66 and 0xAB of the start bit encapsulated in the header respectively. If not equal, the received data is discarded. Otherwise continue parsing the data.

(2)取出第三个字节,得到信道号,并判断信道号的值是否在捕获的数据的信道编号0x0B~0x1A之间。若取值超出该范围则将该数据丢弃,否则继续解析数据。 (2) Take out the third byte to get the channel number, and judge whether the value of the channel number is between the channel numbers 0x0B~0x1A of the captured data. If the value exceeds the range, the data will be discarded, otherwise continue to parse the data.

(3)取出第四个字节,得到数据的长度并用Len表示,即物理层的负载部分的字节数,也即是MAC层(即媒介访问控制层)的PDU(即协议数据单元)。若数据报文长度取值为5或者9-127,则参照IEEE Std 802.15.4-2006继续解析数据包。否则,将数据丢弃。 (3) Take out the fourth byte, get the length of the data and express it with Len, that is, the number of bytes in the load part of the physical layer, that is, the PDU (protocol data unit) of the MAC layer (ie, the media access control layer). If the data packet length is 5 or 9-127, continue parsing the data packet referring to IEEE Std 802.15.4-2006. Otherwise, the data is discarded.

(4)自第五个字节开始,取出(3)中得到的数据长度Len个字节。所得到的这个Len字节即是媒介访问控制层的协议数据单元。底层根据IEEE Std 802.15.4-2006的帧格式,逐字段地解析数据。 (4) Starting from the fifth byte, take out the data length Len bytes obtained in (3). The obtained Len byte is the protocol data unit of the media access control layer. The bottom layer parses the data field by field according to the frame format of IEEE Std 802.15.4-2006.

(a) 取出协议数据单元的第一、二个字节,得到媒介访问控制层的帧控制域信息。IEEE Std 802.15.4-2006的帧控制字段位长为16比特,包括帧类型的定义,地址子字段和其他控制标志。其中,帧类型子字段位长度为3个比特位。因此取出第一个字节的低3bit位得到数据类型。若低3bit位取值为001(表示数据帧),由继续解析数据。否则,将数据丢弃。 (a) Take out the first and second bytes of the protocol data unit to obtain the frame control field information of the media access control layer. The frame control field of IEEE Std 802.15.4-2006 is 16 bits long, including the definition of frame type, address subfield and other control flags. Wherein, the bit length of the frame type subfield is 3 bits. Therefore, take out the lower 3 bits of the first byte to get the data type. If the value of the lower 3 bits is 001 (indicating a data frame), continue to parse the data. Otherwise, the data is discarded.

(b) 继续取出帧控制字段的信息后,然后取出帧序列号、地址信息、媒介访问控制层的帧数据单元(取至第Len-1个字节)。 (b) After continuing to take out the information of the frame control field, take out the frame sequence number, address information, and the frame data unit of the media access control layer (taken to the Len-1th byte).

(c) 在取出媒介访问控制层的帧数据单元中,先取出其第一个字节的低2bit位,然后根据6LowPAN的网络层帧格式的帧控制字段中的帧类型字段判断其类型。若帧类型不是数据帧,则不再解析MAC层的帧数据单元,直接将其作为MAC层的负载,不再向上层解析。若是数据帧,则根据6LowPAN的网络层帧格式取出地址信息、网络层的帧数据单元。在网络层的帧数据单元中,先取出其第1个字节的低2bit位,得到帧类型为数据帧或命令帧或确认帧;然后取出地址信息、应用层读数器、扩展头和应用层帧数据单元。 (c) In taking out the frame data unit of the media access control layer, first take out the lower 2 bits of the first byte, and then judge its type according to the frame type field in the frame control field of the network layer frame format of 6LowPAN. If the frame type is not a data frame, the frame data unit of the MAC layer is no longer parsed, and it is directly used as the load of the MAC layer, and the upper layer is no longer parsed. If it is a data frame, the address information and the frame data unit of the network layer are taken out according to the network layer frame format of 6LowPAN. In the frame data unit of the network layer, first take out the lower 2 bits of the first byte to get the frame type as data frame or command frame or confirmation frame; then take out the address information, application layer reader, extension header and application layer frame data unit.

(d) 取第Len个字节,解析MAC帧尾。 (d) Take the Lenth byte and parse the end of the MAC frame.

(e) 取出最后两个字节,分别解析得到LQI和RSSI。 (e) Take out the last two bytes and analyze them to get LQI and RSSI respectively.

(f) 将解析的数据显示出来,同时存储到数据库,以便于后续的查询和分析。 (f) Display the analyzed data and store it in the database at the same time, so as to facilitate subsequent query and analysis.

Claims (2)

1.一种基于6LowPAN的两信道数据检测与协议分析仪,包括,无线数据采集模块和上位机解码分析部分,其特征在于,无线数据采集模块包括主控制器、无线RF收发器1、无线RF收发器2、USB接口模块,上位机解码分析部分包括系统设置模块、数据处理模块和人机界面,主控制器通过同步串行端口控制器的两个串行外围设备接口进行总线操作,分别控制无线RF收发器1和无线RF收发器2,通过两个无线RF收发器对16个原始信道序列表进行轮询扫描,在扫描每个信道时,当监测每个信道数据的最大时间值内仍没有数据报文,按照原始信道序列表自动切换到相邻的下一个信道号,对于6LowPAN数据报文,则根据6LowPAN的网络层帧格式取出地址信息、网络层的帧数据单元,在网络层的帧数据单元中,先取出其第1个字节的低2bit位,得到帧类型为数据帧,然后取出地址信息、应用层读数器、扩展头和应用层帧数据单元;把有效的数据报文存储在各自的无线RF收发器的数据缓存中,主控制器对数据报文封装报文头和信道号,上传到上位机;上位机解码分析部分数据解析模块按照优先类型对检测到的数据报文进行逐层逐字节解析,并按照其协议类型解析后送数据显示模块,系统设置部分通过串口下发命令修改接收数据报文的信道。 1. A two-channel data detection and protocol analyzer based on 6LowPAN, comprising, a wireless data acquisition module and an upper computer decoding analysis part, it is characterized in that the wireless data acquisition module includes a main controller, a wireless RF transceiver 1, a wireless RF Transceiver 2, USB interface module, host computer decoding and analysis part includes system setting module, data processing module and man-machine interface, main controller performs bus operation through two serial peripheral device interfaces of synchronous serial port controller, respectively controls Wireless RF transceiver 1 and wireless RF transceiver 2, through two wireless RF transceivers, poll and scan the 16 original channel sequence lists. When scanning each channel, when the maximum time value of monitoring each channel data is still If there is no data message, it will automatically switch to the next adjacent channel number according to the original channel sequence table. For the 6LowPAN data message, the address information and the frame data unit of the network layer are taken out according to the frame format of the network layer of 6LowPAN. In the frame data unit, first take out the lower 2 bits of the first byte to obtain the frame type as data frame, then take out the address information, application layer reader, extension header and application layer frame data unit; put the effective data message Stored in the data cache of their respective wireless RF transceivers, the main controller encapsulates the header and channel number of the data message and uploads it to the host computer; the data analysis module of the host computer decodes and analyzes the detected data message according to the priority type The text is analyzed layer by layer and byte by byte, and then sent to the data display module after analysis according to the protocol type. The system setting part sends commands through the serial port to modify the channel for receiving data messages. 2.一种基于6LowPAN的两信道数据检测与协议分析方法,其特征在于,无线数据采集部分的主控制器通过同步串行端口控制器的两个串行外围设备接口进行总线操作,分别控制无线RF收发器1和无线RF收发器2,通过两个无线RF收发器对16个原始信道序列表进行轮询扫描,在扫描每个信道时,当监测每个信道数据的最大时间值内仍没有数据报文,按照原始信道序列表自动切换到相邻的下一个信道号,对于6LowPAN数据报文,则根据6LowPAN的网络层帧格式取出地址信息、网络层的帧数据单元,在网络层的帧数据单元中,先取出其第1个字节的低2bit位,得到帧类型为数据帧,然后取出地址信息、应用层读数器、扩展头和应用层帧数据单元;把有效的数据报文存储在各自的无线RF收发器的数据缓存中,主控制器对数据报文封装报文头和信道号,上传到上位机;上位机解码分析部分数据解析模块对检测到的数据报文进行解码分析,按照其协议类型解析后,将解析的数据报文送数据显示模块,系统设置部分通过串口下发命令修改接收数据报文的信道。 2. A two-channel data detection and protocol analysis method based on 6LowPAN is characterized in that the main controller of the wireless data acquisition part carries out bus operation through two serial peripheral device interfaces of the synchronous serial port controller, and controls the wireless respectively RF transceiver 1 and wireless RF transceiver 2, through the two wireless RF transceivers, poll and scan the 16 original channel sequence lists. When scanning each channel, there is still no data within the maximum time value of monitoring each channel data. The data message is automatically switched to the next adjacent channel number according to the original channel sequence table. For the 6LowPAN data message, the address information, the frame data unit of the network layer, and the frame data of the network layer are taken out according to the frame format of the network layer of 6LowPAN. In the data unit, first take out the lower 2 bits of the first byte to obtain the frame type as data frame, then take out the address information, application layer reader, extension header and application layer frame data unit; store the effective data message In the data cache of their respective wireless RF transceivers, the main controller encapsulates the header and channel number of the data message and uploads it to the host computer; the decoding and analysis part of the host computer decodes and analyzes the detected data message , after analyzing according to its protocol type, send the analyzed data message to the data display module, and the system setting part sends a command through the serial port to modify the channel for receiving the data message.
CN201110140443.7A 2011-05-27 2011-05-27 Two-channel data detection and protocol analysis meter based on 6LowPAN and method Active CN102158882B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110140443.7A CN102158882B (en) 2011-05-27 2011-05-27 Two-channel data detection and protocol analysis meter based on 6LowPAN and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110140443.7A CN102158882B (en) 2011-05-27 2011-05-27 Two-channel data detection and protocol analysis meter based on 6LowPAN and method

Publications (2)

Publication Number Publication Date
CN102158882A CN102158882A (en) 2011-08-17
CN102158882B true CN102158882B (en) 2014-07-09

Family

ID=44439990

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110140443.7A Active CN102158882B (en) 2011-05-27 2011-05-27 Two-channel data detection and protocol analysis meter based on 6LowPAN and method

Country Status (1)

Country Link
CN (1) CN102158882B (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102572878A (en) * 2011-12-26 2012-07-11 南京瀚之显电子科技有限公司 Zigbee protocol analyzing device
CN103281726B (en) * 2013-06-13 2015-09-30 湖南大学 Based on the data aggregation method of 6LoWPAN protocol stack
CN103560932B (en) * 2013-11-05 2017-02-08 重庆邮电大学 Wireless sensor network remote protocol conformance testing system and method
CN103906124B (en) * 2014-03-25 2018-06-01 广东电网公司电力科学研究院 GPRS signal detecting methods and system
CN104994014B (en) * 2015-05-11 2018-02-27 重庆邮电大学 Power line carrier IPv6 in intelligent grid communication and the communication means between wireless ZigBee
CN107155190B (en) * 2016-03-04 2020-03-13 北京中密安信息安全技术有限公司 RF stealing detecting terminal
CN106534184B (en) * 2016-12-12 2019-08-06 南京富岛信息工程有限公司 A kind of control system information security gateway based on depth data filtering
CN106899452B (en) * 2017-02-23 2020-06-30 江苏徐工信息技术股份有限公司 Message circulation processing Internet of things terminal debugging method based on XM2M protocol
CN109493580B (en) * 2017-09-11 2024-05-24 中泓慧联技术有限公司 Control system of multifunctional handset based on WIA-PA
CN109255420B (en) * 2018-08-02 2024-12-17 上海紫越网络科技股份有限公司 Wireless card, data analysis method/system, readable storage medium and server
CN109413666B (en) * 2018-09-26 2022-08-26 展讯通信(上海)有限公司 Data monitoring method of sniffer, storage medium and terminal
CN110677866A (en) * 2019-09-29 2020-01-10 展讯通信(上海)有限公司 Data monitoring method of sniffer, storage medium and terminal
CN112804085B (en) * 2020-12-29 2022-07-08 杭州和利时自动化有限公司 Backup network detection method, device and equipment for master-slave structure
CN113625630B (en) * 2021-08-09 2024-05-14 大易智慧信息科技(苏州)有限公司 Device for remote control of single-chip microcomputer operation by upper computer

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101072147A (en) * 2007-06-20 2007-11-14 重庆邮电大学 Industrial Ethernet protocol analysisand field tester
CN101262472A (en) * 2007-03-07 2008-09-10 力博特公司 A multi-function protocol parser and its realization method
CN102045882A (en) * 2009-10-19 2011-05-04 华为技术有限公司 Method, device and system of external communication of 6LoWPAN (internet protocol 6 over low power wireless personal area network) intra-network device and outside

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1522178B1 (en) * 2002-06-25 2008-03-12 PR Electronics A/S Method and adapter for protocol detection in a field bus network

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101262472A (en) * 2007-03-07 2008-09-10 力博特公司 A multi-function protocol parser and its realization method
CN101072147A (en) * 2007-06-20 2007-11-14 重庆邮电大学 Industrial Ethernet protocol analysisand field tester
CN102045882A (en) * 2009-10-19 2011-05-04 华为技术有限公司 Method, device and system of external communication of 6LoWPAN (internet protocol 6 over low power wireless personal area network) intra-network device and outside

Also Published As

Publication number Publication date
CN102158882A (en) 2011-08-17

Similar Documents

Publication Publication Date Title
CN102158882B (en) Two-channel data detection and protocol analysis meter based on 6LowPAN and method
CN112671638B (en) Gateway structure for multi-protocol conversion
CN101582895B (en) EPA-based embedded industrial wireless WIA-PA gateway
CN103532782B (en) A kind of WLAN wireless network testers and its method of testing
CN103781088B (en) Two point four gigahertz full-channel data collection and protocol analysis instrument based on IEEE802.15.4
US9042839B2 (en) Mobile communication terminal test system and mobile communication terminal test method
US9906491B2 (en) Improving transmission efficiency of data frames by using shorter addresses in the frame header
US11729667B2 (en) Ethernet data-based communication method and apparatus
CN104303468A (en) Method to identify and differentiate background traffic
EP3082293B1 (en) Switching device and packet loss method therefor
CN106664312B (en) Protocol Data Unit PDU packets generation method and device
JP2013535935A5 (en)
CN103052094B (en) Method for acquiring service set identifier of wireless mobile terminal
CN105682134A (en) WIFI-based intelligent terminal real-time sniffing method and real-time sniffing system
CN104135548A (en) Static NAT realization method and device based on FPGA
US8189459B2 (en) Method and system for guiding packet data protocol activation
CN116708148A (en) Network diagnostic method and electronic device
US7525966B2 (en) Wireless communication system for multicast communications
JP2019041251A (en) Radio communication device and control method of radio communication device
JPWO2005050942A1 (en) Wireless communication system, reception confirmation signal transmission control method, and wireless station used therefor
CN106507495B (en) Uplink authorization processing method and related equipment
CN106487988A (en) A kind of method and system realizing terminal control
CN104144472A (en) Scanning method and system for wireless router
CN108834140A (en) A kind of data processing terminal and its processing method
CN104219031A (en) MAC (media access control) frame aggregation method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant