When a single Continuous Wave (CW) RF tone is mixed to baseband, it creates two signals (in-phase and quadrature) should be orthogonal to each other with the same amplitude. Without loss of generality, we normalize the magnitude and the phase, then the two signals can be expressed as:
As mentioned above, we want to rotate these signal around the same point, which is the same as providing a constant phase shift.
![]()
where "w" is the baseband frequency of the tone, and "ψ" is the desired phase shift, which will cause a fixed rotation around the origin (in a constellation, or I vs Q plot).

We can use the trigonometric sum/difference identities to re-write that as:

and substitute our original uncorrected values, (and swap the order of , so we can see the matrix a little easier…

translating that into a 2 x 4 matrix multiply is quite easy.

注意(yì):这(zhè)里(lǐ)可(kě)以(yǐ)看(kàn)到(dào)I路(lù)的(de)校(xiào)準系(xì)數为(wèi)cosφ和(hé)-sinφ,Q路(lù)的(de)校(xiào)準系(xì)數为(wèi)sinφ和(hé)cosφ,而(ér)在(zài)软(ruǎn)件(jiàn)里(lǐ)面(miàn)Q路(lù)的(de)校(xiào)準系(xì)數卻是cosφ和(hé)sinφ,根(gēn)據(jù)邢老(lǎo)师(shī)解(jiě)釋,这(zhè)是由(yóu)于(yú)PL的(de)IP core里(lǐ)面(miàn)将这(zhè)两(liǎng)个(gè)系(xì)數調換了(le)一(yī)下(xià)位(wèi)置導致(zhì)的(de)。

4、相位(wèi)差計(jì)算原理(lǐ)
4.1、相位(wèi)差原理(lǐ)
两(liǎng)路(lù)接收(shōu)中頻數字(zì)信号(hào)是以(yǐ)I、Q信号(hào)的(de)方(fāng)式呈現(xiàn),这(zhè)是一(yī)種(zhǒng)矢量(liàng)表(biǎo)示。如(rú)下(xià)图(tú)所(suǒ)示。在(zài)某一(yī)时(shí)刻(kè),两(liǎng)路(lù)信号(hào)的(de)采樣(yàng)數據(jù)为(wèi)矢量(liàng)a和(hé)b,其相位(wèi)差,即矢量(liàng)夾角为(wèi)θ,那麼(me):

可(kě)以(yǐ)用(yòng)来(lái)求夾角θ,但我(wǒ)们(men)直(zhí)到(dào)cos(θ)=cos(-θ),所(suǒ)以(yǐ)这(zhè)種(zhǒng)方(fāng)式計(jì)算相位(wèi)差,会(huì)丢失超前(qián)滞后關(guān)系(xì)。


对(duì)于(yú)接近(jìn)0度(dù)的(de)相位(wèi)差計(jì)算,使用(yòng)tan的(de)方(fāng)式更(gèng)好(hǎo),对(duì)于(yú)采樣(yàng)點(diǎn)數为(wèi)N的(de)两(liǎng)組中頻信号(hào)a[n]、b[n],使用(yòng)以(yǐ)下(xià)公(gōng)式計(jì)算相位(wèi)差:

对(duì)應(yìng)的(de)代码如(rú)下(xià):

5、測試
首先(xiān),控制開(kāi)關(guān)讓其工作(zuò)在(zài)校(xiào)準鍊(liàn)路(lù),然后發(fà)送DDS,通(tòng)过(guò)IIO SCOPE读(dú)取(qǔ)數據(jù)看(kàn)到(dào)如(rú)下(xià)情(qíng)況,两(liǎng)个(gè)信号(hào)的(de)相位(wèi)存在(zài)明(míng)顯差异(yì)。

然后,開(kāi)始(shǐ)啟動(dòng)相位(wèi)校(xiào)準,校(xiào)準过(guò)程打(dǎ)印(yìn)如(rú)下(xià)所(suǒ)示:

最(zuì)后,通(tòng)过(guò)IIO SCOPE查看(kàn)校(xiào)準后的(de)信号(hào),如(rú)下(xià)所(suǒ)示:

可(kě)以(yǐ)看(kàn)到(dào)两(liǎng)路(lù)的(de)信号(hào)相位(wèi)基本(běn)相同(tóng)。校(xiào)準完成(chéng)。





















