Movatterモバイル変換


[0]ホーム

URL:


CN104917696A - Periodic and non-periodic mixed communication method and system used for low-speed serial bus - Google Patents

Periodic and non-periodic mixed communication method and system used for low-speed serial bus
Download PDF

Info

Publication number
CN104917696A
CN104917696ACN201510309016.5ACN201510309016ACN104917696ACN 104917696 ACN104917696 ACN 104917696ACN 201510309016 ACN201510309016 ACN 201510309016ACN 104917696 ACN104917696 ACN 104917696A
Authority
CN
China
Prior art keywords
message
unit
buffer memory
periodic
data
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.)
Granted
Application number
CN201510309016.5A
Other languages
Chinese (zh)
Other versions
CN104917696B (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.)
Beijing Yunji Technology Co Ltd
Original Assignee
Beijing Yunji Technology Co Ltd
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 Beijing Yunji Technology Co LtdfiledCriticalBeijing Yunji Technology Co Ltd
Priority to CN201510309016.5ApriorityCriticalpatent/CN104917696B/en
Publication of CN104917696ApublicationCriticalpatent/CN104917696A/en
Application grantedgrantedCritical
Publication of CN104917696BpublicationCriticalpatent/CN104917696B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

The invention relates to the field of message transmitting and receiving technologies, and discloses a periodic and non-periodic mixed communication method and a periodic and non-periodic mixed communication system used for a low-speed serial bus. The periodic and non-periodic mixed communication method comprises the steps of: sending a data message to a server in a serial mode by a client, wherein a periodic message is sent in each period, and a non-periodic message is sent when encountering an unexpected situation; analyzing whether a conflict occurs when the data message is sent at the moment; if so, storing the data message in a buffer Buffer temporarily; setting a flag bit Flag to be 0 when the server receives a sending command, and setting the flag bit Flag to be 1 when receiving the data message; and judging types of a sub-message according to a Resp value, updating the data if the sub-message is a periodic message, and writing the data into RespBuffer if the sub-message is a non-periodic message. Through the arrangement of the Buffer and the Flag, the periodic message and the non-periodic message are transmitted and received in a serial mode, thereby preventing conflicts between the periodic message and the non-periodic message, and carrying out corresponding treatment on the periodic message and the non-periodic message quickly.

Description

