[BIOS] Clock generator introduction

A.學習目標 (Clock generator introduction)
a.瞭解EMISpread Spectrum
b.知道如何透過clock gen開關展頻跟超頻

B.大綱
1. Clock Generator Overview
2. EMI and Spread Spectrum
3. Over Clock

C. Clock Generator Introduction
C.1. Clock Generator Overview
Clock Generator 的目的就是要提供clockDevices,我們可以在圖一中看到這顆Clock Generator提供給各種Devices所需的clock
甚至早期的Memory clock也都是由Clock Generator提供的.
To generate a clock signal (timing signal)
Clock Generator Used to coordinate the actions of two or more circuit.
Clock Generator Used to determine the CPU, PCI, and system bus speeds.
A clock signal oscillates between a high and a low state, normally with a 50% duty cycle, and is usually a square wave.
The circuits using the clock signal for synchronization may become active at either the rising or falling edge, or both of the clock signals.

圖一

C.2. EMI and Spread Spectrum [1]
展頻(Spread Spectrum, SS) 是將傳輸訊號的頻譜(spectrum)打散到較其原始頻寬更寬的一種通訊技術,常用於無線通訊領域。比較嚴格的定義則分成兩個部分:
1. 展頻調變之後,其訊號傳輸頻寬應遠大於原始訊號
2. 傳輸端會採用一個獨特的碼(code),此碼與傳送資料是無關的,接收端也必須使用這個獨特的碼才能解展頻以獲得傳輸端的資料。
代表性的展頻方式有二:
1. 直接序列展頻(簡稱直序展頻)(Direct-sequence spread spectrum, DSSS)
2. 跳頻(Frequency-hopping spread spectrum, FHSS)

發展歷史
展頻原本應用在軍事和情報系統,主要的概念是將資料訊號擴展成較寬的頻譜,使得信號不易被干擾和截取。後來技術開放,便應用到CDMA2G手機通訊)、無線區域網路(WLAN)IEEE 802.11系列)等領域。

優點與用途
1. 對背景的雜訊(noise)、干擾(interference)以及自體多路徑干擾(Multipath interference)有免疫力。
2. 對人為的刻意干擾(jamming)訊號有良好的抵禦能力,這也是展頻最早應用於軍方通訊系統中對抗人為的干擾重要原因其一。
3. 較良好的隱密性,通訊過程被截收的可能性較低。這是因為展頻後,單位頻率的功率值降低,截收者不易透過頻譜分析儀獲得敵方通訊的資訊;即使電波被接收了,由於截收者不知道展頻碼的內涵,因此無法回復編碼的資訊。所以展頻通訊亦具有簡單的保密通訊能力。
4. 降低電磁干擾(Electromagnetic Interference, EMI),若對電子裝置的時脈產生器(Clock generator)做展頻,也就是刻意在時脈訊號(Clock signal)中添加抖動(jitter),則可以將特定造成電磁干擾的能量由特定頻率打散,進而減輕其干擾程度,本質上和通訊技術的展頻是相同的。在個人計算機的BIOS設置中常常可以看到Spread Spectrum的選項。此處這個選項的主要目的是用於降低電磁干擾,依據不同的系統配置可能能夠有效降低電磁輻射的量。但是副作用是降低了訊號的清晰度,對超頻之後的系統穩定性影響較大。
5. 藉由展頻技術,可以達成分碼多工(CDMA)通訊,讓多個用戶能夠獨立地同時使用更大的頻寬。

Electro-Magnetic Interference (EMI): It is also called Radio Frequency Interference (RFI) is a disturbance caused in a radio receiver or other electrical circuit by electromagnetic radiation emitted from an external source. 
Spread Spectrum: Spread Spectrum is a modulation technique used to minimize EMI radiation generated by repetitive digital signals.
Spread Spectrum distributes this energy over a specific and controlled frequency bandwidth therefore causing the average energy at any one point in this band to decrease in value.
This technique is achieved by modulating the clock away from its resting frequency by a certain percentage.

接下來說明一下我們要如何展頻?展頻又有哪些種類?
這邊我們拿CY28330這顆Clock Generator來說明,通常會有一個叫做Spread Spectrum Enablebit在控制展頻是由硬體還是軟體決定。
如圖二所示,硬體pin44先決定要不要開(1=開、0=給軟體決定),然後才看圖三B0b6的值(bit6),只有在兩個值都是0的情況之下,Spread Spectrum才會被關閉。
There is a bit, which is Spread Spectrum Enable, provides a software programmable control for spread spectrum clocking.
If the hardware Pin 44 is setting0 that means the controllable capability transfer to software programmer.
圖二
圖三

決定了打開展頻之後,還可以決定展頻的模式,通常我們有兩種展頻模式可以選擇,
1. Down Spread
2. Center Spread
register裡面也會有bit可以控制展頻模式Down Spread or Center Spread
Usually, there is a register of Spread Spectrum Clock Generator (SSCG) which controls the Spread Percentage.
如圖四,bit 7控制著展頻模式 (0= Down Spread 1= Center Spread)。另外bit5 bit 6 組合起來可以控制展頻的程度,
所以設定bit 5~7就能表示出不同模式與不同程度的展頻,整理結果如圖五。
(比方bit5=0, bit6=1, bit7=1,就表示down spread -0.5%)

