TWI518476B - Synchronization method and clock generating device thereof - Google Patents

Synchronization method and clock generating device thereof Download PDF

Info

Publication number
TWI518476B
TWI518476B TW103123222A TW103123222A TWI518476B TW I518476 B TWI518476 B TW I518476B TW 103123222 A TW103123222 A TW 103123222A TW 103123222 A TW103123222 A TW 103123222A TW I518476 B TWI518476 B TW I518476B
Authority
TW
Taiwan
Prior art keywords
signal
phase difference
synchronization
pulse width
width modulation
Prior art date
Application number
TW103123222A
Other languages
Chinese (zh)
Other versions
TW201543195A (en
Inventor
王玠皓
羅偉仁
郭森林
施寶鎮
Original Assignee
聯詠科技股份有限公司
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 聯詠科技股份有限公司 filed Critical 聯詠科技股份有限公司
Priority to US14/697,642 priority Critical patent/US9363069B2/en
Publication of TW201543195A publication Critical patent/TW201543195A/en
Application granted granted Critical
Publication of TWI518476B publication Critical patent/TWI518476B/en

Links

Landscapes

  • Inverter Devices (AREA)

Description

同步方法及其時脈產生裝置 Synchronization method and clock generation device thereof

本發明係指一種同步方法及其時脈產生裝置,尤指一種可以硬體及軟體共同實現的同步方法及其時脈產生裝置。 The invention relates to a synchronization method and a clock generation device thereof, in particular to a synchronization method and a clock generation device which can be realized by a hardware and a software.

在電子系統中,訊號發送端與訊號接收端間之時脈訊號往往存在著時脈偏差。因此,電子系統中各電路間傳遞訊號時,需同步各電路的時脈訊號,以使電子系統正常工作。 In an electronic system, the clock signal between the signal transmitting end and the signal receiving end often has a clock deviation. Therefore, when transmitting signals between circuits in an electronic system, it is necessary to synchronize the clock signals of the circuits to make the electronic system work normally.

通常而言,習知電子系統經常使用由純硬體實現的鎖相迴路(phase-locked loop)來同步時脈訊號。然而,由純硬體實現的鎖相迴路進行同步程序需耗費大量時間,而無法即時同步訊號。此外,由純硬體實現的鎖相迴路亦無法根據不同的運作狀態,控制同步訊號所需的時間。由上述可知,習知技術實有改進之必要。 In general, conventional electronic systems often use phase-locked loops implemented by pure hardware to synchronize clock signals. However, the phase-locked loop implemented by pure hardware takes a lot of time to synchronize the program, and it is impossible to synchronize the signals in real time. In addition, the phase-locked loop realized by pure hardware cannot control the time required for synchronizing signals according to different operating states. From the above, it is known that there is a need for improvement in the prior art.

為了解決上述的問題,本發明提供一種可以硬體及軟體共同實現的同步方法及其時脈產生裝置。 In order to solve the above problems, the present invention provides a synchronization method that can be implemented together with a hardware and a soft body, and a clock generation device thereof.

本發明揭露一種同步方法,用於一包含有一時脈產生單元及一運算單元的時脈產生裝置,該同步方法包含有由該時脈產生單元計數一同步訊號的一同步週期;根據該同步訊號,由該時脈產生單元產生一第一中斷訊號予該運算單元,以使該運算單元取得該同步週期;根據一控制訊號,由該時 脈產生單元產生一脈衝寬度調變訊號,並計數該同步訊號與該脈衝寬度調變訊號間的一相位差;根據該脈衝寬度調變訊號,由該時脈產生單元產生一第二中斷訊號予該運算單元,以使該運算單元取得該相位差;根據該同步週期、該脈衝寬度調變訊號的一調變週期、該相位差及一預設值,由該運算單元調整該控制訊號。 The present invention discloses a synchronization method for a clock generation apparatus including a clock generation unit and an operation unit, the synchronization method including a synchronization period in which the synchronization signal is counted by the clock generation unit; a signal, the clock generating unit generates a first interrupt signal to the operation unit, so that the operation unit obtains the synchronization period; according to a control signal, The pulse generating unit generates a pulse width modulation signal, and counts a phase difference between the synchronization signal and the pulse width modulation signal; and according to the pulse width modulation signal, the clock generation unit generates a second interruption signal to The arithmetic unit is configured to cause the arithmetic unit to obtain the phase difference; and the control unit adjusts the control signal according to the synchronization period, a modulation period of the pulse width modulation signal, the phase difference, and a preset value.

本發明另揭露一種時脈產生裝置,包含有一時脈產生單元,用來計數該同步訊號的一同步週期,根據該同步訊號產生一第一中斷訊號,根據一控制訊號產生一脈衝寬度調變訊號,計數該同步訊號與該脈衝寬度調變訊號間的一相位差,及根據該脈衝寬度調變訊號產生一第二中斷訊號;以及一運算單元,用來根據該第一中斷訊號取得該同步週期,根據該第二中斷訊號取得該相位差,以及根據該同步週期、該脈衝寬度調變訊號的一調變週期與該相位差調整該控制訊號。 The present invention further provides a clock generation device, including a clock generation unit for counting a synchronization period of the synchronization signal, generating a first interrupt signal according to the synchronization signal, and generating a pulse width modulation signal according to a control signal. And counting a phase difference between the synchronization signal and the pulse width modulation signal, and generating a second interrupt signal according to the pulse width modulation signal; and an operation unit for obtaining the synchronization period according to the first interrupt signal And obtaining the phase difference according to the second interrupt signal, and adjusting the control signal according to the synchronization period, a modulation period of the pulse width modulation signal, and the phase difference.

10‧‧‧時脈產生裝置 10‧‧‧ Clock generating device

100‧‧‧時脈產生單元 100‧‧‧ clock generation unit

102‧‧‧運算單元 102‧‧‧ arithmetic unit

40‧‧‧同步方法 40‧‧‧Synchronization method

400~414‧‧‧步驟 400~414‧‧‧Steps

CON‧‧‧控制序號 CON‧‧‧ control serial number

INC‧‧‧總和 INC‧‧‧Sum

PER_DIFF‧‧‧週期差 PER_DIFF‧‧‧cycle difference

PER_SYNC、PER_PWM‧‧‧週期 PER_SYNC, PER_PWM‧‧ ‧ cycle

PHA_DIFF‧‧‧相位差 PHA_DIFF‧‧‧ phase difference

PWM‧‧‧脈衝寬度調變訊號 PWM‧‧‧ pulse width modulation signal

REF‧‧‧預設值 REF‧‧‧Preset value

SYNC‧‧‧同步訊號 SYNC‧‧‧sync signal

T1_1~T1_5、T2_1~T2_5、T3_1~T3_5‧‧‧時間點 T1_1~T1_5, T2_1~T2_5, T3_1~T3_5‧‧‧

W1、W2‧‧‧權重 W1, W2‧‧ ‧ weights

第1圖為本發明實施例一時脈產生裝置的示意圖。 FIG. 1 is a schematic diagram of a clock generation apparatus according to an embodiment of the present invention.

第2圖為第1圖所示的時脈產生裝置運作時相關訊號的時序圖。 Fig. 2 is a timing chart of the relevant signals when the clock generating device is operated as shown in Fig. 1.

第3圖為第1圖所示的時脈產生裝置運作時相關訊號的另一時序圖。 Fig. 3 is another timing chart of the related signals when the clock generating device is operated as shown in Fig. 1.

第4圖為本發明實施例一同步方法的流程圖。 FIG. 4 is a flowchart of a synchronization method according to an embodiment of the present invention.

請參考第1圖,第1圖為本發明實施例一時脈產生裝置10的示意圖。時脈產生裝置10用來根據前級電路(未繪示於第1圖)產生的同步訊號SYNC,產生與同步訊號SYNC同步的一脈衝寬度調變(pulse width modulation)訊號PWM。如第1圖所示,時脈產生裝置10包含有時脈產生單元100及運算單元102。時脈產生單元100用來接收同步訊號SYNC,並根據 一控制訊號CON產生脈衝寬度調變訊號PWM。時脈產生單元100另用來分別計算同步訊號SYN的一週期PER_SYNC及同步訊號SYN與脈衝寬度調變訊號PWM間的一相位差PHA_DIFF。此外,時脈產生單元100會根據同步訊號SYNC及脈衝寬度調變訊號PWM,分別產生中斷(interrupt)訊號INT1、INT2予運算單元102。運算單元102可為一微處理器或一特定應用積體電路(Application-Specific Integrated Circuit,ASIC),用來根據中斷訊號INT1、INT2取得週期PER_SYNC及相位差PHA_DIFF。根據所得的週期PER_SYNC及相位差PHA_DIFF,運算單元102可調整控制訊號CON,以使脈衝寬度調變訊號PWM與同步訊號SYNC同步。在此情況下,由於調整控制訊號CON的運算流程係以軟體方式實現於運算單元102,使用者可輕易地調整產生控制訊號CON的參數設定,從而根據不同應用及設計理念,控制同步訊號SYNC與脈衝寬度調變訊號PWM間的同步流程(如控制同步訊號SYNC與脈衝寬度調變訊號PWM間的同步流程的所需時間)。 Please refer to FIG. 1. FIG. 1 is a schematic diagram of a clock generating apparatus 10 according to an embodiment of the present invention. The clock generating device 10 is configured to generate a pulse width modulation signal PWM synchronized with the synchronization signal SYNC according to the synchronization signal SYNC generated by the pre-stage circuit (not shown in FIG. 1). As shown in FIG. 1, the clock generation device 10 includes a pulse generation unit 100 and an arithmetic unit 102. The clock generation unit 100 is configured to receive the synchronization signal SYNC and according to A control signal CON generates a pulse width modulation signal PWM. The clock generation unit 100 is further configured to separately calculate a period PER_SYNC of the synchronization signal SYN and a phase difference PHA_DIFF between the synchronization signal SYN and the pulse width modulation signal PWM. In addition, the clock generation unit 100 generates an interrupt signal INT1, INT2 to the arithmetic unit 102 according to the synchronization signal SYNC and the pulse width modulation signal PWM. The computing unit 102 can be a microprocessor or an application-specific integrated circuit (ASIC) for obtaining the period PER_SYNC and the phase difference PHA_DIFF according to the interrupt signals INT1 and INT2. Based on the obtained period PER_SYNC and phase difference PHA_DIFF, the operation unit 102 can adjust the control signal CON to synchronize the pulse width modulation signal PWM with the synchronization signal SYNC. In this case, since the operation flow of adjusting the control signal CON is implemented in the operation unit 102 in a software manner, the user can easily adjust the parameter setting of the control signal CON, thereby controlling the synchronization signal SYNC according to different applications and design concepts. The synchronization process between the pulse width modulation signals PWM (such as the time required to control the synchronization process between the synchronization signal SYNC and the pulse width modulation signal PWM).

詳細來說,時脈產生單元100由前級電路接收同步訊號SYNC時,亦同時計算同步訊號SYNC的週期PER_SYNC。透過中斷訊號INT1,時脈產生單元100指示運算單元102週期PER_SYNC已計算完畢,運算單元102從而讀取同步訊號SYNC的週期PER_SYNC。接下來,時脈產生單元100根據控制訊號CON,產生脈衝寬度調變訊號PWM,並同時計數同步訊號SYN與脈衝寬度調變訊號PWM間的相位差PHA_DIFF。透過中斷訊號INT2,時脈產生單元100指示運算單元102相位差PHA_DIFF已計算完畢,運算單元102從而讀取相位差PHA_DIFF。由於調整脈衝寬度調變訊號PWM的一週期PER_PWM及一起始時間TS是由運算單元102產生的控制訊號CON所設定,因此運算單元102可得知週期PER_PWM。根據週期PER_SYNC、PER_PWM及相位差PHA_DIFF,運算單元102可調整控制訊號CON,以同步同步訊號SYNC及脈衝寬度調變訊號PWM。 In detail, when the clock generation unit 100 receives the synchronization signal SYNC from the previous stage circuit, the period PER_SYNC of the synchronization signal SYNC is also calculated. Through the interrupt signal INT1, the clock generation unit 100 instructs the operation unit 102 to calculate the period PER_SYNC, and the operation unit 102 thus reads the period PER_SYNC of the synchronization signal SYNC. Next, the clock generation unit 100 generates a pulse width modulation signal PWM according to the control signal CON, and simultaneously counts the phase difference PHA_DIFF between the synchronization signal SYN and the pulse width modulation signal PWM. Through the interrupt signal INT2, the clock generation unit 100 instructs the arithmetic unit 102 that the phase difference PHA_DIFF has been calculated, and the arithmetic unit 102 thus reads the phase difference PHA_DIFF. Since the one cycle PER_PWM of the pulse width modulation signal PWM and the start time TS are set by the control signal CON generated by the operation unit 102, the operation unit 102 can know the cycle PER_PWM. According to the period PER_SYNC, PER_PWM and phase difference PHA_DIFF, the operation unit 102 can adjust the control signal CON to synchronize the synchronization signal SYNC and the pulse width modulation signal PWM.

運算單元102根據週期PER_SYNC、PER_PWM及相位差PHA_DIFF調整控制訊號CON的運算過程敘述如下。當相位差PHA_DIFF的絕對值大於一預設值REF時(即|PHA_DIFF|>REF),運算單元102判斷同步訊號SYNC及脈衝寬度調變訊號PWM間頻率相位差距過大,運算單元102執行一粗調程序。在粗調程序中,運算單元102根據相位差PHA_DIFF,提前或延後脈衝寬度調變訊號PWM的起始時間TS。在此實施例中,當相位差PHA_DIFF大於預設值REF時(即PHA_DIFF>REF)時,運算單元102將起始時間TS提前一預設時間TP;而當相位差PHA_DIFF小於負的預設值REF時(即PHA_DIFF<-REF)時,運算單元102將起始時間TS延後預設時間TP。舉例來說,預設值REF可被設定為2毫秒(ms)且預設時間TP可被設定為0.1毫秒。 The operation of the arithmetic unit 102 to adjust the control signal CON based on the period PER_SYNC, PER_PWM, and phase difference PHA_DIFF is described below. When the absolute value of the phase difference PHA_DIFF is greater than a predetermined value REF (ie, | PHA_DIFF |> REF ), the operation unit 102 determines that the frequency phase difference between the synchronization signal SYNC and the pulse width modulation signal PWM is too large, and the operation unit 102 performs a coarse adjustment. program. In the coarse adjustment procedure, the arithmetic unit 102 advances or delays the start time TS of the pulse width modulation signal PWM according to the phase difference PHA_DIFF. In this embodiment, when the phase difference PHA_DIFF is greater than the preset value REF (ie, PHA_DIFF > REF ), the operation unit 102 advances the start time TS by a preset time TP; and when the phase difference PHA_DIFF is less than the negative preset value At the time of REF (i.e., PHA_DIFF <- REF ), the arithmetic unit 102 delays the start time TS by the preset time TP. For example, the preset value REF can be set to 2 milliseconds (ms) and the preset time TP can be set to 0.1 milliseconds.

另一方面,當相位差PHA_DIFF的絕對值小於等於預設值REF時(即|PHA_DIFF| REF),運算單元102執行一細調程序。在細調程序中,運算單元102計算週期PER_SYNC、PER_PWM間的週期差PER_DIFF,並相加週期差PER_DIFF及相位差PHA_DIFF分別與權重W1、W2相乘後的乘積作為一總和INC(即INC=PER_DIFF×W1+PHA_DIFF×W2)。於取得總和INC後,運算單元102將起始時間TS減去總和INC。最後,根據上述流程所得的運算結果,運算單元102根據中斷訊號INT2,於同步訊號SYNC下一脈衝來臨之前調整控制訊號CON,以使時脈產生單元100可於同步訊號SYNC下一脈衝來臨時根據控制訊號CON產生脈衝寬度調變訊號PWM。如此一來,脈衝寬度調變訊號PWM即可快速地與同步訊號SYNC達成同步。此外,使用者可透過權重W1、W2的設計,調整同步訊號SYNC與脈衝寬度調變訊號PWM間的同步流程的所需時間。舉例來說,權重W1、W2可被設定為0.25。 On the other hand, when the absolute value of the phase difference PHA_DIFF is less than or equal to the preset value REF (ie | PHA_DIFF | REF ), the arithmetic unit 102 performs a fine adjustment procedure. In the fine adjustment procedure, the arithmetic unit 102 calculates the period difference PER_DIFF between the periods PER_SYNC and PER_PWM, and adds the product of the period difference PER_DIFF and the phase difference PHA_DIFF to the weights W1 and W2, respectively, as a sum INC (ie INC = PER_DIFF) × W 1+ PHA_DIFF × W 2) . After obtaining the sum INC, the arithmetic unit 102 subtracts the start time INC from the sum INC. Finally, according to the operation result obtained by the above process, the operation unit 102 adjusts the control signal CON before the next pulse of the synchronization signal SYNC according to the interrupt signal INT2, so that the clock generation unit 100 can temporarily according to the next pulse of the synchronization signal SYNC. The control signal CON generates a pulse width modulation signal PWM. In this way, the pulse width modulation signal PWM can be quickly synchronized with the synchronization signal SYNC. In addition, the user can adjust the time required for the synchronization process between the synchronization signal SYNC and the pulse width modulation signal PWM through the design of the weights W1 and W2. For example, the weights W1, W2 can be set to 0.25.