A kind of cycle for low-frequency serial bus and aperiodic mix communication means and system
Technical field
The present invention relates to packet sending and receiving technical field, particularly relate to a kind of cycle for low-frequency serial bus and aperiodic mixes communication means and system.
Background technology
The client data end that needs to upload onto the server upgrades, data upload can have been come, generally, for avoiding the wasting of resources by serial and parallel two kinds of modes, when not needing frequently to carry out data upload, serial mode is mostly adopted to complete data upload.Serial mode transmission data are single, convenient to the data-message transmission periodically sent, but be easy to cause data collision for paroxysmal data message due to transmit port, lead to errors.
At present, cycle and aperiodic mix communication transmitting data, for solving the problem of serially-transmitted data conflict, generally go out to arrange a clock at serial port, be used for specifying and the time of timing every part data-message transmission, but official hour is generally equally spaced like this, when there is no the data needing to upload, the waste of resource can be caused, and when serial data is more, the excessive time interval can cause transmission to block up, promptness is poor, if predetermined time interval is different, then needs multiple clock, arrange complexity, resource cost is excessive.
Summary of the invention
Technical problem to be solved by this invention is, provides a kind of cycle for low-frequency serial bus and aperiodic to mix communication means and system, to solve the problem of the data collision and the wasting of resources etc. that cause when periodically packet and aperiodicity message mix transmitting-receiving.
The present invention solves the problems of the technologies described above adopted technical scheme and is to provide a kind of cycle for low-frequency serial bus and aperiodic mixes communication means, and the method comprising the steps of:
S1, client serially-transmitted data message, wherein, periodically packet each cycle sends once, and aperiodicity message sends when there is emergency situations;
Whether S2, judgement now send described data message and can clash, if meeting, then described data message are put into buffer memory Buffer and keep in;
If S3 can not, then will send described data message;
The transmission order of client described in S4, received server-side, is set to 0 by flag bit Flag;
S5, receive described data message, described Flag is set to 1, and empties buffer memory RespBuffer;
S6, resolve described data message, if described data message is correct, then it is verified, if described data message is wrong, then described type of error is updated in ErrCode;
S7, judge sub-type of message, if described periodically packet, then update server data, if described aperiodicity message, then write in described RespBuffer, and flag bit bRespReceived are set to 1.
Preferably, in step S2, when universal serial bus is idle, judges whether there is temporary data message in described buffer memory Buffer, if having, then send described data message, and empty described buffer memory Buffer.
Preferably, in step S4, when described flag bit Flag is set to 0, start timing, if timing exceedes the time threshold T of setting, not receiving described data message yet or calibration mistake occurs, is then time-out error, stops receiving, and upgrades described ErrCode.
Preferably, in step S7, described server end judges sub-type of message according to Resp value, if Resp=0X0F, is then described periodically packet, if Resp ≠ 0X0F, is then aperiodicity message.
Preferably, when the flag bit bRespReceived value of described RespBuffer is 1, described server end need reply the aperiodicity message in described RespBuffer.
On the other hand, the invention provides a kind of cycle for low-frequency serial bus and aperiodic mixes communication system, it is characterized in that, described system comprises client and server end, wherein,
Described client is used for serial and sends periodically packet and aperiodicity message, and described client comprises the first judging unit, buffer memory Buffer unit, transmitting element and detecting unit;
Described server end is for receiving described periodically packet and aperiodicity message, and respective handling is carried out to it, described server end comprises receiving element, resolution unit, error handling unit, calibration unit, the second judging unit, data updating unit and buffer memory RespBuffer unit.
Preferably, the unit in described client:
Described first judging unit, now sends described periodically packet for judgement or whether aperiodicity message can clash, if meeting, is then kept in described buffer memory Buffer unit, if can not, then send it to described transmitting element;
Described buffer memory Buffer unit, the described periodically packet sent for temporary described first judging unit or aperiodic message;
Described transmitting element, for send described periodically packet or aperiodic message;
Described detecting unit, for when universal serial bus is idle, to detect in described buffer memory Buffer unit whether temporary have described periodically packet or aperiodic message, if having, then send, and empty described buffer memory Buffer unit.
Preferably, the unit in described server end:
Described receiving element, for receive transmission order and described periodically packet that described client sends or aperiodic message, when receiving described transmission order, flag bit Flag is set to 0, when described message finishes receiving, described flag bit Flag is set to 1;
Described resolution unit, for resolve described periodically packet or aperiodic message, if described message is correct, then sends it to described calibration unit, if described message is wrong, then type of error be updated to error handling unit;
Described error handling unit, for recording the mistake receiving described periodically packet or produce in message process aperiodic;
Described calibration unit, for periodically packet described in calibration or aperiodic message;
Described second judging unit, for judging the type of sub-message, if described periodically packet, is then sent to described data updating unit, if described aperiodicity message, is then sent to described buffer memory RespBuffer unit;
Described data updating unit, for upgrading the data of described server end according to described periodically packet;
Described buffer memory RespBuffer unit, for aperiodicity message described in buffer memory.
Preferably, described receiving element also comprises timing unit, when described flag bit Flag is 0, start timing, if overtime threshold value T does not receive described message or described message calibration mistake yet, be then time-out error, stop receiving, and described time-out error is sent to described error handling unit upgrades; When described Flag is 1, empty described buffer memory RespBuffer unit.
Preferably, described second judging unit judges the type of sub-message according to Resp value, if Resp=0X0F, is then described periodically packet; If Resp ≠ 0X0F, be then aperiodicity message, write described buffer memory RespBuffer unit, and the flag bit bRespReced in described buffer memory RespBuffer unit is set to 1.
Accompanying drawing explanation
Fig. 1 is the flow chart that in a preferred embodiment of the present invention, client sends periodically packet;
Fig. 2 is the flow chart that in a preferred embodiment of the present invention, client sends aperiodicity message;
Fig. 3 is the flow chart of received server-side data message in a preferred embodiment of the present invention;
Fig. 4 is the flow chart that in a preferred embodiment of the present invention, server end judges data message type;
Fig. 5 mixes the structure chart of communication system for the cycle of low-frequency serial bus and aperiodic in a preferred embodiment of the invention.
Embodiment
Following examples only for technical scheme of the present invention is clearly described, and can not limit the scope of the invention with this.Specification subsequent descriptions is for implementing better embodiment of the present invention, and right described description is to illustrate for the purpose of rule of the present invention, and is not used to limit scope of the present invention.Protection scope of the present invention is when being as the criterion depending on the claims person of defining.
Below in conjunction with the drawings and specific embodiments, the present invention is described in further details.
As depicted in figs. 1 and 2, be a preferred embodiment of the present invention, the cycle and the aperiodic that disclose low-frequency serial bus mix communication means, and wherein, Fig. 1 discloses the method that periodically packet sends, and the method comprising the steps of:
S101, when client serial send periodically packet time, judge that whether universal serial bus idle;
If S102 has the aperiodicity message sent, then periodically packet is put into buffer memory Buffer and keep in;
If S103 is idle, then send;
S104, to be sent completely, to judge in buffer memory Buffer whether temporaryly have aperiodicity message;
If S105 has, then send the message in buffer memory Buffer, and empty buffer memory Buffer.
Further, Fig. 2 discloses the method that aperiodicity message sends, and the method comprising the steps of:
S201, when client serial send aperiodicity message time, judge that whether universal serial bus idle;
If S202 has the periodically packet sent, then aperiodicity message is put into buffer memory Buffer and keep in;
If S203 is idle, then send;
S204, to be sent completely, to judge in buffer memory Buffer whether temporaryly have periodically packet;
If S205 has, then send the message in buffer memory Buffer, and empty buffer memory Buffer.
In the present embodiment, data message is divided into periodically packet and aperiodicity message, wherein periodically packet is accumulated to by timing and starts cycle time to send, aperiodicity message starts when breaking in a burst to send, when sending periodically packet, if there is aperiodicity message to take universal serial bus, then for preventing conflict, periodically packet is temporarily stored in buffer memory Buffer, after aperiodicity message is sent completely, message in buffer memory Buffer is sent, vice versa, like this, both the conflict that serially-transmitted data message may cause had been solved, simultaneously, again because do not need to divide the time sent datagram at every turn, can immediately send temporary message, solve as sending the problems such as the wasting of resources that message causes in time.
As shown in Figure 3, disclose the method for received server-side data message, the method comprising the steps of:
The transmission order of S301, received server-side client, is set to 0 by flag bit Flag, and receives message;
S302, flag bit Flag are designated as 0, start timing, judge whether the timing cumulative time exceedes the time threshold of setting;
Finish receiving in S303, time threshold, Flag value is set to 1, and empty buffer memory RespBuffer;
Do not finish receiving in S304, time thresholding, as time-out error, be updated in ErrCode;
S305, analytic message, and judge that whether message is correct;
S306, message error, be then updated to mistake in ErrCode.
In the present embodiment, control confirmation message by flag bit Flag whether to finish receiving, if finish receiving, then Flag becomes 1 from 0, if message does not receive or receives mistake, being then updated in ErrCode by corresponding mistake, can the message that receives of Deterministic service device termination be all correctly available, and the mistake and the type of error that dock time receiving message have corresponding record, and reversibility is strong.
As shown in Figure 4, disclose the method for the message that server-side processes receives, the method comprising the steps of:
S301, calibration message;
S302, judge sub-type of message, Resp=0X0F according to Resp value in message, sub-message is cycle temper message, Resp ≠ 0X0F, aperiodicity message during sub-message;
If S303 message is periodically packet, then according to message update server data;
If S304 message is non-periodically packet, then message is write RespBuffer, flag bit bRespReceived is set to 1.
In the present embodiment, when emergency situations occurs, client sends aperiodicity message, and server end is write in RespBuffer, and flag bit bRespReceived is set to 1, and waiting for server end is replied; Periodically packet is that periodic data is uploaded, server end only needs to carry out corresponding data and upgrades, without the need to response, the different types of data message of simple differentiation, makes respective handling to different message, accelerates message processing speed, raise the efficiency, and server can be replied for the corresponding command response message, need not check one by one, reduce the wasting of resources.
One of ordinary skill in the art will appreciate that, the all or part of step realized in above-described embodiment method is that the hardware that can carry out instruction relevant by program has come, described program can be stored in computer read/write memory medium, this program is when performing, comprise each step of above-described embodiment method, and described storage medium can be: ROM/RAM, magnetic disc, CD, storage card etc.Therefore, relevant technical staff in the field will be understood that corresponding with method of the present invention, the present invention also comprises a kind of cycle of low-frequency serial bus simultaneously and aperiodic mixes communication system, see Fig. 4, with said method step correspondingly, this system comprises client and server end, wherein
Client comprises the first judging unit, buffer memory Buffer unit, transmitting element and detecting unit;
Server end comprises receiving element, resolution unit, error handling unit, calibration unit, the second judging unit, data updating unit and buffer memory RespBuffer unit.
In the present embodiment, client sends message by serial mode to server end, client sends message in order by the first judging unit, buffer memory Buffer unit, transmitting element and detecting unit, avoid the problem of serial line interface message collisions, server end receives by receiving element, resolution unit, error handling unit the message that client sends, guarantee the correctness of message, complete the process to dissimilar message by the second judging unit, data updating unit and buffer memory RespBuffer unit, improve the efficiency of server-side processes message.
Further, the unit in client:
First judging unit, for judging whether the message sent, if having, then keeps in message to buffer memory Buffer unit, if do not have, then message is sent to transmitting element;
Buffer memory Buffer unit, for storing the message that the first judging unit sends;
Transmitting element, for sending message;
Detecting unit, after being sent completely at the message sent, whether have message, if having, then send message, and empty buffer memory Buffer unit if detecting in buffer memory Buffer unit to keep in.
In the present embodiment, client judges whether to need the message sent to keep in by the first judging unit, during unit free to be sent, by detecting unit determination buffer memory message, transmitting element sends, when ensure that transmitting element is busy, the message that need send is ranked, and can not cause conflict and block up, and when transmitting element is idle, again can the message of dispatcher queue in time, improve transmitting efficiency.
Further, the unit in server end:
Receiving element, for receiving the transmission order and message that client sends, when receive send order time, flag bit Flag is set to 0, when message finishes receiving, flag bit Flag is set to 1;
Resolution unit, for analytic message, if message is correct, is then sent to calibration unit by message, if message is wrong, then type of error is updated to error handling unit;
Error handling unit, for recording the mistake receiving and produce in message process;
Calibration unit, for calibration message;
Second judging unit, for judging the type of sub-message, if periodically packet, is then sent to data updating unit, if command response message, is then sent to buffer memory RespBuffer unit;
Data updating unit, for the data according to periodically packet update server end;
Buffer memory RespBuffer unit, for buffer memory aperiodicity message.
Further, receiving element also comprises timing unit, when flag bit Flag is 0, starting timing, if overtime threshold value T does not receive message or message calibration mistake yet, is then time-out error, stop receiving message, and time-out error is sent to error handling unit upgrades; When Flag is 1, empty buffer memory RespBuffer unit.
Further, the second judging unit judges the type of message according to the Resp value of message, if Resp value is 0X0F, then message is periodically packet; If Resp value is not 0X0F, then message is aperiodicity message, is write buffer memory RespBuffer unit, and the flag bit bRespReced in buffer memory RespBuffer unit is set to 1.
In the present embodiment, by flag bit Flag, server end judges that whether receiving element is complete and receives message, and to guarantee the correctness of message, meanwhile, the mistake of error handling unit misregistration message and error condition, make the reception of message have trackability; In addition, server end is judged type of message by the second judging unit, and respectively different process is carried out to periodically packet and aperiodicity message by data updating unit and buffer memory RespBuffer unit, message is made to be easier to classification, treatment effeciency is higher, and special process is no longer needed to periodic data, saving resource.
Compared with prior art, the cycle and the aperiodic that the invention provides a kind of low-frequency serial bus mix communication means and system, by using buffer control client to the transmission of message, preventing serial mode from mixing when sending periodically packet and aperiodicity message and producing conflict; Control by flag bit the integrality receiving message, message is resolved, ensure correctness and the availability of message; In addition, by judging type of message, message being carried out classification process, saving the processing time, raise the efficiency, meanwhile, prevent the waste of resource.
It should be noted that; the foregoing is only preferred embodiment of the present invention; not thereby limit scope of patent protection of the present invention, the present invention can also carry out the improvement of materials and structures to the structure of above-mentioned various parts, or adopts technically equivalent ones to replace.Therefore the equivalent structure change that all utilizations specification of the present invention and diagramatic content are done, or directly or indirectly apply to other correlative technology fields and be all in like manner all contained in the scope that the present invention contains.

