A transmission protocol adaptive decoding system and method
By designing an adaptive decoding system in the DMX512 protocol decoding system, using the division operation and rounding of the counter and judgment module to generate sampling pulses, the problem of error accumulation and large hardware resource consumption when the oscillator frequency is increased is solved, and a wide range of transmission rates is achieved Adaptive error-free decoding and cost reduction.
Patent Information
- Application Number
- CN201911016741.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-10-24
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2039-10-24
AI Technical Summary
When the existing DMX512 protocol decoding method increases the oscillator frequency, error accumulation leads to decoding errors, and hardware resource consumption is large, making it difficult to achieve adaptive decoding of a wide range of transmission rates without errors.
Design a transmission protocol adaptive decoding system, including an internal oscillator, detection module, counter, judgment module and pulse generation module. By detecting the preset learning field time length, performing division operation and using rounding to generate sampling pulses, the sampling pulse is determined cycle to achieve adaptive error-free decoding and minimize hardware resource consumption.
When the internal oscillator speed does not need to be too high, adaptive decoding of a wide range of transmission rates is achieved, reducing hardware resource consumption and costs.
Smart Images

Figure CN110635854B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of integrated circuits, and in particular relates to a transmission protocol adaptive decoding system and method. Background Art
[0002] DMX512-1990 communication protocol is a digital multiplexing protocol. Currently, almost all lighting / stage equipment manufacturers support this control protocol. As a widely used digital lighting data protocol, DMX512-1990 has also become an international standard for lighting control. The unification of the DMX512 protocol allows the equipment of various manufacturers to be interconnected, which greatly improves compatibility. In addition, since the DMX512 protocol uses serial transmission of digital signals, only one signal line is needed between the console and the equipment, which greatly simplifies the connection line between the controller and the equipment.
[0003] The DMX512 protocol can control the brightness of lighting equipment by sending data packets on the bus. At the same time, the protocol itself has extremely strict regulations on the timing of each part of the data packet. Each field has 11 bits, including a 0 start bit, 8 data bits, and 2 stop bits. The 0 start bit is low level, the stop bit is high level, and if the data in the data bit is 0, the corresponding time period is low level. If the data is 1, the corresponding time period is high level. The bit lengths of the 0 start bit, stop bit, and data bit must be the same. The DMX512 timing diagram is as follows: Figure 1 shown.
[0004] A complete DMX512 data packet format consists of an MTBP signal, a BREAK signal, a MAB signal, a SC signal, and a data frame. Its meaning is as follows:
[0005] MTBP: Indicates that a complete DMX512 data packet has been sent. It is also the marker for the next data packet to start. High level is valid, indicating that the current transmission line is in an idle state and there is no data transmission. BREADK: Data packet start control signal, corresponding to the reset phase after the end of a data packet. After the reset is completed, the next packet of data should be sent. The BREAK signal is valid at a low level and lasts for no less than 88uS. MAB: The protocol stipulates that MAB is two bits long and is valid at a high level. SC: The start code, which is the same as a normal data frame, but its 8 data bits are all 0, marking the beginning of the data frame in the data packet.
[0006] An existing protocol decoding method is: by detecting the time width of the starting byte of each frame of data, the time width of each subsequent byte is determined, that is, the above-mentioned SC segment. This field consists of 1 start flag bit, 8 all-zero bits, and 2 end flags. Since the 9 Bits 0 in the start field are between the MAB segment and the 2 Bits end flag bits, the time width of the 9 Bits 0 is relatively easy to detect. Through the built-in oscillator, the 9 Bits 0 time is counted, and division is performed during the sampling process to obtain the time width of each bit. This time width is an integer multiple of the oscillator period. Currently, the practice of retaining integer bits is usually adopted, but when decoding each bit of data, errors will be accumulated. Figure 1 As shown, sampling is generally performed at the data center location. When decoding each bit, a remainder error is accumulated. If the remainder value is large, the accumulated error may cause decoding errors. In order to sample the start field time width more accurately, this method continuously increases the frequency of the oscillator. The higher the frequency, the smaller the maximum accumulated error obtained by the integer retention method relative to the sampling period.
[0007] Another existing protocol decoding method is: by detecting the time width of 9 bits 0, the time width of each bit is obtained. However, when performing division operations, the quotient and remainder are retained, and the sampling period is determined based on the quotient and remainder. The sampling period includes two sampling pulse intervals, one is NT and the other is (N+1)T, that is, the remainder in the division operation is evenly inserted into different bit samples to achieve accurate data sampling. This solution can decode DMX512 data very accurately, but it consumes a lot of hardware resources during the implementation process. Summary of the invention
[0008] In view of the defects in the prior art, the present invention provides a transmission protocol adaptive decoding system and method, which can achieve adaptive error-free decoding of a wide range of transmission rates without requiring the internal oscillator speed to be too high, while minimizing the consumption of hardware resources to reduce costs.
[0009] In a first aspect, a transmission protocol adaptive decoding system includes an internal oscillator, a detection module, a counter, a judgment module and a pulse generation module;
[0010] The internal oscillator is used to generate a clock and provide it to the detection module and the pulse generation module;
[0011] The detection module is used to generate an enable control signal and transmit it to the counter when a preset learning field is detected on the data line;
[0012] The counter is used to count the time length of the learning field on the data line when receiving the enable control signal, and perform a division operation on the counting result to output the quotient and the remainder;
[0013] The judgment module is used to determine the sampling pulse period according to the quotient and remainder output by the counter;
[0014] The pulse generating module is used to generate a sampling pulse according to the sampling pulse period determined by the judging module.
[0015] Preferably, the counter is specifically used for:
[0016] Perform a division K operation on the counting result; wherein K is the number of bits of the learning field.
[0017] Preferably, the judgment module is specifically used for:
[0018] When the remainder M of the counter output is monitored to be greater than K / 2, the sampling pulse period is set to NT. When the remainder M of the counter output is monitored to be less than or equal to K / 2, the sampling pulse period is set to (N-1)T, where T is the clock period generated by the internal oscillator and N is the quotient of the counter output.
[0019] Preferably, the counter comprises a remainder counter, which specifically comprises L first triggers connected in series, a first AND gate and a first logic unit; wherein, 2 L ≥K;
[0020] The output end of the internal oscillator is connected to the clock end of the first first trigger, the positive output end of the previous first trigger is connected to the clock end of the next first trigger, the positive output end of each first trigger is connected to different input ends of the first logic unit, and the reverse output end of each first trigger is connected to the data end of the first trigger;
[0021] The output end of the detection module is connected to an input end of the first AND gate, the remainder count overflow output end of the first logic unit is connected to the other input end of the first AND gate, and the output ends of the first AND gate are connected to the reset end of the first trigger;
[0022] The remainder count overflow output terminal, the remainder output terminal and the quotient count terminal of the first logic unit are connected to the judgment module.
[0023] Preferably, the counter further comprises a quotient counter, and the quotient counter comprises P second flip-flops, a second AND gate and a second logic unit connected in series;
[0024] The output end of the detection module is connected to an input end of the second AND gate, the quotient counting end of the first logic unit is connected to the other input end of the second AND gate, the output end of the second AND gate is connected to the clock end of the first second trigger, the positive output end of the previous second trigger is connected to the clock end of the next second trigger, the positive output end of each second trigger is connected to a different input end of the second logic unit, and the reverse output end of each second trigger is connected to the data end of the second trigger; the reset ends of all second triggers are connected to the output end of the detection module;
[0025] The quotient output terminal of the second logic unit is connected to the judgment module.
[0026] Preferably, both the first trigger and the second trigger are D triggers.
[0027] In a second aspect, a transmission protocol adaptive decoding method comprises the following steps:
[0028] When the detection module detects a preset learning field on the data line, it generates an enable control signal and transmits it to the counter;
[0029] When receiving the enable control signal, the counter counts the time length of the learning field on the data line, performs a division operation on the counting result, and outputs a quotient and a remainder;
[0030] The judgment module determines the sampling pulse period according to the quotient and remainder output by the counter;
[0031] The pulse generating module generates a sampling pulse according to the sampling pulse period determined by the judging module.
[0032] Preferably, the counter performs a division operation on the counting result specifically including:
[0033] The counter performs a K division operation on the counting result, wherein K is the number of bits of the learning field.
[0034] Preferably, the judging module determines the sampling pulse period according to the quotient and remainder output by the counter, specifically comprising:
[0035] When the judgment module detects that the remainder M of the counter output is greater than K / 2, the sampling pulse period is set to NT. When the judgment module detects that the remainder M of the counter output is less than or equal to K / 2, the sampling pulse period is set to (N-1)T, where T is the clock period generated by the internal oscillator and N is the quotient of the counter output.
[0036] It can be seen from the above technical solution that the transmission protocol adaptive decoding system and method provided by the present invention calculates the time length of the preset learning field, performs a division operation, and generates a sampling pulse by rounding the remainder to achieve sampling of the subsequent data of the learning field. When the internal oscillator speed does not need to be too high, a wide range of transmission rate adaptive error-free decoding can be achieved, while minimizing the consumption of hardware resources to reduce costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following is a brief introduction to the drawings required for the specific embodiments or the description of the prior art. In all the drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, the elements or parts are not necessarily drawn according to the actual scale.
[0038] Figure 1 This is a schematic diagram of the data packet format of the DMX512 protocol mentioned in the background technology.
[0039] Figure 2 This is a module block diagram of the system provided in Embodiment 1 of the present invention.
[0040] Figure 3 for Figure 2 Circuit diagram of the counter.
[0041] Figure 4 for Figure 3 Timing diagram of the circuit in.
[0042] Figure 5 This is the timing diagram when the remainder M is greater than K / 2.
[0043] Figure 6 This is a timing diagram when the remainder M is less than or equal to K / 2.
[0044] Figure 7 This is a flow chart of the method provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0045] The embodiments of the technical solution of the present invention will be described in detail below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and are therefore only used as examples, and the protection scope of the present invention cannot be limited thereto. It should be noted that, unless otherwise specified, the technical terms or scientific terms used in this application should be the common meanings understood by those skilled in the art to which the present invention belongs.
[0046] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0047] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0048] As used in this specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0049] Embodiment 1:
[0050] A transmission protocol adaptive decoding system, see Figure 2 , including an internal oscillator, a detection module, a counter, a judgment module and a pulse generation module;
[0051] The internal oscillator is used to generate a clock and provide it to the detection module and the pulse generation module;
[0052] The detection module is used to generate an enable control signal and transmit it to the counter when a preset learning field is detected on the data line;
[0053] The counter is used to count the time length of the learning field on the data line when receiving the enable control signal, and perform a division operation on the counting result to output the quotient and the remainder;
[0054] The judgment module is used to determine the sampling pulse period according to the quotient and remainder output by the counter;
[0055] The pulse generating module is used to generate a sampling pulse according to the sampling pulse period determined by the judging module.
[0056] Specifically, for example, for the DMX512 protocol, the SC field can be selected as the learning field. The system can be applied to any protocol decoding. When in use, it only needs to set the start code in the protocol as the learning field. After learning the sampling period of the learning field, the system can obtain the sampling period of the protocol and determine the sampling pulse in the subsequent field decoding process.
[0057] For the DMX512 protocol, the detection module samples and times the transmission data on the data line through high-speed clock division. When it is detected that the transmission data on the data line is at a low level for more than 88uS, it is considered that the received data packet is the start control signal MTBP. At this time, the detection module continues to monitor the MAB signal. After the MAB ends, when it is detected that the transmission data on the data line becomes a low level, it is considered that the SC field is started to be received, and an enable control signal is generated and transmitted to the counter, and the control counter starts timing.
[0058] When the counter starts timing, it counts the time length of the SC start code and divides the count result by K; K is the number of bits in the learning field, and here, K=9. The judgment module determines the sampling pulse period according to the quotient and remainder output by the counter. For example, when it is monitored that the remainder M output by the counter is greater than K / 2, the sampling pulse period is set to NT. When the remainder M output by the monitoring counter is less than or equal to K / 2, the sampling pulse period is set to (N-1)T, where T is the clock period generated by the internal oscillator and N is the quotient output by the counter.
[0059] To further illustrate the accuracy of the decoding of the system, the error analysis is performed using the above DMX512 protocol. When the learning field data is 9 bits, the remainder range is 1 to 8. After being processed by the system, the error range is reduced to 1 to 4. Assuming that the maximum error value is 4, the start bit SC error is ((4 / 9) / 2)T. When decoding each bit, an error of (4 / 9)T will be accumulated, that is, the sampling error of the last bit of each frame of data is 8.5*(4 / 9)T=3.78T. Therefore, as long as (N / 2)T>3.78T is satisfied, all bits can be sampled correctly. In the current application requirements, the rate of the DMX512 protocol is 250Kbps~750Kbps, that is, the minimum time width of each bit is 1.3us. If N=8, the internal oscillator frequency only needs to reach 6.2MHz to ensure that the data is sampled normally. When the frequency is increased to 20MHz, adaptive error-free decoding with higher transmission rates of DMX512 can be supported.
[0060] The system calculates the time length of the preset learning field, performs division, and rounds the remainder to generate a sampling pulse to sample the subsequent data of the learning field. Without requiring the internal oscillator speed to be too high, a wide range of transmission rate adaptive error-free decoding can be achieved, while minimizing the consumption of hardware resources to reduce costs.
[0061] Embodiment 2:
[0062] Embodiment 2 provides the following contents based on Embodiment 1:
[0063] See also Figure 3 , the counter includes a remainder counter, which specifically includes L first triggers connected in series, a first AND gate and a first logic unit; wherein, 2 L ≥K;
[0064] The output terminal OSC of the internal oscillator is connected to the clock terminal of the first first trigger, the positive output terminal Q of the previous first trigger is connected to the clock terminal of the next first trigger, the positive output terminal Q of each first trigger is connected to different input terminals of the first logic unit, and the negative output terminal QN of each first trigger is connected to the data terminal D of the first trigger;
[0065] The output terminal CNT_EN of the detection module is connected to one input terminal of the first AND gate, the remainder count overflow output terminal M_Overflow of the first logic unit is connected to the other input terminal of the first AND gate, and the output terminals of the first AND gate are connected to the reset terminal R of the first trigger;
[0066] The remainder counting overflow output terminal M_Overflow, the remainder output terminal M_CNT and the quotient counting terminal N_CLK of the first logic unit are connected to the judgment module.
[0067] Specifically, OSC is the clock output by the internal oscillator, and CNT_EN is the output terminal of the detection module, which is used to output the enable control signal to the counter. When the start code SC is received, CNT_EN is set to 1, and the counter starts counting at this time. M_Overflow is the remainder counter overflow flag. When the remainder counter overflows, the remainder count overflow output terminal M_Overflow generates a pulse signal to reset the remainder counter and start counting again. At this time, an N_CLK pulse is output as the quotient counter clock, indicating that a counting cycle has been received.
[0068] Preferably, the counter further comprises a quotient counter, and the quotient counter comprises P second flip-flops, a second AND gate and a second logic unit connected in series;
[0069] The output terminal CNT_EN of the detection module is connected to an input terminal of the second AND gate, the quotient counting terminal N_CLK of the first logic unit is connected to the other input terminal of the second AND gate, the output terminal of the second AND gate is connected to the clock terminal of the first second trigger, the positive output terminal Q of the previous second trigger is connected to the clock terminal of the next second trigger, the positive output terminal Q of each second trigger is connected to a different input terminal of the second logic unit, and the negative output terminal QN of each second trigger is connected to the data terminal D of the second trigger; the reset terminals R of all second triggers are connected to the output terminal CNT_EN of the detection module;
[0070] The quotient output terminal N_CNT of the second logic unit is connected to the judgment module.
[0071] Preferably, both the first trigger and the second trigger are D triggers.
[0072] Specifically, the number of second triggers in the quotient counter depends on the length of the SC field and the internal oscillator frequency. When the remainder counter overflows once, the quotient counter performs an increment operation to generate the quotient N of the division operation. The timing is as follows: Figure 4 shown.
[0073] After the counter completes counting, the judgment module sets the sampling pulse period to NT or (N-1)T according to whether the remainder counter result is greater than K / 2, and writes the sampling pulse period into the latch of the pulse generation module to generate sampling pulses of corresponding frequency. For example, for the DMX512 protocol, when it is detected that the remainder M is greater than K / 2, the timing diagram is as follows: Figure 5 As shown, when it is detected that the remainder M is less than or equal to K / 2, the timing diagram is as follows Figure 6 shown.
[0074] The system provided in the embodiment of the present invention is briefly described. For matters not mentioned in the embodiment part, reference may be made to the corresponding contents in the aforementioned embodiment.
[0075] Embodiment three:
[0076] A transmission protocol adaptive decoding method, see Figure 7 , including the following steps:
[0077] S1: When the detection module detects a preset learning field on the data line, it generates an enable control signal and transmits it to the counter;
[0078] S2: When receiving the enable control signal, the counter counts the time length of the learning field on the data line, performs a division operation on the counting result, and outputs a quotient and a remainder;
[0079] S3: The judgment module determines the sampling pulse period according to the quotient and remainder output by the counter;
[0080] S4: The pulse generating module generates a sampling pulse according to the sampling pulse period determined by the judging module.
[0081] Preferably, the counter performs a division operation on the counting result specifically including:
[0082] The counter performs a K division operation on the counting result, wherein K is the number of bits of the learning field.
[0083] Preferably, the judging module determines the sampling pulse period according to the quotient and remainder output by the counter, specifically comprising:
[0084] When the judgment module detects that the remainder M of the counter output is greater than K / 2, the sampling pulse period is set to NT. When the judgment module detects that the remainder M of the counter output is less than or equal to K / 2, the sampling pulse period is set to (N-1)T, where T is the clock period generated by the internal oscillator and N is the quotient of the counter output.
[0085] The method calculates the time length of the preset learning field, performs division operation, and generates sampling pulses by rounding the remainder to sample the subsequent data of the learning field. Without requiring the internal oscillator speed to be too high, a wide range of transmission rate adaptive error-free decoding can be achieved, while minimizing the consumption of hardware resources to reduce costs.
[0086] The method provided in the embodiment of the present invention is briefly described. For matters not mentioned in the embodiment part, reference can be made to the corresponding contents in the aforementioned embodiment.
[0087] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be included in the scope of the claims and specification of the present invention.
Claims
1. A transmission protocol adaptive decoding system, It is characterized in that It includes an internal oscillator, a detection module, a counter, a judgment module and a pulse generation module; The internal oscillator is used to generate a clock and provide it to the detection module and the pulse generation module; The detection module is used to generate an enable control signal and transmit it to the counter when a preset learning field is detected on the data line; The counter is used to count the time length of the learning field on the data line when receiving the enable control signal, and perform a division operation on the counting result to output the quotient and the remainder; The judgment module is used to determine the sampling pulse period according to the quotient and remainder output by the counter; The pulse generating module is used to generate a sampling pulse according to the sampling pulse period determined by the judging module; The judgment module is specifically used for: When it is monitored that the remainder M output by the counter is greater than K / 2, the sampling pulse period is set to NT; when it is monitored that the remainder M output by the counter is less than or equal to K / 2, the sampling pulse period is set to (N-1)T, where T is the clock period generated by the internal oscillator, and N is the quotient output by the counter; where K is the number of bits of the learning field; The counter is specifically used for: A division by K operation is performed on the counting result.
2. The transmission protocol adaptive decoding system according to claim 1, It is characterized in that The counter includes a remainder counter, which specifically includes L first triggers connected in series, a first AND gate and a first logic unit; wherein, 2 L ≥K; The output end of the internal oscillator is connected to the clock end of the first first trigger, the positive output end of the previous first trigger is connected to the clock end of the next first trigger, the positive output end of each first trigger is connected to different input ends of the first logic unit, and the reverse output end of each first trigger is connected to the data end of the first trigger; The output end of the detection module is connected to an input end of the first AND gate, the remainder count overflow output end of the first logic unit is connected to the other input end of the first AND gate, and the output ends of the first AND gate are connected to the reset end of the first trigger; The remainder count overflow output terminal, the remainder output terminal and the quotient count terminal of the first logic unit are connected to the judgment module.
3. The transmission protocol adaptive decoding system according to claim 2, It is characterized in that The counter further includes a quotient counter, which includes P second flip-flops, a second AND gate and a second logic unit connected in series; The output end of the detection module is connected to an input end of the second AND gate, the quotient counting end of the first logic unit is connected to the other input end of the second AND gate, the output end of the second AND gate is connected to the clock end of the first second trigger, the positive output end of the previous second trigger is connected to the clock end of the next second trigger, the positive output end of each second trigger is connected to a different input end of the second logic unit, and the negative output end of each second trigger is connected to the data end of the second trigger; The reset terminals of all second triggers are connected to the output terminals of the detection modules; The quotient output terminal of the second logic unit is connected to the judgment module.
4. The transmission protocol adaptive decoding system according to claim 3, It is characterized in that The first flip-flop and the second flip-flop are both D flip-flops.
5. A transmission protocol adaptive decoding method, It is characterized in that The following steps are involved: When the detection module detects a preset learning field on the data line, it generates an enable control signal and transmits it to the counter; When receiving the enable control signal, the counter counts the time length of the learning field on the data line, performs a division operation on the counting result, and outputs a quotient and a remainder; The judgment module determines the sampling pulse period according to the quotient and remainder output by the counter; The pulse generating module generates a sampling pulse according to the sampling pulse period determined by the judging module; The determination module determines the sampling pulse period according to the quotient and remainder output by the counter, specifically including: When the judgment module detects that the remainder M output by the counter is greater than K / 2, the sampling pulse period is set to NT; when the judgment module detects that the remainder M output by the counter is less than or equal to K / 2, the sampling pulse period is set to (N-1)T, where T is the clock period generated by the internal oscillator, and N is the quotient output by the counter; where K is the number of bits of the learning field; The counter performs division operation on the counting result specifically including: The counter performs a division by K operation on the counting result.