請參考第2圖,第2圖為第1圖所示的時脈產生裝置10運作時相關訊號的時序圖。如第2圖所示,於時間T1_1,時脈產生單元100接收到同步訊號SYNC的上升緣(raising edge),時脈單元100從而透過中斷訊號INT1指示運算單元102取得同步訊號SYNC前一週期的週期PER_SYNC_1。此時,時脈產生單元100亦同時開始計數同步訊號SYNC與脈衝寬度調變訊號PWM間的相位差PHA_DIFF_1。於時間點T2_1,時脈產生單元100產生脈衝寬度調變訊號PWM的上升緣,時脈產生單元100完成相位差PHA_DIFF_1的計算,並透過中斷訊號INT2指示運算單元102取得相位差PHA_DIFF_1。根據所取得的週期PER_SYNC_1及相位差PHA_DIFF及本身設定的週期PER_PWM_1,運算單元102可據以調整控制訊號CON。由於相位差PHA_DIFF_1大於預設值REF,運算單元102透過調整控制訊號CON來使起始產生脈衝寬度調變訊號PWM的起始時間TS減少預設時間TP。需注意的是,運算單元102是根據中斷訊號INT2,於脈衝寬度調變訊號PWM的下降緣(falling edge)時(即時間點T3_1)進行控制訊號CON的調整。 Please refer to FIG. 2, which is a timing chart of related signals when the clock generating device 10 is operated as shown in FIG. 1. As shown in FIG. 2, at time T1_1, the clock generation unit 100 receives the rising edge of the synchronization signal SYNC, and the clock unit 100 instructs the operation unit 102 to acquire the synchronization signal SYNC through the interrupt signal INT1. Period PER_SYNC_1. At this time, the clock generation unit 100 also starts counting the phase difference PHA_DIFF_1 between the synchronization signal SYNC and the pulse width modulation signal PWM. At the time point T2_1, the clock generation unit 100 generates a rising edge of the pulse width modulation signal PWM, and the clock generation unit 100 completes the calculation of the phase difference PHA_DIFF_1, and instructs the operation unit 102 to acquire the phase difference PHA_DIFF_1 through the interrupt signal INT2. The arithmetic unit 102 can adjust the control signal CON according to the obtained period PER_SYNC_1 and the phase difference PHA_DIFF and the period PER_PWM_1 set by itself. Since the phase difference PHA_DIFF_1 is greater than the preset value REF, the operation unit 102 reduces the start time TS of the initial pulse width modulation signal PWM by the preset control time TP by adjusting the control signal CON. It should be noted that the operation unit 102 performs the adjustment of the control signal CON at the falling edge of the pulse width modulation signal PWM (ie, the time point T3_1) according to the interrupt signal INT2.

