CN113014462A - Data conversion method, device, controller and circuit thereof - Google Patents

Data conversion method, device, controller and circuit thereof Download PDF

Info

Publication number
CN113014462A
CN113014462A CN202110200102.8A CN202110200102A CN113014462A CN 113014462 A CN113014462 A CN 113014462A CN 202110200102 A CN202110200102 A CN 202110200102A CN 113014462 A CN113014462 A CN 113014462A
Authority
CN
China
Prior art keywords
data
communication
communication equipment
transceiver
cache region
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
CN202110200102.8A
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.)
Shanghai Jaka Robot Technology Co ltd
Original Assignee
Shanghai Jaka Robot 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 Shanghai Jaka Robot Technology Co ltd filed Critical Shanghai Jaka Robot Technology Co ltd
Priority to CN202110200102.8A priority Critical patent/CN113014462A/en
Publication of CN113014462A publication Critical patent/CN113014462A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/40006Architecture of a communication node
    • H04L12/40013Details regarding a bus controller
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/40169Flexible bus arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40215Controller Area Network CAN

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Communication Control (AREA)

Abstract

The application provides a data conversion method, a data conversion device, a controller and a circuit thereof. The data conversion method comprises the steps of obtaining communication cycles of the CAN communication equipment and data quantity threshold values received by the CAN communication equipment in each cycle, converting first RS485 data into first CAN data when the first RS485 data sent by the RS485 transceiver are received, and sequentially sending the first CAN data to the CAN communication equipment through the CAN transceiver according to a plurality of communication cycles. The method and the device adopt the communication parameters of the CAN communication equipment, and control the conversion and sending states of the data according to the communication parameters; under the condition that the control data of the CAN communication system is not influenced, the function of converting RS485 data into CAN data is realized, and the technical problem that the CAN data sent by other equipment on the CAN bus is abnormal due to high occupancy rate of the CAN bus when the RS485 data is converted into the CAN data is solved.

Description

