A frequency deviation calculation method suitable for A-PHY system
By using the counter method in the A-PHY system to calculate frequency offset and perform real-time calibration, the problems of complexity and low efficiency of traditional technology are solved, the accuracy and stability of frequency calibration are improved, and the reliability and efficiency of data transmission are improved.
Patent Information
- Application Number
- CN202411070391.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-08-06
AI Technical Summary
In high-speed A-PHY systems, traditional frequency offset calibration technology is complex and has insufficient anti-interference capabilities, resulting in frequency deviations that may endanger passenger safety. In addition, traditional dividers are inefficient, affecting real-time processing efficiency and resource usage.
The counter method is used to calculate the frequency offset in the A-PHY system. The frequency offset is calculated by the counting difference between the reference clock and the target clock, and is calibrated in real time in the data stream through the frequency offset compensation circuit to ensure clock synchronization.
It improves the accuracy and stability of frequency calibration, reduces the bit error rate and delay in data transmission, and improves the system's real-time processing capabilities and data transmission efficiency.
Smart Images

Figure CN118611846B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of signal processing, and in particular to a frequency deviation calculation method applicable to an A-PHY system. Background Art
[0002] The automotive industry is increasingly demanding high-speed, high-reliability data communications, especially when it comes to critical safety systems such as advanced driver assistance systems (ADAS) and future autonomous driving technologies. In these applications, the MIPIA-PHY protocol has been widely recognized to ensure efficient transmission of information from automotive sensors such as cameras, radars, lidars, and displays. With the widespread use of the A-PHY protocol, higher requirements are placed on signal quality in the system.
[0003] During the communication process of high-speed systems, clock signals are often affected by a variety of factors and produce frequency deviations, including changes in device temperature, supply voltage, and oscillator characteristics. At the transmitter and receiver, ensuring frequency consistency is critical to ensuring the stability and reliability of data transmission. Even a slight frequency deviation may cause data errors, reduce system performance, and in some cases may endanger passenger safety.
[0004] Traditional frequency deviation calibration usually uses counting technologies such as phase-locked loops and voltage-controlled oscillators. These technologies often have complex circuits and are less than expected in anti-interference capabilities in complex vehicle environments. In addition, when processing frequency deviation, division calculations are usually used. Traditional divider circuits are often inefficient in certain complex or high-speed situations, with long calculation times and large resource consumption during the calculation process, which will affect the real-time processing efficiency and resource usage of the A-PHY system.
[0005] Therefore, it is necessary to develop a new frequency deviation calculation method to meet the needs of high-precision and high-stability frequency calibration in complex vehicle environments and adapt to the faster and more accurate data processing requirements in the A-PHY system. Summary of the invention
[0006] The object of the present invention is to provide a frequency offset calculation method applicable to an A-PHY system to solve the problems in the background technology.
[0007] In order to solve the above technical problems, the present invention provides a frequency deviation calculation method applicable to an A-PHY system.
[0008] The frequency deviation of the A-PHY system refers to the frequency deviation between the recovered clock of the initiator and the recovered clock of the follower, which is actually the frequency deviation between the recovered clock of the initiator and the clock generated by the local crystal oscillator of the initiator. The calculation method is:
[0009] The local clock of the initiator of the calibration operation is the reference clock. A counter is made under the reference clock. It starts to count a fixed number of values at fixed time intervals. This count value is the value of the reference counter.
[0010] During this period of time, a signal is generated as a time window, and the recovered clock of the initiator is the target clock. During the duration of the time window signal, another counter is made using the target clock, which is the value of the target counter.
[0011] At a certain time point after the time window ends, the value of the reference counter and the value of the target counter are normalized to a unified unit, and the difference is divided by the value of the reference counter to obtain the frequency deviation of the crystal oscillator at the transmitting end and the receiving end of the A-PHY system.
[0012] In one embodiment,
[0013] Assume that the number of times the reference clock counter counts in a unit time is M, Represents the clock cycle of the reference clock; assuming that the counter under the target clock counts N times per unit time, represents the clock period of the target clock, then the method for calculating the frequency deviation is as follows:
[0014]
[0015] The meaning of the above formula is: use the frequency of the reference clock to normalize a time window to calculate the frequency deviation between the target clock and the reference clock; if the target clock has a frequency deviation, There is an error with the expectation, then the formula There must be a value that is not 0, so the entire formula represents the frequency deviation of the target clock relative to the reference clock.
[0016] In one embodiment, to calculate , in the target clock domain, you need to set counter 1 and counter 2. Counter 1 is Cleared after each target clock cycle After that, add 1; counter 2 uses the count value of counter 1 as the basis for self-increment. Add one to the quotient of .
[0017] In one embodiment, after obtaining the frequency deviation, the method further includes: packaging and encoding the frequency deviation, and mixing it into the data stream of the A-PHY link; during normal data transmission, at certain intervals, returning the packet with the frequency deviation to the follower end; the follower end knows the frequency deviation from the initiator end, and calibrates and compensates the local clock generated by the crystal oscillator of the follower end, that is, the pre-calibrated clock of the initiator end, in real time through the frequency deviation compensation circuit, so as to achieve the effect of the same frequency of the clocks of the initiator end and the follower end.
[0018] In one embodiment, the local clock of the initiator of the calibration operation is the clock generated by the local crystal oscillator of the initiator, and the clock and data recovery circuit of the initiator recovers the clock from the data link and is recorded as the recovered clock of the initiator; this clock is essentially the clock of the follower, which is recovered from the data stream through the clock and data recovery circuit, so the frequency deviation of the recovered clock of the initiator is consistent with the calibrated clock of the follower.
[0019] The present invention provides a frequency deviation calculation method suitable for an A-PHY system, which ensures real-time performance through digital circuit design, reduces the time delay caused by processing frequency deviation, and improves the efficiency of the circuit. In long-term dynamic adjustment, the calculation of the frequency deviation is dynamically stable, and the real-time deviation correction capability in the A-PHY system can also make up for this. Therefore, the present invention is more streamlined in design and optimizes resource occupancy than traditional divider circuits. Built-in frequency deviation calibration can effectively reduce the bit error rate during data transmission, improve data transmission quality and reliability, reduce retransmissions and error corrections caused by frequency deviation, improve data transmission efficiency, and reduce delays; it can quickly respond to environmental changes and internal data fluctuations, and enhance the real-time processing capabilities of the entire system. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a timing diagram of the statistical frequency deviation provided by the present invention.
[0021] Figure 2 It is a schematic diagram of a specific exemplary example provided by the present invention.
[0022] Figure 3 It is a schematic diagram of the system framework structure provided by the present invention.
[0023] Figure 4 It is a schematic diagram of the workflow provided by the present invention. DETAILED DESCRIPTION
[0024] The following is a further detailed description of a frequency offset calculation method applicable to an A-PHY system proposed by the present invention in conjunction with the accompanying drawings and specific embodiments. The advantages and features of the present invention will become clearer according to the following description. It should be noted that the accompanying drawings are all in a very simplified form and are not in precise proportions, and are only used to conveniently and clearly assist in explaining the purpose of the embodiments of the present invention.
[0025] The present invention provides a frequency deviation calculation method applicable to an A-PHY system, wherein one embodiment is that the frequency deviation is calculated at the initiator of a calibration operation. The local clock of the initiator is a clock generated by a local crystal oscillator of the initiator, and the CDR (Clock and Data Recovery) of the initiator recovers the clock from the data link and records it as the recovered clock of the initiator. The clock is essentially the clock of the follower, which is recovered from the data stream through the CDR. Therefore, the frequency deviation of the recovered clock of the initiator is consistent with the calibrated clock of the follower.
[0026] The frequency deviation at both ends of the A-PHY system refers to the frequency deviation between the recovered clock of the initiator and the recovered clock of the follower. It is actually the frequency deviation between the recovered clock of the initiator and the clock generated by the local crystal oscillator of the initiator. Therefore, the calculation method is: the local clock of the initiator is the reference clock, and a counter is made under the reference clock. It starts to count a fixed number of values at fixed intervals. This count value is the value of the reference counter. During this period of time, a signal is generated as a time window, and the recovered clock of the initiator is the target clock. During the duration of the time window signal, the target clock is used to make another counter, which is the value of the target counter. At a certain time point after the end of the time window, the value of the reference counter and the value of the target counter are normalized to a unified unit, and the difference is divided by the value of the reference counter to obtain the frequency deviation of the crystal oscillator at the transmitting and receiving ends of the A-PHY system. The timing of the statistical frequency deviation is as follows: Figure 1 shown.
[0027] In the above method of calculating frequency deviation, it is necessary to make counters at two clock frequencies respectively. In the unit time window, the ratio of the difference counted by the counters at the two clock frequencies is compared to represent the frequency deviation. Assume that the number of counter counts of the reference clock in the unit time is M, Represents the clock cycle of the reference clock. Assume that the counter under the target clock counts N times per unit time. represents the clock period of the target clock, then the method for calculating the frequency deviation is as follows:
[0028]
[0029] The meaning of the above formula is: use the frequency of the reference clock to normalize a time window to calculate the frequency deviation between the target clock and the reference clock. represents 10,000 nanoseconds, and the reference clock is an ideal clock, the time it defines is an ideal 10,000 nanoseconds, so Ideally, It must also be 10,000 nanoseconds. If the target clock has a frequency deviation, There is an error with the expectation, then the formula There must be a value that is not 0, so the entire formula represents the frequency deviation of the target clock relative to the reference clock.
[0030] In the above formula, it can be clearly seen that The denominator can be simplified, so we only have The size of is the quantity that needs to be calculated.
[0031] In order to calculate this division formula, two more counters need to be set in the target clock domain. Counter 1 (CNT1) is used for each Cleared after each target clock cycle Then add one; counter 2 (CNT2) uses the count value of CNT1 as the basis for self-increment. The count value of CNT2 in CNT1 is The meaning of this algorithm is: once the counter calculates The value of counter 2 is calculated The value of .
[0032] like Figure 2 As shown, assuming is 35, is 4, so CNT2 can add 1 when CNT1 counts to 0, 8, 16, and 32. At this time, CNT2 can represent the time By calculating CNT2, the specific value of the frequency deviation at the current moment can be calculated later.
[0033] After the frequency deviation is obtained, it is packaged and encoded and mixed into the data stream of the A-PHY link. During normal data transmission, the packet with frequency deviation is returned to the follower at a certain interval. The follower can know the frequency deviation with the initiator, and calibrate and compensate the local clock generated by the crystal oscillator of the follower in real time through the frequency deviation compensation circuit, that is, the pre-calibrated clock of the initiator, so as to achieve the effect of the same frequency of the initiator and follower clocks. The system framework and workflow are as follows: Figure 3 and Figure 4 shown.
[0034] The frequency offset calibration process of the A-PHY system works as follows:
[0035] The follower end inserts a frequency offset calibration request packet into the normal data stream packet at fixed intervals.
[0036] The initiator always calculates the frequency deviation through the frequency deviation calculation circuit at fixed intervals.
[0037] If the initiator receives a frequency offset calibration request packet, it packs the frequency offset value calculated in the previous stage into a frequency offset response packet, inserts it into the interval of the data stream packet, and returns it to the follower.
[0038] After the follower sends a frequency deviation calibration request packet, it waits for a period of time. If a frequency deviation response packet is received, it decompresses it to obtain the frequency deviation.
[0039] The follower end compensates the frequency deviation to the local crystal oscillator circuit and corrects the output of the local clock.
[0040] The present invention proposes a frequency deviation calculation method and compensation scheme based on the A-PHY system, and proposes an on-chip frequency deviation calculation division circuit suitable for the scheme. By calculating the frequency deviation between the data recovery clock and the local clock on one side of the A-PHY system, when the frequencies of the two ends of the A-PHY link are not much different, the frequency deviations of the two ends of the A-PHY system can be effectively calculated inside the system without stopping data transmission, thereby ensuring the stability and fluency of the system; and effectively solves the division problem encountered in the frequency deviation calculation. Different from the traditional divider, the method uses a nested counter method to realize the fractional division of the frequency deviation, which has a small area and reduces power consumption and cost. The present invention is based on the A-PHY protocol, and the method and circuit are more versatile and can be applied to other communication protocols.
[0041] The above description is only a description of the preferred embodiments of the present invention, and is not intended to limit the scope of the present invention. Any changes or modifications made by a person skilled in the art in the field of the present invention based on the above disclosure shall fall within the scope of protection of the claims.
Claims
1. A frequency deviation calculation method applicable to an A-PHY system, characterized in that: The frequency deviation of the A-PHY system refers to the frequency deviation between the recovered clock of the initiator and the recovered clock of the follower, which is actually the frequency deviation between the recovered clock of the initiator and the clock generated by the local crystal oscillator of the initiator. The calculation method is: The local clock of the initiator of the calibration operation is the reference clock. A counter is made under the reference clock. It starts to count a fixed number of values at fixed time intervals. This count value is the value of the reference counter. During this period of time, a signal is generated as a time window, and the recovered clock of the initiator is the target clock. During the duration of the time window signal, another counter is made using the target clock, which is the value of the target counter. At a certain time point after the time window ends, the reference counter value and the target counter value are normalized to a unified unit, and the difference is divided by the reference counter value to obtain the frequency deviation of the crystal oscillator at the transmitting end and the receiving end of the A-PHY system; Assume that the number of times the reference clock counter counts in a unit time is M, Represents the clock period of the reference clock; Assume that the counter counts N in unit time under the target clock. represents the clock period of the target clock, then the method for calculating the frequency deviation is as follows: ,The meaning of the above formula is: use the frequency of the reference clock to normalize a time window to calculate the frequency deviation between the target clock and the reference clock; If the target clock has frequency deviation, There is an error with the expectation, then the formula There must be a value that is not 0, so the entire formula represents the frequency deviation of the target clock relative to the reference clock; To calculate , in the target clock domain, you need to set counter 1 and counter 2. Counter 1 is Cleared after each target clock cycle After that, add one; counter 2 takes the count value of counter 1 as the basis for self-increment; counter 2 increases when the count value of counter 1 is When the quotient of is added, add one; The local clock of the initiator of the calibration operation is the clock generated by the local crystal oscillator of the initiator, and the clock and data recovery circuit of the initiator recovers the clock from the data link and is recorded as the recovered clock of the initiator; this clock is essentially the clock of the follower, which is recovered from the data stream through the clock and data recovery circuit, so the frequency deviation of the recovered clock of the initiator is consistent with the calibrated clock of the follower.
2. The frequency deviation calculation method applicable to the A-PHY system according to claim 1, characterized in that: After obtaining the frequency deviation, the method further includes: packaging and encoding the frequency deviation, mixing it into the data stream of the A-PHY link, and during normal data transmission, returning the packet with the frequency deviation to the follower end at a certain interval, so that the follower end knows the frequency deviation with the initiator end, and calibrates and compensates the local clock generated by the crystal oscillator of the follower end, that is, the pre-calibrated clock of the initiator end, in real time through the frequency deviation compensation circuit, so as to achieve the effect of the same frequency of the initiator end and the follower end clock.