相似地,時脈產生單元100於時間T1_2接收到同步訊號SYNC的上升緣(raising edge),並透過中斷訊號INT1指示運算單元102取得同步訊號SYNC前一週期的週期PER_SYNC_2。此時,時脈產生單元100亦同時開始計數同步訊號SYNC與脈衝寬度調變訊號PWM間的相位差PHA_DIFF_2。於時間點T2_2,時脈產生單元100產生脈衝寬度調變訊號PWM的上升緣,時脈產生單元100完成相位差PHA_DIFF_2的計算,並透過中斷訊號INT2指示運算單元102取得相位差PHA_DIFF_2。由於相位差PHA_DIFF_2依然大於預設值REF,運算單元102透過調整控制訊號CON來使起始產生脈衝寬度調變訊號PWM的起始時間TS再次減少預設時間TP,以此類推。 Similarly, the clock generation unit 100 receives the rising edge of the synchronization signal SYNC at time T1_2, and instructs the operation unit 102 to acquire the period PER_SYNC_2 of the previous period of the synchronization signal SYNC through the interrupt signal INT1. At this time, the clock generation unit 100 also starts counting the phase difference PHA_DIFF_2 between the synchronization signal SYNC and the pulse width modulation signal PWM. At time point T2_2, the clock generation unit 100 generates a rising edge of the pulse width modulation signal PWM, and the clock generation unit 100 completes the calculation of the phase difference PHA_DIFF_2, and instructs the arithmetic unit 102 to acquire the phase difference PHA_DIFF_2 through the interrupt signal INT2. Since the phase difference PHA_DIFF_2 is still greater than the preset value REF, the operation unit 102 reduces the start time TS of the initial pulse width modulation signal PWM by the preset time TP by adjusting the control signal CON, and so on.