Data conversion method, device, controller and circuit thereof
Technical Field
The present disclosure relates to the field of CAN bus communication technologies, and in particular, to a data conversion method, an apparatus, a controller, and a circuit thereof.
Background
The CAN bus equipment is convenient to network, the hardware data of the CAN bus equipment is transmitted based on message and hardware check, the reliability is high, and the CAN bus equipment is widely applied to scenes such as industrial control, intelligent communities, automobile electronic networks and the like; the RS485 has the characteristics of multi-node support, long transmission distance, high receiving sensitivity, simple connection, capability of inhibiting common-mode interference, low cost and the like, and is widely applied to various industrial control environments such as multi-station and remote communication.
At present, the RS485-CAN converter is mostly used for realizing the connection between RS485 communication equipment and a CAN bus network. However, the existing RS485-CAN converter immediately transmits the RS485 data to the CAN bus after receiving the data, and when the RS485 data volume is large, the occupancy rate of the CAN bus is high, which easily causes the abnormality that other devices on the CAN bus send the CAN data.
Disclosure of Invention
An object of the embodiments of the present application is to provide a data conversion method, an apparatus, a controller, and a circuit thereof, so as to solve the technical problem that when the RS485 data volume is large, the existing RS485-CAN converter has a high CAN bus occupancy rate during conversion, which easily causes that other devices on the CAN bus send CAN data abnormally.
In a first aspect, an embodiment of the present application provides a data conversion method, for implementing data conversion between an RS485 communication device and a CAN communication device, including the following steps:
the method comprises the steps of obtaining communication parameters of CAN communication equipment, wherein the communication parameters comprise communication periods and data volume thresholds received by the CAN communication equipment in each period;
receiving first RS485 data sent by RS485 communication equipment through an RS485 transceiver;
converting the first RS485 data into first CAN data and caching the first CAN data in a first cache region; the first CAN data comprises a plurality of CAN data segments, and the data volume of each CAN data segment is less than or equal to the data volume threshold value;
and sequentially sending the plurality of CAN data segments to the CAN communication equipment through a CAN transceiver according to a plurality of communication periods, wherein each communication period sends one CAN data segment.
In the process, communication parameters of the CAN communication equipment are acquired, wherein the communication parameters comprise communication periods and data volume thresholds received by the CAN communication equipment in each period; receiving first RS485 data sent by RS485 communication equipment through an RS485 transceiver; converting the first RS485 data into first CAN data and caching the first CAN data, wherein the first CAN data comprises a plurality of CAN data segments, and the data volume of each CAN data segment is less than or equal to a data volume threshold value; and sequentially sending the plurality of CAN data segments to CAN communication equipment through a CAN transceiver according to a plurality of communication periods, wherein each communication period sends one CAN data segment. The data conversion method is used for controlling the conversion and sending states of the data according to the communication parameters after the communication parameters of the CAN communication equipment are received; under the condition that the control data of the CAN communication system is not influenced, the function of converting RS485 data into CAN data is realized, and the technical problem that the CAN data sent by other equipment on the CAN bus is abnormal due to high occupancy rate of the CAN bus when the RS485 data is converted into the CAN data is solved.
Optionally, the sending the plurality of CAN data segments to the CAN communication device in sequence according to a plurality of communication cycles through a CAN transceiver includes: copying the plurality of CAN data segments from the first cache region to a second cache region, and emptying the first CAN data of the first cache region; and sequentially sending the plurality of CAN data segments of the second cache region to the CAN communication equipment through a CAN transceiver according to a plurality of communication cycles.
In the process, the first CAN data of the first cache region is emptied while the plurality of CAN data segments are copied from the first cache region to the second cache region; the plurality of CAN data segments in the second cache region CAN be sequentially sent to CAN communication equipment through a CAN transceiver according to a plurality of communication periods, and meanwhile, first RS485 data sent by an RS485 transceiver are received and converted into first CAN data to be cached in the first cache region; multiple processes are carried in parallel, the data conversion efficiency is improved, and meanwhile, the waste of cache space is avoided.
Optionally, the sending the plurality of CAN data segments to the CAN communication device in sequence according to a plurality of communication cycles through a CAN transceiver includes: and sequentially transferring the plurality of CAN data segments from the first cache region to the second cache region, and sending the transferred CAN data segment to the CAN communication equipment through the CAN transceiver according to the corresponding communication period when transferring one CAN data segment.
Optionally, each time the second cache region receives a transferred CAN data segment, the transferred CAN data segment is sent to the CAN communication device according to the communication cycle of the CAN transceiver, so that the working efficiency of the CAN transceiver is improved, and the total sending time of data from the RS485 communication device to the CAN communication device is reduced.
Optionally, before the sending the plurality of CAN data segments to the CAN communication device in sequence according to a plurality of communication cycles through the CAN transceiver, the method further includes: and dividing the first CAN data into a plurality of CAN data segments.
Optionally, the data conversion method further includes: receiving second CAN data sent by the CAN communication equipment through a CAN transceiver; and converting the second CAN data into second RS485 data, caching the second RS485 data in a third cache region, and sending the second RS485 data to the RS485 communication equipment.
In the process, second CAN data sent by the CAN transceiver is received; and converting second CAN data into second RS485 data for caching, and sending the second RS485 data to the RS485 communication equipment to realize conversion and sending from the CAN data to the RS485 data.
Optionally, the converting the second CAN data into second RS485 data, buffering the second RS485 data in a third buffer, and sending the second RS485 data to the RS485 communication device includes: analyzing the second CAN data according to a protocol, converting the second CAN data into second RS485 data, and caching the second RS485 data into a third cache region; detecting the state of the RS485 bus; when the RS485 bus is in an idle state, copying the second RS485 data in the third cache region to a fourth cache region and emptying the second analytic data in the third cache region; and sending the second RS485 data in the fourth buffer area to the RS485 communication equipment.
In the process, by detecting the state of the RS485 bus, when the RS485 bus is in an idle state, the second RS485 data is sent to the RS485 communication equipment, and the phenomenon that the RS485 bus is occupied to cause data confusion is avoided when the data are sent. Meanwhile, when the RS485 bus is in an idle state, the second RS485 data of the third cache region are copied to the fourth cache region, and the second RS485 data in the third cache region are emptied, so that the utilization rate of the cache space is improved, and the problem of waste of the cache space is solved.
In a second aspect, an embodiment of the present application further provides a data processing apparatus, configured to implement data conversion between an RS485 communication device and a CAN communication device, including:
the acquisition module is used for acquiring communication parameters of the CAN communication equipment, wherein the communication parameters comprise communication periods and data thresholds received by the CAN communication equipment in each period.
And the receiving module is used for receiving first RS485 data sent by the RS485 communication equipment through the RS485 transceiver.
The conversion module is used for converting the first RS485 data into first CAN data and caching the first CAN data in a first cache region; the first CAN data comprises a plurality of CAN data segments, and the data volume of each CAN data segment is less than or equal to the data volume threshold value.
And the transmitting module is used for sequentially transmitting the plurality of CAN data segments to the CAN communication equipment through the CAN transceiver according to a plurality of communication periods, and each communication period transmits one CAN data segment.
Optionally, the receiving module is further configured to receive second CAN data sent by the CAN transceiver.
Optionally, the conversion module is further configured to convert the second CAN data into second RS485 data for caching.
Optionally, the sending module is further configured to send the second RS485 data to the RS485 communication device.
In a third aspect, an embodiment of the present application provides a controller, including a processor and a memory, where the memory stores computer readable instructions, and when the computer readable instructions are executed by the processor, the controller executes the steps in the method as provided in the first aspect.
In a fourth aspect, an embodiment of the present application provides a data conversion circuit, configured to implement data conversion between an RS485 communication device and a CAN communication device, including:
the controller is electrically connected with the CAN transceiver and the RS485 transceiver respectively;
the controller is the controller provided in the embodiment of the third aspect.
The data conversion circuit is used for acquiring communication parameters of the CAN communication equipment, and the communication parameters comprise communication periods and data quantity thresholds received by the CAN communication equipment in each period; receiving first RS485 data sent by RS485 communication equipment through an RS485 transceiver, converting the first RS485 data into first CAN data and caching the first CAN data in a first cache region; the first CAN data comprises a plurality of CAN data segments, and the data volume of each CAN data segment is less than or equal to the data volume threshold value; the plurality of CAN data segments are sequentially sent to the CAN communication equipment through a CAN transceiver according to a plurality of communication periods, and each communication period sends one CAN data segment; the data conversion circuit is further used for receiving second CAN data sent by the CAN transceiver, converting the second CAN data into second RS485 data for caching, and sending the second RS485 data to the RS485 communication equipment.
Additional features and advantages of the present application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the embodiments of the present application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a schematic structural diagram of a data conversion circuit according to an embodiment of the present disclosure.
Fig. 2 is a schematic flowchart of a data conversion method according to an embodiment of the present application.
Fig. 3 is a schematic structural diagram of a data conversion device according to an embodiment of the present application.
Fig. 4 is a schematic structural diagram of a controller according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. The terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element. The terms "first," "second," and the like are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
In order to overcome the defects in the prior art, embodiments of the present application provide a data conversion method, apparatus, controller, and circuit thereof, which control the conversion and sending states of data according to communication parameters by receiving the communication parameters of a CAN communication device; under the condition that the control data of the CAN communication system is not influenced, the function of converting RS485 data into CAN data is realized, and the technical problem that the CAN data sent by other equipment on the CAN bus is abnormal due to high occupancy rate of the CAN bus when the RS485 data is converted into the CAN data is solved.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a data conversion circuit according to an embodiment of the present disclosure, the data conversion circuit is used for connection between an RS485 communication device 101 and a CAN communication device 102, and includes a controller 4, an RS485 transceiver 103, and a CAN transceiver 104.
The RS485 communication equipment 101 is connected with the RS485 transceiver 103 through an RS485 bus, and the CAN communication equipment 102 is connected with the CAN transceiver 104 through a CAN bus.
Wherein the controller may be a MCU supporting DMA or FIFO. The DMA is direct memory access, can allow hardware devices with different speeds to communicate, and does not need to depend on a large amount of interrupt load of a processor; the FIFO CAN directly receive RS485 data or CAN data without participation of a processor after configuration.
In the process, the MCU supporting DMA or FIFO is used, the conversion between the RS485 data and the CAN data CAN be realized in a way of directly forwarding the data, no requirement is imposed on the format of the RS485 data, and the application range is wide.
The controller can also be a DSP, and can replace the MCU to realize the control of the conversion circuit.
The RS485 transceiver needs to use a transceiver with a 50Mbps rate to support RS485 communication equipment with different baud rates; wherein, the RS485 transceiver can be THVD2450 DR.
Among them, the CAN transceiver needs to be a transceiver supporting a rate of 1000 kbps; the CAN transceiver may be MAX13054ASA +, among others.
Referring to fig. 2, fig. 2 is a schematic flow chart of a data conversion method according to an embodiment of the present application, where the data conversion method is used to implement data conversion between an RS485 communication device and a CAN communication device, and the method is used in a controller, and includes the following steps:
step 201, obtaining communication parameters of the CAN communication device, where the communication parameters include communication cycles and data volume thresholds received by the CAN communication device in each cycle.
And 202, receiving first RS485 data sent by RS485 communication equipment through an RS485 transceiver.
Step 203, converting the first RS485 data into first CAN data and caching the first CAN data in a first cache region; the first CAN data comprises a plurality of CAN data segments, and the data volume of each CAN data segment is less than or equal to the data volume threshold value.
And step 204, sequentially sending the plurality of CAN data segments to CAN communication equipment through a CAN transceiver according to a plurality of communication periods, wherein each communication period sends one CAN data segment.
Referring to fig. 1, in step 201, the CAN communication device refers to a device that communicates through a CAN communication network, and the data conversion method may be used in a driving and controlling system that communicates through CAN, and it is required to acquire a system communication cycle of the driving and controlling system and a number of messages that are allowed to be sent in each communication cycle, and use the number of messages that are allowed to be sent in each communication cycle of the driving and controlling system as the data volume threshold.
In the process, the RS485 data is converted into the CAN data and is sent according to the communication period and the data quantity threshold allowed to be sent to the CAN communication equipment in each period, and the communication period in the process is controllable, so that the problem of communication system disorder caused by inconsistent communication periods of the controller and the CAN communication equipment CAN be solved. Moreover, the bandwidth of converting RS485 data into CAN data is controllable, so that the problem of abnormal control caused by high communication bus occupancy rate of a communication system due to the fact that data forwarded by RS485 communication equipment is inserted into a CAN bus irregularly CAN be effectively solved.
In step 202, the RS485 communication device is a device adopting RS485 communication, the RS485 data is transmitted from the RS485 communication device to the RS485 transceiver through the RS485 bus, and the RS485 data to be forwarded to the CAN bus is recorded as the first RS485 data.
In step 203, the first RS485 data is parsed into CAN data according to a protocol for caching, the parsed CAN data is cached in a region randomly allocated by the controller, the CAN data obtained by parsing the first RS485 data is recorded as the first CAN data, and the region where the first CAN data is cached is recorded as the first cache region. In step 204, a plurality of CAN data segments are sequentially sent to the CAN communication device through the CAN transceiver according to a plurality of communication cycles, and each communication cycle sends one CAN data segment, which specifically includes: and transferring the plurality of CAN data segments from the first cache region to the second cache region in sequence, and sending the transferred CAN data segment to CAN communication equipment through a CAN transceiver according to a corresponding communication cycle after transferring one CAN data segment. The plurality of CAN data segments in the second cache region are sequentially sent to the CAN communication equipment through the CAN transceiver according to a plurality of communication periods, the first cache region is emptied, the first RS485 data sent by the RS485 transceiver are continuously received, the first RS485 data are converted into the first CAN data, the first CAN data are cached in the first cache region, the utilization efficiency of a cache space is improved, a plurality of processes are carried out, and the data conversion efficiency is improved. The CAN data segments are divided according to a data volume threshold value, and the data volume of each CAN data segment is ensured to be less than or equal to the data volume threshold value; the second cache region is also a region randomly allocated by the controller in the data transfer process; the CAN communication equipment comprises a CAN bus, a CAN transceiver and a driving and controlling system, wherein the CAN bus is used for transmitting a plurality of CAN data segments to the CAN bus through the CAN transceiver and transmitting the CAN data segments to the CAN communication equipment or the driving and controlling system which uses the CAN to communicate.
In some optional embodiments, the data conversion method of the present application may further include the steps of:
and step 205, receiving second CAN data sent by the CAN communication equipment through the CAN transceiver.
And step 206, converting the second CAN data into second RS485 data for caching.
And step 207, sending the second RS485 data to the RS485 communication equipment.
In step 205, the CAN data is transmitted from the CAN communication device to the RS485 transceiver through the CAN bus, and the RS485 data that needs to be forwarded to the RS485 bus is recorded as the first RS485 data.
In step 206, the second CAN data is parsed into a byte stream according to a protocol for buffering, the parsed byte stream is buffered in a region randomly allocated by the controller, the byte stream obtained by parsing the second CAN data is recorded as second RS485 data, and the region where the second RS485 data is buffered is recorded as a third buffer region.
In step 207, sending the second RS485 data to the RS485 communication device specifically includes: the second CAN data are analyzed and converted into second RS485 data, and the second RS485 data are cached in a third cache region; detecting the state of the RS485 bus; one RS485 data may be composed of a plurality of CAN messages, and the analyzed second RS485 data needs to be packaged and then sent to RS485 communication equipment. When the RS485 bus is in an idle state, copying the second RS485 data in the third cache region to the fourth cache region and emptying the second RS485 data in the third cache region; and packaging the second RS485 data in the fourth cache region into RS485 data and sending the RS485 data to RS485 communication equipment through an RS485 bus. The fourth buffer area is also an area randomly allocated by the controller in the data transfer process.
As CAN be seen from the above, in the data conversion method provided in the embodiment of the present application, the communication parameters of the CAN communication device are obtained, where the communication parameters include communication cycles and data volume thresholds received by the CAN communication device in each cycle; receiving first RS485 data sent by RS485 communication equipment through an RS485 transceiver; converting the first RS485 data into first CAN data and caching the first CAN data, wherein the first CAN data comprises a plurality of CAN data segments, and the data volume of each CAN data segment is less than or equal to a data volume threshold value; and sequentially sending the plurality of CAN data segments to CAN communication equipment through a CAN transceiver according to a plurality of communication periods, wherein each communication period sends one CAN data segment. By adopting the technical scheme of receiving the communication parameters of the CAN communication equipment and controlling the conversion sending state of the data according to the communication parameters, the method CAN realize the function of converting RS485 data into CAN data under the condition of not influencing the control data of the CAN communication system, and solves the technical problems that the occupancy rate of a CAN bus is high and other equipment on the CAN bus is easy to send CAN data abnormally when the RS485 data is converted into CAN data.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a data conversion apparatus in some embodiments of the present application. The data conversion apparatus includes: the device comprises an acquisition module 301, a receiving module 302, a conversion module 303 and a sending module 304.
An obtaining module 301, configured to obtain communication parameters of a CAN communication device, where the communication parameters include communication cycles and a data amount threshold received by the CAN communication device in each cycle;
the receiving module 302 is used for receiving first RS485 data sent by the RS485 transceiver;
the conversion module 303 is configured to convert the first RS485 data into first CAN data and buffer the first CAN data in a first buffer area; the first CAN data comprises a plurality of CAN data segments, and the data volume of each CAN data segment is less than or equal to the data volume threshold value;
and the sending module 304 is configured to send the plurality of CAN data segments to the CAN communication device in sequence according to a plurality of communication cycles through the CAN transceiver, where each communication cycle sends one CAN data segment.
Optionally, the obtaining module 301 is specifically configured to: the CAN communication device refers to a device that performs communication using a CAN communication network, and for a drive and control system that performs communication using a CAN, it is necessary to acquire a system communication cycle of the drive and control system and a number of messages that are allowed to be sent in each communication cycle, and use the number of messages that are allowed to be sent in each communication cycle of the drive and control system as the data volume threshold. In the process, the RS485 data is converted into the CAN data and is sent according to the communication period and the data quantity threshold allowed to be sent to the CAN communication equipment in each period, and the communication period in the process is controllable, so that the problem of communication system disorder caused by inconsistent communication periods of the controller and the CAN communication equipment CAN be solved. Moreover, the bandwidth of converting RS485 data into CAN data is controllable, so that the problem of abnormal control caused by high communication bus occupancy rate of a communication system due to the fact that data forwarded by RS485 communication equipment is inserted into a CAN bus irregularly CAN be effectively solved.
Optionally, the receiving module 302 is specifically configured to: the RS485 communication equipment is equipment adopting RS485 communication, RS485 data are transmitted to the RS485 transceiver from the RS485 communication equipment through the RS485 bus, and the RS485 data required to be forwarded to the CAN bus are recorded as first RS485 data.
Optionally, the conversion module 303 is specifically configured to: the first RS485 data is analyzed into CAN data to be cached according to a protocol, the analyzed CAN data is cached in a region randomly distributed by a controller, the CAN data obtained by analyzing the first RS485 data is marked as first CAN data, and the region where the first CAN data is cached is marked as a first cache region.
Optionally, the sending module 304 is specifically configured to: the CAN data segments are sequentially sent to the CAN communication equipment through the CAN transceiver according to a plurality of communication periods, and each communication period sends one CAN data segment, and the CAN communication equipment specifically comprises the following steps: and transferring the plurality of CAN data segments from the first cache region to the second cache region in sequence, and sending the transferred CAN data segment to CAN communication equipment through a CAN transceiver according to a corresponding communication cycle after transferring one CAN data segment. The plurality of CAN data segments in the second cache region are sequentially sent to the CAN communication equipment through the CAN transceiver according to a plurality of communication periods, the first cache region is emptied, the first RS485 data sent by the RS485 transceiver are continuously received, the first RS485 data are converted into the first CAN data, the first CAN data are cached in the first cache region, the utilization efficiency of a cache space is improved, a plurality of processes are carried out, and the data conversion efficiency is improved. The CAN data segments are divided according to a data volume threshold value, and the data volume of each CAN data segment is ensured to be less than or equal to the data volume threshold value; the second cache region is also a region randomly allocated by the controller in the data transfer process; the CAN communication equipment comprises a CAN bus, a CAN transceiver and a driving and controlling system, wherein the CAN bus is used for transmitting a plurality of CAN data segments to the CAN bus through the CAN transceiver and transmitting the CAN data segments to the CAN communication equipment or the driving and controlling system which uses the CAN to communicate.
In some optional embodiments, the receiving module 302 is further configured to receive second CAN data transmitted by the CAN transceiver.
In some optional embodiments, the conversion module 303 is further configured to convert the second CAN data into second RS485 data and buffer the second RS485 data in a third buffer area.
In some optional embodiments, the sending module 304 is further configured to send the second RS485 data to the RS485 communication device.
Optionally, the receiving module 302 is further specifically configured to: CAN data are transmitted to the RS485 transceiver from CAN communication equipment through the CAN bus, and RS485 data which need to be forwarded to the RS485 bus are recorded as first RS485 data.
Optionally, the conversion module 303 is further specifically configured to: and resolving the second CAN data into a byte stream according to a protocol for caching, caching the resolved byte stream in a region randomly distributed by the controller, recording the byte stream obtained by resolving the second CAN data as second RS485 data, and recording the region where the second RS485 data is cached as a third cache region.
Optionally, the sending module 304 is further specifically configured to: sending the second RS485 data to the RS485 communication equipment, specifically, analyzing and converting second CAN data into second RS485 data, and caching the second RS485 data into a third cache region; detecting the state of the RS485 bus; one RS485 data may be composed of a plurality of CAN messages, and the analyzed second RS485 data needs to be packaged and then sent to RS485 communication equipment. When the RS485 bus is in an idle state, copying the second RS485 data in the third cache region to the fourth cache region and emptying the second RS485 data in the third cache region; and packaging the second RS485 data in the fourth cache region into RS485 data and sending the RS485 data to RS485 communication equipment through an RS485 bus. The fourth buffer area is also an area randomly allocated by the controller in the data transfer process.
The data conversion device acquires communication parameters of the CAN communication equipment, wherein the communication parameters comprise communication periods and data quantity thresholds received by the CAN communication equipment in each period; receiving first RS485 data sent by an RS485 transceiver; converting the first RS485 data into first CAN data and caching the first CAN data, wherein the first CAN data comprises a plurality of CAN data segments, and the data volume of each CAN data segment is less than or equal to a data volume threshold value; and sequentially sending the plurality of CAN data segments to CAN communication equipment through a CAN transceiver according to a plurality of communication periods, wherein each communication period sends one CAN data segment. By adopting the technical scheme of receiving the communication parameters of the CAN communication equipment and controlling the conversion sending state of the data according to the communication parameters, the method CAN realize the function of converting RS485 data into CAN data under the condition of not influencing the control data of the CAN communication system, and solves the technical problems that the occupancy rate of a CAN bus is high and other equipment on the CAN bus is easy to send CAN data abnormally when the RS485 data is converted into CAN data.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a controller according to an embodiment of the present application, where the present application provides a controller 4, including: the processor 401 and the memory 402, the processor 401 and the memory 402 being interconnected and communicating with each other via a communication bus 403 and/or other form of connection mechanism (not shown), the memory 402 storing a computer program executable by the processor 401, the processor 401 executing the computer program when the computing device is running to perform the method of any of the alternative implementations of the embodiments described above.
In the embodiments provided in the present application, it should be understood that the disclosed method, apparatus, and circuit may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
In addition, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
Furthermore, the functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (10)

