+

CN104270550A - A reliable transmission method of image data based on CAN bus - Google Patents

A reliable transmission method of image data based on CAN bus Download PDF

Info

Publication number
CN104270550A
CN104270550A CN201410506872.5A CN201410506872A CN104270550A CN 104270550 A CN104270550 A CN 104270550A CN 201410506872 A CN201410506872 A CN 201410506872A CN 104270550 A CN104270550 A CN 104270550A
Authority
CN
China
Prior art keywords
image data
data
frame
sender
bus
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.)
Pending
Application number
CN201410506872.5A
Other languages
Chinese (zh)
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.)
Hubei University of Technology
Original Assignee
Hubei University of Technology
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 Hubei University of Technology filed Critical Hubei University of Technology
Priority to CN201410506872.5A priority Critical patent/CN104270550A/en
Publication of CN104270550A publication Critical patent/CN104270550A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/32Circuits or arrangements for control or supervision between transmitter and receiver or between image input and image output device, e.g. between a still-image camera and its memory or between a still-image camera and a printer device
    • H04N1/32101Display, printing, storage or transmission of additional information, e.g. ID code, date and time or title
    • H04N1/32144Display, printing, storage or transmission of additional information, e.g. ID code, date and time or title embedded in the image data, i.e. enclosed or integrated in the image, e.g. watermark, super-imposed logo or stamp
    • H04N1/32149Methods relating to embedding, encoding, decoding, detection or retrieval operations
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/62Establishing a time schedule for servicing the requests

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Multimedia (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a reliable image data transmission method based on a CAN bus. The method is based on a CAN expansion frame format and conducts dynamic secondary division based on row data, sequence matching, consistency checkout, error handling and the like on the image data blocks transmitted on the CAN bus so that transmission reliability can be improved, and data integrity can be guaranteed. By means of the method, the image data with the transmission height being 65536 pixels and the width being 65536 pixels can be transmitted at most, and great help is provided for expanding application of the CAN bus.

Description

一种基于CAN总线的图像数据可靠传输方法A reliable transmission method of image data based on CAN bus

技术领域 technical field

本发明属于数据传输技术领域,涉及一种基于CAN总线的一个数据发送方向一个数据接收方发送图像数据的可靠传输方法。  The invention belongs to the technical field of data transmission and relates to a reliable transmission method for sending image data from a data sender to a data receiver based on a CAN bus. the

  the

背景技术    Background technique

CAN总线通讯技术在各个领域的综合自动化控制系统中的应用广泛,其可靠性高、抗干扰性强、开发简单、造价低廉及短帧传输和无破坏仲裁技术等优点使其应用极为广泛。但CAN本身并非一个完整的协议,只包括物理层和数据链路层两个底层协议,要进行高效率的通讯还需要进一步开发高层协议。目前对CAN总线的开发中对于大数据块的传输方法通常基于基本通信协议,或者针对海量数据进行固定长度分割。这给实际应用中传输大小变化的数据块带来诸多不便,尤其是图像这一类数据,不仅要求传输速率快,还要求保证顺序、正确和完整。 CAN bus communication technology is widely used in comprehensive automation control systems in various fields. Its advantages of high reliability, strong anti-interference, simple development, low cost, short frame transmission and non-destructive arbitration technology make it widely used. But CAN itself is not a complete protocol, it only includes the physical layer and the data link layer, two underlying protocols, and high-level protocols need to be further developed for high-efficiency communication. In the current development of the CAN bus, the transmission method for large data blocks is usually based on the basic communication protocol, or fixed-length segmentation for massive data. This brings a lot of inconvenience to the transmission of data blocks of varying sizes in practical applications, especially for data such as images, which not only requires a fast transmission rate, but also requires the order, correctness and integrity to be guaranteed.

R·许尔曼斯等的发明专利(公开号:CN 1706170A)《用于在总线上传输数据的方法》中,重点阐述了基于通信标准格式的数据传输,该发明专利仅基于标准帧数据域的长度进行了一次分割,由于仅进行了字节数量的一致性验证,使得数据未进行更完整的验证。不仅如此,该发明的数据个数由接收方给出,并且发送方仅为控制电路,接收方仅为计算机,从而局限了传输的方向。 In the invention patent (publication number: CN 1706170A) of R. Schulmans et al. "Method for transmitting data on the bus", it focuses on the data transmission based on the communication standard format. The invention patent is only based on the standard frame data field The length of the data is divided once, because only the consistency verification of the number of bytes is carried out, so that the data has not been verified more completely. Not only that, the number of data in this invention is given by the receiver, and the sender is only a control circuit, and the receiver is only a computer, thus limiting the direction of transmission.

蒋凯等的发明专利(公开号:CN 101552785A)《基于消息机制的用于海量数据传输的CAN总线通信协议》中,重点阐述了一种基于消息机制的海量数据传输的CAN总线通信协议。该发明专利只有在数据字节数大于65536个时,才采用打包方式的二次分割处理。假如数据错误,按此通信协议设计整包重发对带宽的浪费很大,而且不能够对小于65536字节的数据进行有效地处理。 The invention patent of Jiang Kai et al. (publication number: CN 101552785A) "CAN bus communication protocol for mass data transmission based on message mechanism" focuses on a CAN bus communication protocol for mass data transmission based on message mechanism. Only when the number of data bytes is greater than 65536, the invention patent adopts the secondary division processing of the packing method. If the data is wrong, the whole packet retransmission according to this communication protocol design will waste a lot of bandwidth, and the data smaller than 65536 bytes cannot be effectively processed.

  the

发明内容 Contents of the invention

为了解决上述的技术问题,本发明提供了一种基于CAN总线的一个数据发送方向一个数据接收方发送图像数据的可靠传输方法,其特点是发送图像数据对象高度和宽度可变,采用基于行数据的动态二次分割,每发送一行返回一个行发送状态帧来提高CAN总线传输的速率和可靠性。 In order to solve the above-mentioned technical problems, the present invention provides a reliable transmission method for sending image data from one data sender to a data receiver based on the CAN bus. The dynamic secondary division, each sending a line returns a line sending status frame to improve the rate and reliability of CAN bus transmission.

本发明所采用的技术方案是:一种基于CAN总线的图像数据可靠传输方法,应用于一主多从的系统中,主设备只有一个、为系统管理计算机,从设备数量由实际需要决定,图像数据传输在主设备和从设备间进行,从设备之间无相互传输;其特征在于,包括以下步骤: The technical solution adopted in the present invention is: a reliable image data transmission method based on CAN bus, which is applied to a system with one master and multiple slaves. There is only one master device, which is the system management computer, and the number of slave devices is determined by actual needs. The data transmission is carried out between the master device and the slave device, and there is no mutual transmission between the slave devices; it is characterized in that it includes the following steps:

步骤1:图像数据发送方首先根据图像数据对象的大小,对CAN总线上传输的图像数据块进行基于行数据的动态二次分割处理,即先根据图像数据按照行数分割为若个数据块,然后按照特定的帧格式将每个数据块内的像素点颜色信息分成若干数据帧的多帧形式; Step 1: The image data sender first performs dynamic secondary segmentation processing based on row data on the image data block transmitted on the CAN bus according to the size of the image data object, that is, first divides the image data into several data blocks according to the number of rows, Then divide the pixel color information in each data block into a multi-frame form of several data frames according to a specific frame format;

步骤2:图像数据发送方将尺寸信息帧发送到图像数据接收方; Step 2: The image data sender sends the size information frame to the image data receiver;

步骤3:图像数据接收方收到尺寸信息帧后,向图像数据发送方返回发送状态信息即应答数据帧,并判断: Step 3: After the image data receiver receives the size information frame, it returns the sending status information to the image data sender, that is, the response data frame, and judges:

若图像数据发送方收到的返回信息为成功,则顺序执行下述步骤4; If the return information received by the image data sender is successful, the following steps 4 are performed in sequence;

若图像数据发送方收到的返回信息为失败,则回转执行所述的步骤2; If the return information received by the image data sender is failure, then go back to step 2;

若图像数据发送方等待1s未收到返回信息,则回转执行所述的步骤2; If the sender of the image data waits for 1s and does not receive the return information, then go back to step 2;

步骤4:图像数据发送方向图像数据接收方依次发送一行数据; Step 4: The image data sender sends one line of data to the image data receiver in sequence;

步骤5:图像数据接收方在收到一行数据以后,检查所有数据帧的顺序和内容,根据检查结果向图像数据发送方返回发送状态信息即行发送状态帧,并判断: Step 5: After receiving a row of data, the image data receiver checks the order and content of all data frames, returns the sending status information to the image data sender according to the inspection results, and sends the status frame immediately, and judges:

若图像数据发送方收到的返回信息为成功,则顺序执行下述步骤6; If the return information received by the image data sender is successful, then perform the following step 6 in sequence;

若图像数据发送方收到的返回信息为失败,则根据返回的错误坐标号,重新发送所在的这一行自该帧号以后的图像数据; If the return message received by the sender of the image data is failure, resend the image data of the row after the frame number according to the returned error coordinate number;

若图像数据发送方等待1s未收到返回信息,则回转执行所述的步骤4,自动重发该行数据帧;若重发到三次,仍未收到返回信息,则判定为故障,停止发送,自复位CAN总线,并使CAN总线继续重发该行数据帧; If the sender of the image data waits for 1 second and does not receive the return information, it will turn around and execute the above step 4, and automatically resend the data frame of the line; if it has not received the return information after resending three times, it will be judged as a failure and stop sending , self-reset the CAN bus, and make the CAN bus continue to resend the row of data frames;

步骤6:按照步骤5所述的方法依次发送后续各行图像数据,直至正确收到的图像数据行数等于尺寸信息帧中的行数,图像数据传输完毕。 Step 6: Send subsequent lines of image data sequentially according to the method described in step 5, until the number of lines of image data correctly received is equal to the number of lines in the size information frame, and the transmission of image data is completed.

作为优选,步骤1中所述的特定的帧格式包括仲裁场、控制场和数据场;所述的仲裁场中的标识符使用的是扩展型29位标识符,包含优先级控制位、源地址、目标地址、功能号和像素点行坐标X;根据帧优先级的规定,具有最低二进制数的标识符有最高的优先级,所以定义ID28、ID27为优先级控制位,00为尺寸信息帧优先级, 01为图像数据优先级;源地址是图像数据发送方的地址编号;目标地址是图像数据接收方的地址编号;功能号是用来判断传输数据内容从而按要求提取数据帧内信息;像素点行坐标X是发送的某一行数据的X坐标号;所述的控制场与所述的数据场内的有效数据位数有关,是按照CAN总线国际标准ISO11898进行填充。 Preferably, the specific frame format described in step 1 includes an arbitration field, a control field, and a data field; the identifier in the arbitration field uses an extended 29-bit identifier, including a priority control bit, a source address , target address, function number, and pixel row coordinate X; according to the frame priority, the identifier with the lowest binary number has the highest priority, so define ID28 and ID27 as priority control bits, and 00 as size information frame priority Level, 01 is the image data priority; the source address is the address number of the image data sender; the destination address is the address number of the image data receiver; the function number is used to judge the content of the transmitted data and extract the information in the data frame as required; pixel The dot row coordinate X is the X coordinate number of a row of data sent; the control field is related to the number of effective data bits in the data field, and is filled according to the CAN bus international standard ISO11898.

作为优选,步骤1中所述的图像数据发送方首先根据图像数据对象的大小,对CAN总线上传输的图像数据块先根据图像高度分为若干行,再基于每一行进行的动态二次分割处理,然后将要传输的图像尺寸信息和像素点的颜色信息按照特定的帧格式分成若干数据帧的多帧形式。 Preferably, the image data sender described in step 1 first divides the image data block transmitted on the CAN bus into several rows according to the image height according to the size of the image data object, and then performs dynamic secondary segmentation processing based on each row , and then divide the image size information and pixel color information to be transmitted into a multi-frame form of several data frames according to a specific frame format.

    作为优选,步骤2中所述的图像数据发送方将尺寸信息帧发送到图像数据接收方,其图像数据发送方发送一个至少包含图像数据的尺寸信息的数据帧,最大可以传输高度为65536,宽度为65536的图像;其大小还与从设备的储存区大小、标识符像素点行坐标的位数有关。 Preferably, the image data sender described in step 2 sends the size information frame to the image data receiver, and the image data sender sends a data frame containing at least the size information of the image data, and the maximum transmission height is 65536, width It is an image of 65536; its size is also related to the size of the storage area of the slave device and the number of digits of the identifier pixel row coordinates.

作为优选,步骤3中所述的应答数据帧,其数据域第一个字节为发送状态标志位,第二、三个字节是错误像素点行坐标,此处并不涉及,定义为0,第四个字节SUM为有效数据位的校验位。 As a preference, in the response data frame described in step 3, the first byte of the data field is the sending status flag bit, and the second and third bytes are the row coordinates of the error pixel point, which are not involved here and are defined as 0 , the fourth byte SUM is the check digit of valid data bits.

作为优选,步骤5中所述的检查所有数据帧的顺序和内容,包括顺序匹配、一致性验证、以及错误处理。 Preferably, checking the sequence and content of all data frames described in step 5 includes sequence matching, consistency verification, and error handling.

作为优选,所述的图像数据发送方和图像数据接收方为系统管理计算机或DSP,当DSP作为图像数据发送方时,需要主设备应发送一个命令信息,要求DSP发送图像数据。 Preferably, the image data sender and image data receiver are system management computer or DSP, when DSP is used as the image data sender, it is required that the master device should send a command message to request the DSP to send image data.

本发明基于CAN拓展帧格式,公开了一种方法对CAN总线上传输的图像数据块进行基于行数据的动态二次分割、顺序匹配、一致性校验、错误处理等措施的图像数据可靠传输方法,从而提高传输的可靠性,保证数据的完整性。该方法最大可以传输高度为65536个像素点,宽度为65536个像素点的图像数据,对扩大CAN总线的应用提供了有力的帮助。 Based on the CAN extended frame format, the present invention discloses a reliable image data transmission method based on dynamic secondary segmentation, sequence matching, consistency check, error handling and other measures for the image data blocks transmitted on the CAN bus. , so as to improve the reliability of transmission and ensure the integrity of data. This method can transmit image data with a maximum height of 65536 pixels and a width of 65536 pixels, which provides powerful help for expanding the application of the CAN bus.

  the

附图说明   Description of drawings

 图1 :为本发明的流程图。 Fig. 1: is flow chart of the present invention.

  the

具体实施方式 Detailed ways

为了便于本领域普通技术人员理解和实施本发明,下面结合附图及实施例对本发明作进一步的详细描述,应当理解,此处所描述的实施示例仅用于说明和解释本发明,并不用于限定本发明。 In order to facilitate those of ordinary skill in the art to understand and implement the present invention, the present invention will be described in further detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the implementation examples described here are only used to illustrate and explain the present invention, and are not intended to limit this invention.

本发明CAN总线通讯底层采用CAN2.0B协议规范,应用层协议选用CANOpen,帧格式为拓展帧格式。 The bottom layer of the CAN bus communication of the present invention adopts the CAN2.0B protocol specification, the application layer protocol selects CANOpen, and the frame format is an extended frame format.

请见图1,本发明所采用的技术方案是:一种基于CAN总线的图像数据可靠传输方法,应用于一主多从的系统中,主设备只有一个、为系统管理计算机,从设备数量由实际需要决定,图像数据传输在主设备和从设备间进行,从设备之间无相互传输;包括以下步骤: Please see Fig. 1, the technical scheme that the present invention adopts is: a kind of image data reliable transmission method based on CAN bus, is applied in the system of one main multi-slave, and there is only one master device, which is a system management computer, and the number of slave devices is determined by The actual need determines that the image data transmission is carried out between the master device and the slave device, and there is no mutual transmission between the slave devices; the following steps are included:

步骤1:图像数据发送方首先根据图像数据对象的大小,对CAN总线上传输的图像数据块进行基于行数据的动态二次分割处理,即先根据图像数据按照行数分割为若个数据块,然后按照特定的帧格式将每个数据块内的像素点颜色信息分成若干数据帧的多帧形式。 Step 1: The image data sender first performs dynamic secondary segmentation processing based on row data on the image data block transmitted on the CAN bus according to the size of the image data object, that is, first divides the image data into several data blocks according to the number of rows, Then, according to a specific frame format, the pixel color information in each data block is divided into a multi-frame form of several data frames.

CAN总线传输的每一帧数据,其格式包括仲裁场,控制场和数据场。其中为了携带更多必要信息而不占用有效数据位,仲裁场中的标识符格式采用的是扩展帧标识符格式,至少包含优先级控制位、像素点行坐标、源地址、目标地址、功能号。在表1所给出的标识符的位定义实例中,根据帧优先级的规定,具有最低二进制数的标识符有最高的优先级,所以定义了ID28、ID27为优先级标识,00为尺寸信息帧优先级,其余图像数据优先级为01。ID26-ID23为4位数据发送方源地址标识,特别地当源地址为0000时代表为主设备发送,ID22-ID19为4位数据接收方目标地址标识,该标识是判断是否接收信息并进行处理的依据,特别地当目标地址为0000时为广播发送,ID18-ID15为3位是功能标识,也是为接收方判断该帧数据类型的依据,剩余为16位x坐标。 The format of each frame of data transmitted by the CAN bus includes an arbitration field, a control field and a data field. In order to carry more necessary information without occupying valid data bits, the identifier format in the arbitration field adopts the extended frame identifier format, which at least includes priority control bits, pixel row coordinates, source address, destination address, and function number . In the bit definition example of the identifier given in Table 1, according to the frame priority, the identifier with the lowest binary number has the highest priority, so ID28 and ID27 are defined as priority marks, and 00 is the size information Frame priority, other image data priority is 01. ID26-ID23 is the 4-digit source address identifier of the data sender, especially when the source address is 0000, it means sending from the master device, ID22-ID19 is the 4-digit data receiver target address identifier, which is used to judge whether to receive information and process it The basis, especially when the target address is 0000, it is broadcast transmission, ID18-ID15 is 3 bits is the function identification, and it is also the basis for the receiver to judge the data type of the frame, and the remaining 16 bits are the x coordinates.

表1  标识符的位定义实例 Table 1 bit definition example of identifier

ID28-ID27ID28-ID27 ID26-ID23ID26-ID23 ID22-ID19ID22-ID19 优先级priority 源地址source address 目标地址target address ID18-ID16ID18-ID16 ID15-ID0ID15-ID0  the 功能号function number x坐标x-coordinate  the

计算机作为数据发送方,发送给1号从设备大小为4X2的图像数据拓展帧完整格式见表2。 The computer acts as the data sender, and the complete format of the image data expansion frame sent to No. 1 slave device with a size of 4X2 is shown in Table 2.

表2    图像数据拓展帧完整格式 Table 2 Complete format of image data extension frame

如表2所示,宽度为4像素、高度为2像素的图像数据被分割成了5帧,第一帧为先发送的尺寸信息帧,第一、二个字节X为图像行宽度4个像素,第三、四个字节Y为图像列高度2个像素,第五个字节SUM为数据位的和校验,余下四帧为图像数据信息,分别为其RGB颜色值,存放在图像数据帧的数据域第一到六个字节,第七个字节SUM为本帧数据位的和校验。接收方在收到完毕后,将数据进行解析还原,得到完整的图像数据,并保存至内存中。特别地,当图像宽度为奇数时,数据接收方在接受一行数据的最后一帧时,仅读取数据域前三位数据位。 As shown in Table 2, the image data with a width of 4 pixels and a height of 2 pixels is divided into 5 frames, the first frame is the size information frame sent first, and the first and second bytes X are 4 image line widths Pixels, the third and fourth bytes Y are 2 pixels in the height of the image column, the fifth byte SUM is the sum check of the data bits, and the remaining four frames are image data information, which are RGB color values, which are stored in the image The first to six bytes of the data field of the data frame, the seventh byte SUM is the sum check of the data bits of this frame. After receiving, the receiver analyzes and restores the data to obtain complete image data and saves it in memory. In particular, when the image width is an odd number, the data receiver only reads the first three data bits in the data field when receiving the last frame of a line of data.

步骤2:图像数据发送方将尺寸信息帧发送到图像数据接收方;本实施例的尺寸信息帧,最大可以传输高度为65536、宽度为65536的图像,其大小还与从设备的储存区大小、标识符像素点行坐标的位数有关。 Step 2: The image data sender sends the size information frame to the image data receiver; the size information frame in this embodiment can transmit images with a maximum height of 65536 and a width of 65536, and its size is also the same as the size of the storage area of the slave device, The number of bits in the identifier pixel row coordinates is related.

步骤3:图像数据接收方收到尺寸信息帧后,向图像数据发送方返回发送状态信息即应答数据帧,并判断: Step 3: After the image data receiver receives the size information frame, it returns the sending status information to the image data sender, that is, the response data frame, and judges:

数据接收方收到尺寸信息帧后,向数据发送方返回发送状态信息即一个应答的数据帧,正确接收后的应答数据帧格式见表3,错误接收后的应答数据帧格式见表4 。 After receiving the size information frame, the data receiver returns the sending status information to the data sender, that is, a response data frame. The format of the response data frame after correct reception is shown in Table 3, and the format of the response data frame after incorrect reception is shown in Table 4.

数据域第一个字节为发送状态标志位,第二、三个字节是错误像素点行坐标,此处并不涉及,定义为为0,第四个字节SUM为本帧数据位的和校验。若数据发送方收到的返回信息为成功,则数据发送方发送第一行图像数据;若数据发送方收到的返回信息为失败,则自动重发该尺寸信息帧;若数据发送方等待1s未收到返回信息,则自动重发该尺寸信息帧;若重发到三次,则判定为故障,停止发送,软件自复位CAN总线,并使CAN总线继续刚刚的步骤。 The first byte of the data field is the sending status flag, the second and third bytes are the row coordinates of the error pixel point, which is not involved here, and is defined as 0, and the fourth byte SUM is the data bit of this frame and checksum. If the return information received by the data sender is successful, the data sender will send the first line of image data; if the return information received by the data sender is failure, the size information frame will be automatically resent; if the data sender waits for 1s If the return information is not received, the size information frame will be automatically resent; if it is resent three times, it will be judged as a failure, stop sending, the software will reset the CAN bus by itself, and make the CAN bus continue the previous steps.

表3    正确接收后的应答数据帧格式 Table 3 Response data frame format after correct reception

控制域、标识符Control Domain, Identifier 数据域data field 11B,0000B,0001B,001B,0000000000000000B11B, 0000B, 0001B, 001B, 0000000000000000B 0xfe,0x00,0x00,0xfe0xfe, 0x00, 0x00, 0xfe

表4    错误接收后的应答数据帧格式  Table 4 Response data frame format after error reception

控制域、标识符Control Domain, Identifier 数据域data field 11B,0000B,0001B,001B,0000000000000000B11B, 0000B, 0001B, 001B, 0000000000000000B 0xff,0x00,0x00,0xff0xff, 0x00, 0x00, 0xff

步骤4:图像数据发送方向图像数据接收方依次发送一行数据; Step 4: The image data sender sends one line of data to the image data receiver in sequence;

步骤5:图像数据接收方在收到一行数据以后,检查所有数据帧的顺序和内容(包括顺序匹配、一致性验证、以及错误处理),根据检查结果向图像数据发送方返回发送状态信息即行发送状态帧,并判断: Step 5: After receiving a row of data, the image data receiver checks the sequence and content of all data frames (including sequence matching, consistency verification, and error handling), and returns the sending status information to the image data sender according to the inspection results and sends it immediately Status frame, and judge:

若图像数据发送方收到的返回信息为成功,则顺序执行下述步骤6; If the return information received by the image data sender is successful, then perform the following step 6 in sequence;

若图像数据发送方收到的返回信息为失败,则根据返回的错误坐标号,重新发送所在的这一行自该帧号以后的图像数据; If the return message received by the sender of the image data is failure, resend the image data of the row after the frame number according to the returned error coordinate number;

若图像数据发送方等待1s未收到返回信息,则回转执行所述的步骤4,自动重发该行数据帧;若重发到三次,仍未收到返回信息,则判定为故障,停止发送,自复位CAN总线,并使CAN总线继续重发该行数据帧; If the sender of the image data waits for 1 second and does not receive the return information, it will turn around and execute the above step 4, and automatically resend the data frame of the line; if it has not received the return information after resending three times, it will be judged as a failure and stop sending , self-reset the CAN bus, and make the CAN bus continue to resend the row of data frames;

数据接收方在收到一行数据以后,检查所有数据帧的内容和顺序,根据检查结果向数据发送方返回一帧发送状态信息即一个行发送状态帧,并定义行发送状态帧的功能号为010。若数据发送方收到的返回信息为成功,则继续发送下一行数据帧;若数据发送方收到的返回信息为失败,则根据返回的错误坐标号,重新发送所在的这一行该数据帧及以后的数据,若数据发送方等待1s未收到返回信息,则返回上一步,自动重发该行数据帧,若重发到三次,仍未收到返回信息,则判定为故障,停止发送,软件自复位CAN总线,并使CAN总线继续刚刚的步骤。 After receiving a row of data, the data receiver checks the content and sequence of all data frames, returns a frame sending status information to the data sender according to the inspection result, that is, a row sending status frame, and defines the function number of the row sending status frame as 010 . If the return information received by the data sender is successful, continue to send the next line of data frame; if the return information received by the data sender is failure, then resend the data frame and the data frame of this line according to the returned error coordinate number For the subsequent data, if the data sender waits for 1 second without receiving the return information, it will return to the previous step and automatically resend the data frame of the line. If it has not received the return information after resending three times, it will be judged as a failure and stop sending. The software self-resets the CAN bus and makes the CAN bus continue the steps just now.

根据检查结果,发送全部正确,返回如表5所示的行发送状态帧;发送像素点行坐标为3的数据帧出现错误,返回如表6所示的行发送状态帧,据返回的错误坐标号,重新发送所在的这一行该数据帧及以后的数据,即表1的第三帧。       According to the inspection results, all the transmissions are correct, and the line sending status frame shown in Table 5 is returned; the data frame with the row coordinate of the sending pixel point of 3 has an error, and the line sending status frame shown in Table 6 is returned, according to the returned error coordinates No., resend the data frame and subsequent data of the line where it is located, that is, the third frame of Table 1. ``

表5  全部正确返回的行发送状态帧 Table 5 All correctly returned rows send status frame

控制域、标识符Control Domain, Identifier 数据域data field 11B,0000B,0001B,010B,0000000000000000B11B, 0000B, 0001B, 010B, 0000000000000000B 0xfe,0x00,0x00,0xfe0xfe, 0x00, 0x00, 0xfe

表6  数据帧出现错误返回的行发送状态帧 Table 6 The line sending status frame returned by error in the data frame

控制域、标识符Control Domain, Identifier 数据域data field 11B,0000B,0001B,010B,0000000000000000B11B, 0000B, 0001B, 010B, 0000000000000000B 0xff,0x00,0x03,0xff0xff, 0x00, 0x03, 0xff

步骤6:按照步骤5所述的方法依次发送后续各行图像数据,直至正确收到的图像数据行数等于尺寸信息帧中的行数,图像数据传输完毕。 Step 6: Send subsequent lines of image data sequentially according to the method described in step 5, until the number of lines of image data correctly received is equal to the number of lines in the size information frame, and the transmission of image data is completed.

图像数据发送方继续发送后续余下的各行图像数据,见表1第4、5帧,数据接收方根据检查结果向数据发送方返回一帧发送状态信息即一个行发送状态帧。 The image data sender continues to send the remaining rows of image data, see frames 4 and 5 in Table 1, and the data receiver returns a frame of sending status information, that is, a row sending status frame, to the data sender according to the inspection results.

当正确收到的图像数据行数等于尺寸信息帧中的行数,则图像数据传输完毕。 When the number of correctly received image data lines is equal to the number of lines in the size information frame, the image data transmission is complete.

本发明的图像数据发送方和图像数据接收方为系统管理计算机或DSP,当DSP作为图像数据发送方时,需要主设备应发送一个命令信息,要求DSP发送图像数据。 The image data sender and image data receiver of the present invention are system management computer or DSP, when DSP is used as the image data sender, it is necessary for the master device to send a command message, requiring the DSP to send image data.

优先级说明:其余帧的优先级如果低于图像数据,所以根据数据帧的优先级规定,先接受图像数据,再接受其他数据帧。 Priority description: If the priority of other frames is lower than that of image data, according to the priority of data frames, image data is accepted first, and then other data frames are accepted.

应当理解的是,本说明书未详细阐述的部分均属于现有技术。 It should be understood that the parts not described in detail in this specification belong to the prior art.

应当理解的是,上述针对较佳实施例的描述较为详细,并不能因此而认为是对本发明专利保护范围的限制,本领域的普通技术人员在本发明的启示下,在不脱离本发明权利要求所保护的范围情况下,还可以做出替换或变形,均落入本发明的保护范围之内,本发明的请求保护范围应以所附权利要求为准。 It should be understood that the above-mentioned descriptions for the preferred embodiments are relatively detailed, and should not therefore be considered as limiting the scope of the patent protection of the present invention. Within the scope of protection, replacements or modifications can also be made, all of which fall within the protection scope of the present invention, and the scope of protection of the present invention should be based on the appended claims.

Claims (7)

1.一种基于CAN总线的图像数据可靠传输方法,应用于一主多从的系统中,主设备只有一个、为系统管理计算机,从设备数量由实际需要决定,图像数据传输在主设备和从设备间进行,从设备之间无相互传输;其特征在于,包括以下步骤: 1. A reliable image data transmission method based on CAN bus, which is applied to a system with one master and multiple slaves. There is only one master device, which is the system management computer, and the number of slave devices is determined by actual needs. The image data is transmitted between the master device and the slave It is carried out between devices, and there is no mutual transmission between slave devices; it is characterized in that it includes the following steps: 步骤1:图像数据发送方首先根据图像数据对象的大小,对CAN总线上传输的图像数据块进行基于行数据的动态二次分割处理,即先根据图像数据按照行数分割为若个数据块,然后按照特定的帧格式将每个数据块内的像素点颜色信息分成若干数据帧的多帧形式; Step 1: The image data sender first performs dynamic secondary segmentation processing based on row data on the image data block transmitted on the CAN bus according to the size of the image data object, that is, first divides the image data into several data blocks according to the number of rows, Then divide the pixel color information in each data block into a multi-frame form of several data frames according to a specific frame format; 步骤2:图像数据发送方将尺寸信息帧发送到图像数据接收方; Step 2: The image data sender sends the size information frame to the image data receiver; 步骤3:图像数据接收方收到尺寸信息帧后,向图像数据发送方返回发送状态信息即应答数据帧,并判断: Step 3: After the image data receiver receives the size information frame, it returns the sending status information to the image data sender, that is, the response data frame, and judges: 若图像数据发送方收到的返回信息为成功,则顺序执行下述步骤4; If the return information received by the image data sender is successful, the following steps 4 are performed in sequence; 若图像数据发送方收到的返回信息为失败,则回转执行所述的步骤2; If the return information received by the image data sender is failure, then go back to step 2; 若图像数据发送方等待1s未收到返回信息,则回转执行所述的步骤2; If the sender of the image data waits for 1s and does not receive the return information, then go back to step 2; 步骤4:图像数据发送方向图像数据接收方依次发送一行数据; Step 4: The image data sender sends one line of data to the image data receiver in sequence; 步骤5:图像数据接收方在收到一行数据以后,检查所有数据帧的顺序和内容,根据检查结果向图像数据发送方返回发送状态信息即行发送状态帧,并判断: Step 5: After receiving a row of data, the image data receiver checks the order and content of all data frames, returns the sending status information to the image data sender according to the inspection results, and sends the status frame immediately, and judges: 若图像数据发送方收到的返回信息为成功,则顺序执行下述步骤6; If the return information received by the image data sender is successful, then perform the following step 6 in sequence; 若图像数据发送方收到的返回信息为失败,则根据返回的错误坐标号,重新发送所在的这一行自该帧号以后的图像数据; If the return message received by the sender of the image data is failure, resend the image data of the row after the frame number according to the returned error coordinate number; 若图像数据发送方等待1s未收到返回信息,则回转执行所述的步骤4,自动重发该行数据帧;若重发到三次,仍未收到返回信息,则判定为故障,停止发送,自复位CAN总线,并使CAN总线继续重发该行数据帧; If the sender of the image data waits for 1 second and does not receive the return information, it will turn around and execute the above step 4, and automatically resend the data frame of the line; if it has not received the return information after resending three times, it will be judged as a failure and stop sending , self-reset the CAN bus, and make the CAN bus continue to resend the row of data frames; 步骤6:按照步骤5所述的方法依次发送后续各行图像数据,直至正确收到的图像数据行数等于尺寸信息帧中的行数,图像数据传输完毕。 Step 6: Send subsequent lines of image data sequentially according to the method described in step 5, until the number of correctly received image data lines is equal to the number of lines in the size information frame, and the image data transmission is completed. 2.根据权利要求1所述的基于CAN总线的图像数据可靠传输方法,其特征在于:步骤1中所述的特定的帧格式包括仲裁场、控制场和数据场;  2. the image data reliable transmission method based on CAN bus according to claim 1, is characterized in that: the specific frame format described in step 1 comprises arbitration field, control field and data field; 所述的仲裁场中的标识符使用的是扩展型29位标识符,包含优先级控制位、源地址、目标地址、功能号和像素点行坐标X;根据帧优先级的规定,具有最低二进制数的标识符有最高的优先级,故定义ID28、ID27为优先级控制位,00为尺寸信息帧优先级,01为图像数据优先级;源地址是图像数据发送方的地址编号;目标地址是图像数据接收方的地址编号;功能号是用来判断传输数据内容从而按要求提取数据帧内的信息;像素点行坐标X是发送的某一行数据的X坐标号; The identifier in the arbitration field is an extended 29-bit identifier, including priority control bits, source address, destination address, function number and pixel row coordinate X; according to the frame priority, it has the lowest binary The identifier of the number has the highest priority, so ID28 and ID27 are defined as priority control bits, 00 is the priority of the size information frame, and 01 is the priority of image data; the source address is the address number of the image data sender; the destination address is The address number of the image data receiver; the function number is used to judge the content of the transmitted data and extract the information in the data frame as required; the pixel row coordinate X is the X coordinate number of a row of data sent; 所述的控制场与所述的数据场内的有效数据位数有关,是按照CAN总线国际标准ISO11898进行填充。 The control field is related to the number of effective data bits in the data field, and is filled in accordance with CAN bus international standard ISO11898. 3.根据权利要求1所述的基于CAN总线的图像数据可靠传输方法,其特征在于:步骤1中所述的图像数据发送方首先根据图像数据对象的大小,对CAN总线上传输的图像数据块先根据图像高度分为若干行,再基于每一行进行的动态二次分割处理,然后将要传输的图像尺寸信息和像素点的颜色信息按照特定的帧格式分成若干数据帧的多帧形式。 3. the image data reliable transmission method based on CAN bus according to claim 1, is characterized in that: the image data sender described in step 1 first according to the size of image data object, to the image data block transmitted on the CAN bus First divide the image into several rows according to the height of the image, and then perform dynamic secondary segmentation processing based on each row, and then divide the image size information and pixel color information to be transmitted into a multi-frame form of several data frames according to a specific frame format. 4. 根据权利要求1所述的基于CAN总线的图像数据可靠传输方法,其特征在于:步骤2中所述的图像数据发送方将尺寸信息帧发送到图像数据接收方,其图像数据发送方发送一个至少包含图像数据的尺寸信息的数据帧,最大可以传输高度为65536,宽度为65536的图像。 4. The image data reliable transmission method based on CAN bus according to claim 1, characterized in that: the image data sender described in step 2 sends the size information frame to the image data receiver, and its image data sender sends A data frame that contains at least the size information of the image data, and can transmit images with a maximum height of 65536 and a width of 65536. 5.根据权利要求1所述的基于CAN总线的图像数据可靠传输方法,其特征在于:步骤3中所述的应答数据帧,其数据域第一个字节为发送状态标志位,第二、三个字节是错误像素点行坐标,第四个字节SUM为有效数据位的校验位。 5. the image data reliable transmission method based on CAN bus according to claim 1, it is characterized in that: the response data frame described in the step 3, its data field first byte is the sending status flag bit, the second, The three bytes are the row coordinates of the error pixel point, and the fourth byte SUM is the check digit of the valid data bit. 6.根据权利要求1所述的基于CAN总线的图像数据可靠传输方法,其特征在于:步骤5中所述的检查所有数据帧的顺序和内容,包括顺序匹配、一致性验证、以及错误处理。 6. The image data reliable transmission method based on CAN bus according to claim 1, characterized in that: the order and content of checking all data frames described in step 5 includes order matching, consistency verification, and error handling. 7.根据权利要求1所述的基于CAN总线的图像数据可靠传输方法,其特征在于:所述的图像数据发送方和图像数据接收方为系统管理计算机或DSP,当DSP作为图像数据发送方时,需要主设备应发送一个命令信息,要求DSP发送图像数据。 7. the image data reliable transmission method based on CAN bus according to claim 1, is characterized in that: described image data sender and image data receiver are system management computer or DSP, when DSP is as image data sender , the master device should send a command message, requiring the DSP to send image data.
CN201410506872.5A 2014-09-28 2014-09-28 A reliable transmission method of image data based on CAN bus Pending CN104270550A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410506872.5A CN104270550A (en) 2014-09-28 2014-09-28 A reliable transmission method of image data based on CAN bus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410506872.5A CN104270550A (en) 2014-09-28 2014-09-28 A reliable transmission method of image data based on CAN bus

Publications (1)

Publication Number Publication Date
CN104270550A true CN104270550A (en) 2015-01-07

Family

ID=52162036

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410506872.5A Pending CN104270550A (en) 2014-09-28 2014-09-28 A reliable transmission method of image data based on CAN bus

Country Status (1)

Country Link
CN (1) CN104270550A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105389534A (en) * 2015-10-28 2016-03-09 惠州Tcl移动通信有限公司 Two-dimensional-code-based information transmission method and system of mobile terminal
CN106788916A (en) * 2016-12-30 2017-05-31 深圳市优必选科技有限公司 Data transmission method and data transmission device for bus
CN106850134A (en) * 2016-12-30 2017-06-13 深圳市优必选科技有限公司 Frame transmission method and device
CN107493216A (en) * 2017-08-11 2017-12-19 辽宁瑞华实业集团高新科技有限公司 Controller area network bus data processing method and processing device
CN110113504A (en) * 2018-02-01 2019-08-09 上海钢盾信息科技有限公司 A kind of method of image transmitting and the device of image transmitting

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
吴长勤等: "基于灰色预测的残缺图像的修复算法", 《计算机技术与发展》 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105389534A (en) * 2015-10-28 2016-03-09 惠州Tcl移动通信有限公司 Two-dimensional-code-based information transmission method and system of mobile terminal
CN106788916A (en) * 2016-12-30 2017-05-31 深圳市优必选科技有限公司 Data transmission method and data transmission device for bus
CN106850134A (en) * 2016-12-30 2017-06-13 深圳市优必选科技有限公司 Frame transmission method and device
CN106850134B (en) * 2016-12-30 2021-07-27 深圳市优必选科技股份有限公司 Frame transmission method and device
CN106788916B (en) * 2016-12-30 2021-08-27 深圳市优必选科技股份有限公司 Data transmission method and data transmission device for bus
CN107493216A (en) * 2017-08-11 2017-12-19 辽宁瑞华实业集团高新科技有限公司 Controller area network bus data processing method and processing device
CN107493216B (en) * 2017-08-11 2020-05-12 北京瑞华高科技术有限责任公司 Controller area network CAN bus data processing method and device
CN110113504A (en) * 2018-02-01 2019-08-09 上海钢盾信息科技有限公司 A kind of method of image transmitting and the device of image transmitting

Similar Documents

Publication Publication Date Title
EP3716546B1 (en) Data transmission method and first device
CN104270550A (en) A reliable transmission method of image data based on CAN bus
CN101552785B (en) CAN bus communication method based on message mechanism used for massive data transmission
CN101764730A (en) CAN bus data transmission method
CN114301906B (en) Data transmission system and data transmission method
CN110855686B (en) SPI protocol communication method, system, equipment and computer storage medium
CN111464422B (en) Interaction method, interaction device, electronic equipment and storage medium
CN111343148A (en) A method, system and device for processing FGPA communication data
CN104125046A (en) Data transmission method, apparatus and system thereof
CN106603506A (en) Data communication method, apparatus and system based on multi-field bus
CN104980257A (en) Internet of things communication method and device
CN106788916B (en) Data transmission method and data transmission device for bus
CN114301576B (en) Method and communication device for generating and transmitting acknowledgement frames in an IEEE802.15.4 network
CN104184729A (en) Message processing method and device
CN105634894B (en) An enhanced CAN bus data retransmission method and device
CN103973581B (en) Method, device and system for processing message data
CN102523168B (en) Method and apparatus for message transmission
CN104615564A (en) Data transmission method based on QPI bus and computer system
US20180191562A1 (en) Parameter setting method for system bus and device thereof
CN104836639A (en) Data transmission method capable of transmitting multiple algorithm parameters
WO2022111693A1 (en) Data transmission method and related device
WO2017063589A1 (en) Data transmission method and apparatus
CN106301709B (en) USB electronic device and data packet retransmission control method and system
CN111740809B (en) Data transmission method, device and storage medium
CN114928377B (en) Output transmission method, device and equipment for reducing transparent transmission bandwidth of USB data

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20150107

RJ01 Rejection of invention patent application after publication
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载