直至時間點T2_4,運算單元102判斷相位差PHA_DIFF_4小於預設值REF,運算單元102計算週期差PER_DIFF及相位差PHA_DIFF分別與權重W1、W2相乘後的總和INC,並將起始時間TS減去總和INC。如此一來,脈衝寬度調變訊號PWM即可於同步訊號SYNC的下一脈衝產生時(即時間T1_5),追上同步訊號SYNC。 Up to the time point T2_4, the arithmetic unit 102 determines that the phase difference PHA_DIFF_4 is smaller than the preset value REF, and the arithmetic unit 102 calculates the sum INC of the period difference PER_DIFF and the phase difference PHA_DIFF multiplied by the weights W1, W2, respectively, and subtracts the start time TS. Sum INC. In this way, the pulse width modulation signal PWM can catch up with the synchronization signal SYNC when the next pulse of the synchronization signal SYNC is generated (ie, time T1_5).

透過合適的設定預設值REF及權重W1、W2,脈衝寬度調變訊號PWM可於同步訊號SYNC的兩個週期內與同步訊號SYNC同步。請參考第3圖,第3圖為第1圖所示的時脈產生裝置10運作時相關訊號的時序圖。類似於第2圖,時脈產生單元100於時間T1_1接收到同步訊號SYNC的上升緣,從而透過中斷訊號INT1指示運算單元102取得同步訊號SYNC前一週期的週期PER_SYNC_1。此時,時脈產生單元100亦同時開始計數同步訊號SYNC與脈衝寬度調變訊號PWM間的相位差PHA_DIFF_1。於時間點T2_1,時脈產生單元100產生脈衝寬度調變訊號PWM的上升緣,時脈產生單元100完成相位差PHA_DIFF_1的計算,並透過中斷訊號INT2指示運算單元102取得相位差PHA_DIFF_1。在此實施例中,由於相位差PHA_DIFF_1小於預設值REF,運算單元102計算週期差PER_DIFF及相位差PHA_DIFF分別與權重W1、W2相乘後的總和INC,並將起始時間TS減去總和INC。透過於時間T3_1調整控制訊號CON,脈衝寬度調變訊號PWM的上升緣可於時間T1_2對齊同步訊號SYNC的上升緣。如此一來,於時間T1_3,運算單元102即可得知相位差PHA_DIFF為0,脈衝寬度調變訊號PWM與同步訊號SYNC已完成同步。 The pulse width modulation signal PWM can be synchronized with the synchronization signal SYNC in two cycles of the synchronization signal SYNC through the appropriate setting preset value REF and the weights W1 and W2. Please refer to FIG. 3, which is a timing chart of the related signals when the clock generating device 10 is operated as shown in FIG. 1. Similar to FIG. 2, the clock generation unit 100 receives the rising edge of the synchronization signal SYNC at time T1_1, thereby instructing the arithmetic unit 102 to acquire the period PER_SYNC_1 of the previous period of the synchronization signal SYNC through the interrupt signal INT1. At this time, the clock generation unit 100 also starts counting the phase difference PHA_DIFF_1 between the synchronization signal SYNC and the pulse width modulation signal PWM. At the time point T2_1, the clock generation unit 100 generates a rising edge of the pulse width modulation signal PWM, and the clock generation unit 100 completes the calculation of the phase difference PHA_DIFF_1, and instructs the operation unit 102 to acquire the phase difference PHA_DIFF_1 through the interrupt signal INT2. In this embodiment, since the phase difference PHA_DIFF_1 is smaller than the preset value REF, the operation unit 102 calculates the sum INC of the period difference PER_DIFF and the phase difference PHA_DIFF multiplied by the weights W1, W2, respectively, and subtracts the start time TS from the sum INC. . By adjusting the control signal CON at time T3_1, the rising edge of the pulse width modulation signal PWM can be aligned with the rising edge of the synchronization signal SYNC at time T1_2. In this way, at time T1_3, the arithmetic unit 102 can know that the phase difference PHA_DIFF is 0, and the pulse width modulation signal PWM and the synchronization signal SYNC have been synchronized.