1. A data conversion method is used for realizing data conversion between RS485 communication equipment and CAN communication equipment, and is characterized by comprising the following steps:
acquiring communication parameters of the CAN communication equipment, wherein the communication parameters comprise communication periods and data volume thresholds received by the CAN communication equipment in each period;
receiving first RS485 data sent by RS485 communication equipment through an RS485 transceiver;
converting the first RS485 data into first CAN data and caching the first CAN data in a first cache region; the first CAN data comprises a plurality of CAN data segments, and the data volume of each CAN data segment is less than or equal to the data volume threshold value;
and sequentially sending the plurality of CAN data segments to the CAN communication equipment through a CAN transceiver according to a plurality of communication periods, wherein each communication period sends one CAN data segment.
2. The data conversion method according to claim 1, wherein the sequentially transmitting the plurality of CAN data segments to the CAN communication device through a CAN transceiver and in a plurality of communication cycles comprises:
copying the plurality of CAN data segments from the first cache region to a second cache region, and emptying the first CAN data of the first cache region;
and sequentially sending the plurality of CAN data segments of the second cache region to the CAN communication equipment through the CAN transceiver according to a plurality of communication cycles.
3. The data conversion method according to claim 1, wherein the sequentially transmitting the plurality of CAN data segments to the CAN communication device through a CAN transceiver and in a plurality of communication cycles comprises:
and sequentially transferring the plurality of CAN data segments from the first cache region to the second cache region, and sending the transferred CAN data segment to the CAN communication equipment through the CAN transceiver according to the corresponding communication period when transferring one CAN data segment.
4. The data conversion method according to claim 2 or 3, wherein before the sequentially transmitting the plurality of CAN data segments to the CAN communication device through a CAN transceiver in a plurality of communication cycles, the method further comprises:
and dividing the first CAN data into a plurality of CAN data segments.
5. The method of claim 1, further comprising:
receiving second CAN data sent by the CAN communication equipment through a CAN transceiver;
and converting the second CAN data into second RS485 data, caching the second RS485 data in a third cache region, and sending the second RS485 data to the RS485 communication equipment.
6. The method of claim 5, wherein converting the second CAN data into second RS485 data and buffering the second RS485 data in a third buffer area, and sending the second RS485 data to the RS485 communication device comprises:
analyzing the second CAN data, converting the second CAN data into second RS485 data, and caching the second RS485 data into a third cache region;
detecting the state of the RS485 bus;
when the RS485 bus is in an idle state, copying the second RS485 data in the third cache region to a fourth cache region and emptying the second RS485 data in the third cache region;
and sending the second RS485 data in the fourth cache region to the RS485 communication equipment through the RS485 bus.
7. A data conversion device is used for realizing data conversion between RS485 communication equipment and CAN communication equipment, and comprises:
the CAN communication equipment comprises an acquisition module, a processing module and a control module, wherein the acquisition module is used for acquiring communication parameters of the CAN communication equipment, and the communication parameters comprise communication cycles and data volume thresholds received by the CAN communication equipment in each cycle;
the receiving module is used for receiving first RS485 data sent by the RS485 transceiver;
the conversion module is used for converting the first RS485 data into first CAN data and caching the first CAN data in a first cache region; the first CAN data comprises a plurality of CAN data segments, and the data volume of each CAN data segment is less than or equal to the data volume threshold value;
and the transmitting module is used for sequentially transmitting the plurality of CAN data segments to the CAN communication equipment through the CAN transceiver according to a plurality of communication periods, and each communication period transmits one CAN data segment.
8. The data conversion apparatus according to claim 7,
the receiving module is also used for receiving second CAN data sent by the CAN transceiver;
the conversion module is further used for converting the second CAN data into second RS485 data and caching the second RS485 data in a third cache region;
the sending module is further configured to send the second RS485 data to the RS485 transceiver.
9. A controller comprising a processor and a memory, the memory storing computer readable instructions which, when executed by the processor, perform the method of any one of claims 1 to 6.
10. A data conversion circuit is used for realizing data conversion between RS485 communication equipment and CAN communication equipment, and comprises:
the controller is electrically connected with the CAN transceiver and the RS485 transceiver respectively;
the controller is the controller of claim 9.
CN202110200102.8A 2021-02-22 2021-02-22 Data conversion method, device, controller and circuit thereof Pending CN113014462A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110200102.8A CN113014462A (en) 2021-02-22 2021-02-22 Data conversion method, device, controller and circuit thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110200102.8A CN113014462A (en) 2021-02-22 2021-02-22 Data conversion method, device, controller and circuit thereof