Claims (10)

CN201510309016.5A2015-06-082015-06-08A kind of period for low-frequency serial bus and aperiodic mix communication means and systemActiveCN104917696B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201510309016.5ACN104917696B (en)2015-06-082015-06-08A kind of period for low-frequency serial bus and aperiodic mix communication means and system

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201510309016.5ACN104917696B (en)2015-06-082015-06-08A kind of period for low-frequency serial bus and aperiodic mix communication means and system

Publications (2)

Publication NumberPublication Date
CN104917696Atrue CN104917696A (en)2015-09-16
CN104917696B CN104917696B (en)2018-08-03

Family

ID=54086414

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201510309016.5AActiveCN104917696B (en)2015-06-082015-06-08A kind of period for low-frequency serial bus and aperiodic mix communication means and system

Country Status (1)

CountryLink
CN (1)CN104917696B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN107947901A (en)*2017-11-292018-04-20海信(成都)冰箱有限公司A kind of method for sending information and device
CN109617825A (en)*2018-11-302019-04-12京信通信系统(中国)有限公司 Message processing device, method and communication system
CN112764407A (en)*2021-04-092021-05-07浙江国利信安科技有限公司Distributed control non-periodic communication method
CN113256833A (en)*2021-05-122021-08-13安徽巨一科技股份有限公司PLC-based line body process duration analysis method and application thereof
CN113741390A (en)*2021-08-302021-12-03重庆长安汽车股份有限公司Method for writing vehicle controller by FBL (fiber Bragg Grating) based on UDS (UDS) diagnosis service

Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN2716911Y (en)*2004-04-282005-08-10武汉大学Multi communication port multi protocol intelligent traffic collection device
CN201226531Y (en)*2008-06-262009-04-22山东大学Multi-protocol data integration control telecommunication gateway
CN101807342A (en)*2010-01-082010-08-18北京世纪高通科技有限公司Data processing system and method
CN102752084A (en)*2012-07-272012-10-24湖南先步信息股份有限公司Multi-device controller area network (CAN) communication intelligent retransmission method
CN103763396A (en)*2014-02-122014-04-30浙江大学Energy consumption data acquisition unit and method based on multi-protocol parallel acquisition technology

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN2716911Y (en)*2004-04-282005-08-10武汉大学Multi communication port multi protocol intelligent traffic collection device
CN201226531Y (en)*2008-06-262009-04-22山东大学Multi-protocol data integration control telecommunication gateway
CN101807342A (en)*2010-01-082010-08-18北京世纪高通科技有限公司Data processing system and method
CN102752084A (en)*2012-07-272012-10-24湖南先步信息股份有限公司Multi-device controller area network (CAN) communication intelligent retransmission method
CN103763396A (en)*2014-02-122014-04-30浙江大学Energy consumption data acquisition unit and method based on multi-protocol parallel acquisition technology