時脈產生裝置10同步脈衝寬度調變訊號PWM與同步訊號SYNC的流程可被歸納為一同步方法40,如第4圖所示。同步方法40可用於包含有一時脈產生單元及一運算單元的一時脈產生裝置(如第1圖之時脈產生裝 置10),且包含有以下步驟:步驟400:開始。 The flow of the clock generation device 10 to synchronize the pulse width modulation signal PWM and the synchronization signal SYNC can be summarized as a synchronization method 40, as shown in FIG. The synchronization method 40 can be used for a clock generation device including a clock generation unit and an operation unit (such as the clock generation device of FIG. 1) Set 10), and include the following steps: Step 400: Start.

步驟402:由該時脈產生單元計數一同步訊號的一同步週期。 Step 402: Counting, by the clock generation unit, a synchronization period of a synchronization signal.

步驟404:根據該同步訊號,由該時脈產生單元產生一第一中斷訊號予該運算單元,以使該運算單元取得該同步訊號的一同步週期。 Step 404: The clock generation unit generates a first interrupt signal to the operation unit according to the synchronization signal, so that the operation unit obtains a synchronization period of the synchronization signal.

步驟406:根據一控制訊號,由該時脈產生單元產生一脈衝寬度調變訊號,並計數該同步訊號與該脈衝寬度調變訊號間的一相位差異。 Step 406: According to a control signal, the clock generation unit generates a pulse width modulation signal, and counts a phase difference between the synchronization signal and the pulse width modulation signal.