Publications (1)

Publication Number Publication Date
CN113014462A true CN113014462A (en) 2021-06-22

Family

ID=76407059

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110200102.8A Pending CN113014462A (en) 2021-02-22 2021-02-22 Data conversion method, device, controller and circuit thereof

Country Status (1)

Country Link
CN (1) CN113014462A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101388732A (en) * 2008-10-21 2009-03-18 北京科技大学 In-situ test system and method oriented to water sound sensor network
CN102202058A (en) * 2011-05-19 2011-09-28 中国兵器工业集团第二一四研究所苏州研发中心 Controller for protocol conversion between multipath UART bus and CAN bus
US20140210593A1 (en) * 2013-01-29 2014-07-31 Innovative Design Solutions, Inc. Rv wireless remote control
US20140294625A1 (en) * 2013-03-15 2014-10-02 Levant Power Corporation Contactless sensing of a fluid-immersed electric motor
CN106326155A (en) * 2016-08-19 2017-01-11 南京理工大学 Multi-bus data recording and playback device and method
CN109525474A (en) * 2018-12-06 2019-03-26 连云港杰瑞深软科技有限公司 A kind of multiplex roles protocol-intelligent converter and conversion method based on Linux platform
CN110244604A (en) * 2019-05-29 2019-09-17 北京大豪科技股份有限公司 Data transmission method, device, electronic equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101388732A (en) * 2008-10-21 2009-03-18 北京科技大学 In-situ test system and method oriented to water sound sensor network
CN102202058A (en) * 2011-05-19 2011-09-28 中国兵器工业集团第二一四研究所苏州研发中心 Controller for protocol conversion between multipath UART bus and CAN bus
US20140210593A1 (en) * 2013-01-29 2014-07-31 Innovative Design Solutions, Inc. Rv wireless remote control
US20140294625A1 (en) * 2013-03-15 2014-10-02 Levant Power Corporation Contactless sensing of a fluid-immersed electric motor
CN106326155A (en) * 2016-08-19 2017-01-11 南京理工大学 Multi-bus data recording and playback device and method
CN109525474A (en) * 2018-12-06 2019-03-26 连云港杰瑞深软科技有限公司 A kind of multiplex roles protocol-intelligent converter and conversion method based on Linux platform
CN110244604A (en) * 2019-05-29 2019-09-17 北京大豪科技股份有限公司 Data transmission method, device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CA1229879A (en) Data link extension for data communication networks
CN106789493B (en) Automobile software refreshing control method, system and gateway
KR20160065206A (en) Camera control interface slave device to slave device communication
CN110704265A (en) Early warning information active reporting method and system based on Modbus protocol
CN110569988B (en) Payment machine fault processing system and processing method
CN208227042U (en) A kind of real-time automatic fault warning device of server
CN115390545A (en) Vehicle diagnosis method, apparatus, device, readable storage medium, and program product
CN107579894B (en) FPGA-based EBR1553 bus protocol implementation device
CN103617132B (en) A kind of ethernet terminal based on shared storage sends implementation method and terminal installation
CN1764192A (en) Initial access signaling method in synchronous ethernet equipment
CN102238493B (en) Machine-to-machine (M2M)-platform-based message sequential transmission and receiving method and device
CN113014462A (en) Data conversion method, device, controller and circuit thereof
CN102148743B (en) Data flow control method, device and mobile terminal
CN111064768B (en) Printer data transmission control method, device, equipment and storage medium
CN105141483B (en) Multinode network minimal communications measuring space method based on CAN bus
CN103442091A (en) Data transmission method and device
CN102420734A (en) System for realizing topological structure of controller area network (CAN) bus
CN103890746B (en) Message transmission control method, processing method, equipment and system
CN115344522A (en) Message conversion channel, message conversion device, electronic equipment and switching equipment
CN105515925A (en) UART multi-master real-time communication system
CN111314408B (en) Local edge calculation and Internet of things management method based on communication layer multi-data item caching task
CN109787874B (en) Real-time transceiving method, equipment and storage medium based on Linux platform
US5793803A (en) Underrecovery system and method for block processing modems
CN112260849B (en) Self-adaptive exchange system for urban rail transit signal service data
CN116488957B (en) Signal processing method, system and bridge

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: Building 6, 646 Jianchuan Road, Minhang District, Shanghai 201100

Applicant after: Jieka Robot Co.,Ltd.

Address before: Building 6, 646 Jianchuan Road, Minhang District, Shanghai 201100

Applicant before: SHANGHAI JAKA ROBOTICS Ltd.

CB02 Change of applicant information
RJ01 Rejection of invention patent application after publication

Application publication date: 20210622

RJ01 Rejection of invention patent application after publication