圖四
圖五

假設沒有開展頻情況下Bus Speed 200 MHz (圖六左),今天我們開down spread -0.25%的情況之下,則變成圖六右Bus Speed 199.5 MHz
200 * -0.25% = -0.5,注意一點其實Bus Speed 是在200MHz199.5MHz之間變動而不是穩定的變成199.5MHz
因為如果穩定變成199.5MHz那還有展頻的意義嗎!!!


圖六(左展頻關 右展頻開)

假設有興趣研究Down and Center Spread Spectrum 的話還可以看一下圖七~八,可以清楚看到紅色線展頻之後,變成綠色這段,將可以減少許多EMI
圖七
圖八

C.3. Over Clock
先有個概念就是CPU頻率可以調整,並不是固定的,而且PC很多元件都能超頻,只是這邊重點放在CPU超頻。
這邊我們要講解CPU Over clock的概念,首先CPUclock來自system busclock,而system busclock又來自Clock Generator
所以調整Clock Generator提供給system busclock,就等於調整CPUclock
我們有兩種方式去調整system busclock
1. Table mode          (clock gen. 內部固定的設定,不能自由調整)
2. Linear mode        (可自由調整,知道公式之後套公式調整,這邊的自由其實是相對Table mode只能133200266linear mode可以做到201202203這樣的自由。)
Many parts of a computer can be over clocked but here we look at CPU over clocking.
The concept behind CPU over clocking is that processors are designed to run at different speeds, not just one fixed speed.
You can use the BIOS to vary the speed at which the CPU runs to achieve the over clocking effect.
One way to achieve over clocking is to over clock the system bus.
Motherboards are usually designed to run at specific speeds with certain multipliers.
Themultiplier is defined as the number of times faster the processor speed is than the system bus. (Fixed)

Table Mode (CY505 Clock gen.為例子)
圖九
如圖九,我們調整Clock gen. 提供給system bus clock的部份,其實就是在調整外頻。

通常我們查spec.會有一張表(圖十)。會告訴我們,填FSA~FSD4個為一組的register就能調整他的外頻,不過通常很不幸的,FSA~FSC都會被硬體鎖死,你只能調整調整FSD,比方你的FSA~FSC 1,0,0, 那表示你可以調整 FSD0 or 1 ,查表可以知道,CPU外頻在FSD=0133,而FSD=1時則為133.9。是不是很無言沒錯就是只能這樣,只多了0.9
Host clock frequency selection is achieved by applying the appropriate logic levels to FSA, FSB, FSC and FSD inputs prior to CK_PWRGD.
Upon CK_PWRGD being sampled LOW by the clock chip, the clock chip samples the FSA, FSB, FSC and FSD input values
圖十

Linear mode (一樣以CY505 Clock gen.為例子)
Table mode一樣是,都是調整CPU frequency的方法,在這個CY505 clock gen.之下,CPU frequency = G*N/M
公式在每顆clock gen.都不一樣,所以必須找到公式,才能夠利用Linear mode調整。
The feature allows the user to over clock their system by slowly stepping up the CPU frequency.
When the programmable output frequency feature is enabled, the CPU frequency is determined by the following equation:
F=G*N/M

先來看一下,還沒超頻之前,CPUbus speed 133.3 MHz (圖十一)
(圖十一)

我們知道 F=G*N/M 之下
由圖十一與圖十二,可以知道G值是40,根據廠商給我們的建議N60,所以我們可以導出
外頻* (1.5) =N
The formula needed for this clock generator in linear mode is: CPU external frequency = G*N/M.
This clock generators G-value is 40 and based on the recommended M-value for this particular clock generator should be 60.
Thats why we can use the below formula: External frequency *1.5 = N.
圖十二

根據外頻* (1.5) =N 這個公式
假設我們要超頻道170 MHz 則我們的N=255 = FFh
而且根據spec, 假設我們設定好M , N 值之後,我們必須打開在第17th這個registerbit 3 (Prog_CPU_EN)
圖十三 ( register 14N我們要設定成255=FFhregister 15M我們要設定成60=3Ch )
圖十四 ( register 17bit 3Prog_CPU_EN 我們要設成1)
If I want the external frequency to reach 170 MHz, I can use the above formula and change the N-value to 255, which is 0FFh.
When I finish setting the values for both M and N values, I need to input 09h at the 17th register in order to begin over clocking.
圖十三
圖十四

利用工具軟體把該設的register設一設 (圖十五)
(register 14=FFh, register 15=3Ch, register 17=09h)
設定完畢,回頭看一下CPU bus Speed 已經變成170 MHZ(圖十六)

參考文獻
[1]《展頻通訊原理(技職94版)》林福林 南台科技大學電子工程學系
[2] CY505 spec.

留言