步驟408:根據該脈衝寬度調變訊號,由該時脈產生單元產生一第二中斷訊號予該運算單元,以使該運算單元取得該相位差異。 Step 408: According to the pulse width modulation signal, the clock generation unit generates a second interrupt signal to the operation unit, so that the operation unit obtains the phase difference.

步驟410:判斷該相位差異之大小,若該相位差異大於該預設值,執行步驟412;若該相位差異小於等於該預設值,執行步驟414;若該相位差異為0,執行步驟402。 Step 410: Determine the magnitude of the phase difference. If the phase difference is greater than the preset value, go to step 412. If the phase difference is less than or equal to the preset value, go to step 414. If the phase difference is 0, go to step 402.

步驟412:執行一粗調程序。 Step 412: Perform a coarse adjustment procedure.

步驟414:執行一細調程序。 Step 414: Perform a fine tuning procedure.

根據同步方法40,時脈產生裝置最快可於同步訊號的2個週期內使脈衝寬度調變訊號追上同步訊號。也就是說,時脈產生裝置最快可於同步訊號的2個週期內完成脈衝寬度調變訊號與同步訊號間的同步。透過合適的設計預設值及細調程序中分別對應於相位差異及週期差異的權重,使用者可彈性地設定時脈產生裝置執行同步所需的時間。同步方法40的詳細運作過程可參照上述,為求簡潔,在此不贅述。 According to the synchronization method 40, the clock generation device can catch the pulse width modulation signal up to the synchronization signal within 2 cycles of the synchronization signal. That is to say, the clock generation device can synchronize the pulse width modulation signal and the synchronization signal in the two cycles of the synchronization signal at the fastest. The user can flexibly set the time required for the clock generating device to perform synchronization by appropriately designing the preset value and the weights corresponding to the phase difference and the period difference in the fine adjustment program, respectively. The detailed operation process of the synchronization method 40 can be referred to the above. For the sake of brevity, no further details are provided herein.

綜上所述,上述實施例的時脈產生裝置利用中斷訊號的傳遞,控制時脈產生裝置中運算單元透過軟體的方式進行參數的計算,以使時脈產生裝置產生的脈衝寬度調變訊號同步於由前級電路所產生的同步訊號。據此,上述實施例的時脈產生裝置執行同步的所需時間可被最佳化,且使用者可根 據不同應用及設計理念彈性地控制執行同步的所需時間。 In summary, the clock generation device of the above embodiment uses the transmission of the interrupt signal to control the calculation of the parameters by the arithmetic unit in the clock generation device through the software, so that the pulse width modulation signal generated by the clock generation device is synchronized. The synchronization signal generated by the previous stage circuit. Accordingly, the time required for the clock generating apparatus of the above embodiment to perform synchronization can be optimized, and the user can root The time required to perform synchronization is flexibly controlled according to different applications and design concepts.

以上所述僅為本發明之較佳實施例,凡依本發明申請專利範圍所做之均等變化與修飾,皆應屬本發明之涵蓋範圍。 The above are only the preferred embodiments of the present invention, and all changes and modifications made to the scope of the present invention should be within the scope of the present invention.

40‧‧‧同步方法 40‧‧‧Synchronization method

400~414‧‧‧步驟 400~414‧‧‧Steps

Claims (16)

