Daisy chain communication structure and communication means
Technical field
The present invention relates to daisy chain more particularly to daisy chain communication structures and communication means.
Background technique
Daisy chain refer to it is a kind of be cascaded the garland formed by many chrysanthemums, be used to presentation technology chain, in addition to possessing
The network on starlike basis is the most easy method for increasing more computers to network through daisy chain.
Daisy chain higher cost is used at present, and this mode generallys use current-mode and needs transformer isolation, and current
Device communication between daisy chain inside needs multiple communication interfaces, and device power consumption is unbalanced in daisy chain.
Summary of the invention
For overcome the deficiencies in the prior art, one of the objects of the present invention is to provide daisy chain communication structures, can solve
Multiple communication interfaces, the unbalanced problem of power consumption are certainly used in the prior art.
The second object of the present invention is to improve daisy chain communication means, can solve and use multiple communications in the prior art
Interface, the unbalanced problem of power consumption.
An object of the present invention is implemented with the following technical solutions:
Daisy chain communication structure, including conversion module and daisy chain, conversion module are connect with a MCU, the daisy chain
Including several sequentially connected devices, arrange the device in wherein one end and connect with conversion module, and define be arranged in it is another
The device at end is top device, is communicated between every two adjacent device using DUART, and the MCU is used to receive external finger
It enables and transmits instruction to conversion module, conversion module is used to the data packet that described instruction is converted to preset format being sent to chrysanthemum
In chain, data packet to be transmitted in the device of top by daisy chain, the top device is also used to for feedback information being sent to
In daisy chain in adjacent device, in daisy chain any one device by from a upper adjacent devices feedback information and from
The feedback information of body is integrated into new feedback information and is sent in next adjacent device, so that conversion module will be from mutual
The new feedback information of the device of connection is sent to MCU.
Preferably, Synchronization agreement is all made of between the conversion module and daisy chain and inside daisy chain.
Preferably, mutual by the port DUART_H and DUART_L between two devices of arbitrary neighborhood in daisy chain
Connection.
Preferably, it is connected between the MCU and conversion module by SPI interface.
Preferably, the preset format of the data packet is title+effective information+check code.
Preferably, feedback information includes status information and data.
Preferably, the format of the status information is type+data inspection state+check code.
Preferably, the format of the data is type+data+check code.
The second object of the present invention uses following technical scheme:
Daisy chain communication means is applied to daisy chain, and the daisy chain includes several sequentially connected devices, is arranged in
Wherein the device of one end is connect with conversion module, and it is top device that definition, which is arranged in the device of the other end, is included the following steps:
S1: the data packet from conversion module is received, the data packet is by conversion module to the instruction from MCU with default
Format carries out conversion formation;
S2: data packet is transferred to top device by device upwards in turn;
S3: receiving the feedback information from top device, and in adjacent device, next device will come from a upper device
The feedback information of part and the feedback information of itself are integrated into new feedback information, and adjacent device successively transmits downwards new anti-
Feedforward information, so that new feedback information is sent to MCU by conversion module.
Compared with prior art, the beneficial effects of the present invention are:
DUART communication interface standard built in daisy chain device of the invention, it is only necessary to which each two communication interfaces up and down are realized
Half-duplex bidirectional setting and communication protocol support that setting top device is for supporting two -way difference DUART, the difference of voltage mode
DUART supports the high-voltage capacitor isolation of low cost, improves communication efficiency, power consumption is more balanced.
Detailed description of the invention
Fig. 1 is the function structure chart of daisy chain communication structure of the invention;
Fig. 2 is that transmission figure is read in the broadcast of daisy chain communication structure of the invention;
Fig. 3 is the flow chart of daisy chain communication means of the invention.
Specific embodiment
In the following, being described further in conjunction with attached drawing and specific embodiment to the present invention:
Referring to figs. 1 and 2, the present invention includes conversion module (convertor in Fig. 1) and daisy chain, conversion
Module is connect with a MCU, and the daisy chain includes several sequentially connected devices (Device), arranges the device in wherein one end
Part is connect with conversion module, and it is top device that definition, which is arranged in the device of the other end, is used between every two adjacent device
DUART (Difference Universal Asynchronous Receiver/Transmitter difference universal asynchronous receiving-transmitting
Transmitter) communication, for the MCU for receiving external instruction and transmitting instruction to conversion module, conversion module is used for will be described
The data packet that instruction is converted to preset format is sent in daisy chain, data packet is transmitted to top device by daisy chain
In, the top device is also used to for feedback information being sent in device adjacent in daisy chain, any one device in daisy chain
Part by from a upper adjacent devices feedback information and the feedback information of itself be integrated into new feedback information and be sent to down
In one adjacent device, so that the new feedback information from device interconnected is sent to MCU by conversion module.
Difference DUART supports the communication of a variety of isolating devices, inductance, capacitor.We use single group half-duplex bidirectional difference
DUART interface, so that upper lower communication interface number optimizes, corresponding interface harness minimum number.Suitable for this kind of control instruction
Clearly daisy chain structure.Device can be chronically at the sleep state of low-power consumption, be waken up by DUART interface, receive communication
Instruction.Top (TOP) device can be set automatically in daisy chain, complete instruction operation after, carry out result passback when by top device
Part carries out passback transmission first, and the addition of more results is back to MCU again by intermediary device together.Data packet is used in device communication
Mutual information transmission is carried out, the response (response) that the order (command) and device that MCU is issued return all makes
Use packet structure.Synchronization agreement is all made of between conversion module and daisy chain and inside daisy chain.In chrysanthemum
In chain, interconnected between two devices of arbitrary neighborhood by DUART_H and the port DUART_L.Between MCU and conversion module
It is connected by SPI interface.Manchester's code, every number are all carried out for every bit valid data in transmission in device communication
It all include effective information and 8bit CRC check position according to packet, preset format is title CMD (16bit)+effective information CTRL
(16bit)+check code CRC (8bit).
Feedback information includes status information and data.The format of status information is that type TYPE (1bit)+data check shape
State DC (16bit)+check code CRC (8bit).The format of data is type TYPE (1bit)+data DATA (16bit)+check code
CRC(8bit).The position the bit TYPE of highest order corresponds to register data and non-register data, and last 8 are check bit, intermediate
16bit is the wrong status information or ADC test data that the data inspection (Data Check) returned obtains.
Power consumption Equalization Design of the invention is embodied in, A) initialization when be arranged TOP (top) device, B) master (MCU)
When write-in, being sent out in TOP device synchronization, the automatic power consumption that is arranged is balanced, C) master is when reading data, from TOP device returned data
When, corresponding redundant data can be matched so that each Device transmission data number it is consistent, D) execute instruction sending after, device
Part, which successively receives to execute instruction, to be started to execute, and TOP device can also be simultaneously sent to next stage completion equilibrium after receiving instruction.TOP
Device returns to OK instruction after the completion of executing, the status register after the completion of successively executing with each device is thought or and returned.
The multi-disc cooperative work mode for supporting distributed link and daisy chain link, using DUART communication interface, daisy chain
In link, address pattern (address) and broadcast mode (broadcast) can be taken to be communicated.Device can pass through 4 line SPI
It is communicated between MCU, passes through the two-way DUART communication of 2 line half-duplex difference between device.It is carried out in pattern chain linking communications
Active power consumption Equalization Design is examined with guaranteeing that the power consumption of each device at work is roughly equal in entire daisy chain in battery strings
It surveys in application, the consumption for reducing each battery unit to greatest extent is unbalanced.
Communication transmitting data of the invention includes two classes, is order and response respectively, from MCU to top device sending direction
Transmission is order, and from top, device direction is transmitted to the data of MCU to respond.
In daisy chain chain, interconnected between device by DUART_H and the port DUART_L.Daisy chain end turns
Mold changing block is connect by SPI with MCU, which is used for the protocol conversion of general SPI interface and DUART interface, is completed graceful
Chester encoding and decoding.SPI order is converted into the DUART transmission of Manchester's code.User only needs to send un-encoded
SPI order, device will transmission be instructed and is returned the result in isolation daisy chain (daisy-chain) automatically.
In conjunction with Fig. 3, daisy chain communication means provided by the invention is applied to daisy chain, the daisy chain include several according to
The device of secondary connection arranges the device in wherein one end and connect with conversion module, and definition is arranged in the device of the other end as top
End-apparatus part, method include the following steps:
S1: the data packet from conversion module is received, the data packet is by conversion module to the instruction from MCU with default
Format carries out conversion formation;
S2: data packet is transferred to top device by device upwards in turn;
S3: receiving the feedback information from top device, and in adjacent device, next device will come from a upper device
The feedback information of part and the feedback information of itself are integrated into new feedback information, and adjacent device successively transmits downwards new anti-
Feedforward information, so that new feedback information is sent to MCU by conversion module.
Description is consistent in daisy chain communication means principle and daisy chain communication structure of the invention, and details are not described herein.
It will be apparent to those skilled in the art that can make various other according to the above description of the technical scheme and ideas
Corresponding change and deformation, and all these changes and deformation all should belong to the protection scope of the claims in the present invention
Within.