Cited By (8)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN107947901A (en)*2017-11-292018-04-20海信(成都)冰箱有限公司A kind of method for sending information and device
CN107947901B (en)*2017-11-292021-03-02海信(成都)冰箱有限公司Information sending method and device
CN109617825A (en)*2018-11-302019-04-12京信通信系统(中国)有限公司 Message processing device, method and communication system
CN109617825B (en)*2018-11-302022-03-25京信网络系统股份有限公司Message processing device, method and communication system
CN112764407A (en)*2021-04-092021-05-07浙江国利信安科技有限公司Distributed control non-periodic communication method
CN113256833A (en)*2021-05-122021-08-13安徽巨一科技股份有限公司PLC-based line body process duration analysis method and application thereof
CN113741390A (en)*2021-08-302021-12-03重庆长安汽车股份有限公司Method for writing vehicle controller by FBL (fiber Bragg Grating) based on UDS (UDS) diagnosis service
CN113741390B (en)*2021-08-302023-10-13重庆长安汽车股份有限公司Method for FBL (flash memory controller) to write vehicle controller based on UDS (Universal diagnostic System) diagnostic service

Also Published As

Publication numberPublication date
CN104917696B (en)2018-08-03

Similar Documents

PublicationPublication DateTitle
CN104917696A (en)Periodic and non-periodic mixed communication method and system used for low-speed serial bus
US8392635B2 (en)Selectively enabling a host transfer interrupt
TWI408931B (en)Data communication device, communication control method, and program
US11010094B2 (en)Task management method and host for electronic storage device
KR102707737B1 (en)Controller diagnostic device and method thereof
CN114138700B (en)Flow control method, device, equipment and storage medium for serial port data transmission
US9703736B2 (en)Data transmission apparatus, communication control method, and communication control program
CN109525473B (en)Method and system for expanding CAN by MCU, MCU and computer medium
CN110413398B (en)Task scheduling method and device, computer equipment and storage medium
CN109240975A (en)Two take two system synchronous method and device
US7428608B2 (en)Communication system, communication circuit and communication method
CN101877666A (en)Method and device for receiving multi-application program message based on zero copy mode
JP7146650B2 (en) COMMUNICATION DEVICE, COMMUNICATION METHOD, PROGRAM AND COMMUNICATION SYSTEM
CN113157465A (en)Message sending method and device based on pointer linked list
CN104615558A (en)Data transferring method and electronic device
CN107608711A (en)Upgrade method, device, system and electronic equipment
CN101645057B (en)Method and device for preventing CPU local bus from suspension
JP5510192B2 (en) Communication device
CN117909269A (en)Network control method, system, device, equipment and storage medium
KR20170117326A (en)Direct memory access control device for at least one processing unit having a random access memory
CN102508738B (en) A backup method, kernel and backup kernel of multi-core processor business information
US11979908B2 (en)Method, device, terminal and system for transmitting data
CN116909977A (en)Multi-machine communication method and system
KR20160036846A (en)Method and Apparatus for Managing Channel Connect
CN116302687A (en)Communication recovery method, device, system and readable storage medium

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
C10Entry into substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant
CP03Change of name, title or address
CP03Change of name, title or address

Address after:Room 702, 7th floor, NO.67, Beisihuan West Road, Haidian District, Beijing 100089

Patentee after:Beijing Yunji Technology Co.,Ltd.

Address before:100000 room 710, Beichen Shopping Center, No. 13, Beiyuan Road, Chaoyang District, Beijing

Patentee before:BEIJING YUNJI TECHNOLOGY Co.,Ltd.


[8]ページ先頭

©2009-2025 Movatter.jp