一種同步方法,用於一包含有一時脈產生單元及一運算單元的時脈產生裝置,該同步方法包含有:由該時脈產生單元計數一同步訊號的一同步週期;根據該同步訊號,由該時脈產生單元產生一第一中斷訊號予該運算單元,以使該運算單元取得該同步週期;根據一控制訊號,由該時脈產生單元產生一脈衝寬度調變訊號,並計數該同步訊號與該脈衝寬度調變訊號間的一相位差;根據該脈衝寬度調變訊號,由該時脈產生單元產生一第二中斷訊號予該運算單元,以使該運算單元取得該相位差;根據該同步週期、該脈衝寬度調變訊號的一調變週期、該相位差及一預設值,由該運算單元調整該控制訊號。 A synchronization method for a clock generation device including a clock generation unit and an operation unit, the synchronization method includes: a synchronization period in which the synchronization signal is counted by the clock generation unit; and according to the synchronization signal, The clock generating unit generates a first interrupt signal to the operation unit, so that the operation unit obtains the synchronization period; according to a control signal, the clock generation unit generates a pulse width modulation signal, and counts the synchronization. a phase difference between the signal and the pulse width modulation signal; according to the pulse width modulation signal, the clock generation unit generates a second interrupt signal to the operation unit, so that the operation unit obtains the phase difference; The synchronization period, a modulation period of the pulse width modulation signal, the phase difference, and a preset value are adjusted by the operation unit. 如請求項1所述的同步方法,其中該同步訊號是由一前級電路傳遞至該時脈產生單元。 The synchronization method of claim 1, wherein the synchronization signal is transmitted to the clock generation unit by a pre-stage circuit. 如請求項1所述的同步方法,其中該相位差為該同步訊號的一上升緣與隨後的該脈衝寬度調變訊號的一上升緣間的時間差。 The synchronization method of claim 1, wherein the phase difference is a time difference between a rising edge of the synchronization signal and a rising edge of the subsequent pulse width modulation signal. 如請求項1所述的同步方法,其中根據該同步週期、該脈衝寬度調變訊號的該調變週期、該相位差及該預設值,由該運算單元調整該控制訊號的步驟包含有:當該相位差的絕對值大於該預設值時,執行一粗調程序。 The synchronization method of claim 1, wherein the step of adjusting the control signal by the operation unit according to the synchronization period, the modulation period of the pulse width modulation signal, the phase difference, and the preset value comprises: When the absolute value of the phase difference is greater than the preset value, a coarse adjustment procedure is performed. 如請求項4所述的同步方法,其中當該相位差的絕對值大於該預設值時,執行該粗調程序的步驟包含有: 當該相位差大於該預設值時,調整該控制訊號,以減少該脈衝寬度調變訊號的一起始時間。 The synchronization method of claim 4, wherein when the absolute value of the phase difference is greater than the preset value, the step of performing the coarse adjustment procedure comprises: When the phase difference is greater than the preset value, the control signal is adjusted to reduce a start time of the pulse width modulation signal. 如請求項4所述的同步方法,其中當該相位差的絕對值大於該預設值時,執行該粗調程序的步驟包含有:當該相位差小於負的該預設值時,調整該控制訊號,以增加該脈衝寬度調變訊號的一起始時間。 The synchronization method of claim 4, wherein when the absolute value of the phase difference is greater than the preset value, the step of performing the coarse adjustment procedure comprises: adjusting the phase difference when the phase difference is less than the negative preset value Controlling the signal to increase the start time of the pulse width modulation signal. 如請求項1所述的同步方法,其中根據該同步週期、該脈衝寬度調變訊號的該調變週期、該相位差及該預設值,由該運算單元調整該控制訊號的步驟包含有:當該相位差的絕對值小於等於該預設值時,執行一細調程序。 The synchronization method of claim 1, wherein the step of adjusting the control signal by the operation unit according to the synchronization period, the modulation period of the pulse width modulation signal, the phase difference, and the preset value comprises: When the absolute value of the phase difference is less than or equal to the preset value, a fine adjustment procedure is performed. 如請求項7所述的同步方法,其中當該相位差的絕對值小於等於該預設值時,執行該細調程序的步驟包含有:計算該同步週期與該調變週期間的一週期差;計算該週期差與一第一權重的一第一乘積;計算該相位差與一第二權重的一第二乘積;相加該第一乘積與該第二乘積,以取得一總和;以及調整該控制訊號,以使該脈衝寬度調變訊號的一起始時間減少該總和。 The synchronization method of claim 7, wherein when the absolute value of the phase difference is less than or equal to the preset value, the step of performing the fine adjustment procedure comprises: calculating a period difference between the synchronization period and the modulation period Calculating a first product of the period difference and a first weight; calculating a second product of the phase difference and a second weight; adding the first product to the second product to obtain a sum; and adjusting The control signal is such that the start time of the pulse width modulation signal is reduced by the sum. 一種時脈產生裝置,包含有:一時脈產生單元,用來計數該同步訊號的一同步週期,根據該同步訊號產生一第一中斷訊號,根據一控制訊號產生一脈衝寬度調變訊號,計數該同步訊號與該脈衝寬度調變訊號間的一相位差,及根據該脈衝寬度調變訊號產生一第二中斷訊號;以及 一運算單元,用來根據該第一中斷訊號取得該同步週期,根據該第二中斷訊號取得該相位差,以及根據該同步週期、該脈衝寬度調變訊號的一調變週期與該相位差調整該控制訊號。 A clock generation device includes: a clock generation unit configured to count a synchronization period of the synchronization signal, generate a first interrupt signal according to the synchronization signal, generate a pulse width modulation signal according to a control signal, and count the a phase difference between the synchronization signal and the pulse width modulation signal, and generating a second interrupt signal according to the pulse width modulation signal; An arithmetic unit configured to obtain the synchronization period according to the first interrupt signal, obtain the phase difference according to the second interrupt signal, and adjust a phase change period of the pulse width modulation signal according to the synchronization period and the phase difference The control signal. 如請求項9所述的時脈產生裝置,其中該同步訊號是由一前級電路傳遞至該時脈產生單元。 The clock generating device of claim 9, wherein the synchronization signal is transmitted to the clock generating unit by a preceding circuit. 如請求項9所述的時脈產生裝置,其中該時脈產生單元取得該同步訊號的一上升緣與隨後的該脈衝寬度調變訊號的一上升緣間的時間差作為該相位差。 The clock generation device of claim 9, wherein the clock generation unit obtains a time difference between a rising edge of the synchronization signal and a rising edge of the subsequent pulse width modulation signal. 如請求項9所述的時脈產生裝置,其中當該相位差的絕對值大於該預設值時,該運算單元執行一粗調程序。 The clock generating device of claim 9, wherein the arithmetic unit performs a coarse adjustment procedure when the absolute value of the phase difference is greater than the preset value. 如請求項12所述的時脈產生裝置,其中當該相位差大於該預設值時,該運算單元調整該控制訊號,以減少該脈衝寬度調變訊號的一起始時間。 The clock generating device of claim 12, wherein when the phase difference is greater than the preset value, the operation unit adjusts the control signal to reduce a start time of the pulse width modulation signal. 如請求項12所述的時脈產生裝置,其中當該相位差小於負的該預設值時,該運算單元調整該控制訊號,以增加該脈衝寬度調變訊號的一起始時間。 The clock generation device of claim 12, wherein when the phase difference is less than the negative predetermined value, the operation unit adjusts the control signal to increase a start time of the pulse width modulation signal. 如請求項9所述的時脈產生裝置,其中當該相位差的絕對值小於等於該預設值時,該運算單元執行一細調程序。 The clock generating device of claim 9, wherein the arithmetic unit performs a fine adjustment procedure when an absolute value of the phase difference is less than or equal to the preset value. 如請求項15所述的時脈產生裝置,其中該運算單元計算該同步週期與該調變週期間的一週期差;計算該週期差與一第一權重的一第一乘積;計算該相位差與一第二權重的一第二乘積;相加該第一乘積與該第二乘積,以取得一總和;並調整該控制訊號,以使該脈衝寬度調變訊號的一起始時間減少該總和。 The clock generation device of claim 15, wherein the operation unit calculates a period difference between the synchronization period and the modulation period; calculates a first product of the period difference and a first weight; and calculates the phase difference And a second product of a second weight; adding the first product and the second product to obtain a sum; and adjusting the control signal to reduce a start time of the pulse width modulation signal by the sum.
TW103123222A 2014-05-14 2014-07-04 Synchronization method and clock generating device thereof TWI518476B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US14/697,642 US9363069B2 (en) 2014-05-14 2015-04-28 Clock generating device and related synchronization method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
US201461992914P 2014-05-14 2014-05-14

Publications (2)

Publication Number Publication Date
TW201543195A TW201543195A (en) 2015-11-16
TWI518476B true TWI518476B (en) 2016-01-21

Family

ID=55220917

Family Applications (1)

Application Number Title Priority Date Filing Date
TW103123222A TWI518476B (en) 2014-05-14 2014-07-04 Synchronization method and clock generating device thereof

Country Status (1)

Country Link
TW (1) TWI518476B (en)

Also Published As

Publication number Publication date
TW201543195A (en) 2015-11-16

Similar Documents

Publication Publication Date Title
US9124415B2 (en) PLL glitchless phase adjustment system
JP2016021628A5 (en)
EP2312756A2 (en) A dual reference oscillator phase-lock loop
US10243572B2 (en) Hybrid phase locked loop having wide locking range
US11689350B2 (en) Synchronization between devices for PWM waveforms
CN107800529B (en) Clock frequency synchronization method of network node
US20120051479A1 (en) Clock frequency adjusting circuit and clock frequency adjusting method thereof
WO2016050211A1 (en) High-frequency delay-locked loop and clock processing method for same
TWI518476B (en) Synchronization method and clock generating device thereof
US20150333900A1 (en) Clock Generating Device and Related Synchronization Method
TWI675280B (en) Clock generation circuit and clock adjustment method thereof
JP2011083841A (en) Robot control device, robot control system, and robot control method
CN109787620B (en) Method and device for calibrating frequency based on digital frequency divider
US9654117B1 (en) Digital phase-locked loop having de-coupled phase and frequency compensation
KR102103183B1 (en) Circuit for driving of led and method therefor
TWI416876B (en) Frequency-phase adjusting device and method thereof
US8742795B2 (en) Frequency difference calculation circuit, a satellite signal receiving apparatus and frequency difference calculation method
JP6950172B2 (en) Spread spectrum clock generation circuit
JP6653964B2 (en) Oscillation circuit
KR100335457B1 (en) Phase-locked loop circuit, deflection correction circuit, and display device
KR101589808B1 (en) Frequency Synthesizer and Phase synchronizing control device based on initial phase offsetting
JP2018160754A (en) Output signal state changing circuit
KR101754237B1 (en) Radar apparatus for generating clocks delayed for trigger signal and operating method thereof
JP5986172B2 (en) Clock generation method for rising edge operating system
KR101697309B1 (en) Delay lock loop circuit for wide band anti-harmonic lock and pdelay locking method thereof