Improve the method for preciseness of mobile communication terminal low frequency crystal oscillator
Technical field:
The present invention relates to moving communicating field, fast quick-recovery system sequence accurately when particularly mobile communication terminal returns under the low frequency crystal oscillator mode of operation improves the method for preciseness of mobile communication terminal low frequency crystal oscillator.
Background technology:
Along with the development of radio communication with popularize, mobile communication subscriber quantity is at double growth, mobile subscriber's growth at full speed especially in the last few years of China, along with portable terminal---popularizing of mobile phone, the user is more and more higher to the requirement of communication and quality.Because at present advanced mobile communication terminal can also provide functions such as the online image of high speed, music, video, web page browsing, videoconference, electronic commerce information except basic voice, data function can be provided.For satisfying these complicated functions, portable terminal also needs module and corresponding with it powerful operating systems such as integrated image, audio frequency, video, big capacity storage except having the most basic communication module.And realize complicated function can producing high power consumption, the reception of mobile phone and the accuracy of transmission signal are descended.
When the user selected terminal, except to the demand on the function, the stand-by time of terminal also was the key factor of its consideration.Therefore, under the limited condition of battery capacity, thereby reduce the power consumption of terminal prolongs standby time, have crucial meaning.
Which kind of task when terminal carry out, and is to be planned according to the base station system message that receives by the upper-layer protocol in the terminal.Fig. 1 is the communication scheme of terminal and base station.Terminal reception base station system information is analyzed the channel and the moment that obtain, and the upper-layer protocol planning terminal in the terminal is in the reception of the moment of appointment and send relevant information.Terminal needs and the base station keeps system sequence accurately, could receive constantly accurately and transmission information, and the realization terminal is communicated by letter with the base station.
In portable terminal, the clock (for example VCXO under the 13MHz) that a upper frequency is provided usually simultaneously keeps system sequence accurately with the base station to realize data processing at a high speed.In addition, terminal also has a low frequency (for example 32768Hz) clock, is used for displaying calendar and time.When terminal works need consume a large amount of electric energy during at the high-frequency clock.
The power saving of terminal design at present when terminal is in the state (being commonly referred to the free time) of no task, is closed the high-frequency clock usually, enters the state (being commonly referred to sleep) with low frequency crystal oscillator work; When task, open the high-frequency clock again, switch to operating state from sleep state, Processing tasks under the high-frequency clock.
Under sleep state, terminal is counted the length of one's sleep (example, be 1 second the length of one's sleep, then the counting low-frequency clock during cycle that reaches 32768 32768Hz wakes terminal up) with low frequency crystal oscillator.Yet, low frequency crystal oscillator is subjected to the influence of external environments such as flow-route and temperature easily, generally not really accurately (according to crystal oscillator quality difference, the deviation of actual frequency and nominal frequency is generally 10~20ppm), therefore, with low frequency crystal oscillator counting length of one's sleep also inaccuracy (as: be 1 second the length of one's sleep, and the time span in actual 32768 low frequency crystal oscillator cycles is not enough or greater than 1 second).The accuracy of low frequency crystal oscillator is high more, and the length of one's sleep of terminal is accurate more, could keep system sequence accurately with the base station after waking up, receives base station system message accurately.Therefore, improve the accuracy of low frequency crystal oscillator, thereby could reduce the power consumption of terminal prolongs standby time.
Chinese patent 97181226.8, name is called " method and apparatus that is used for reducing standby current in communication equipment ", provides synchronizer to improve the low-frequency clock accuracy, and its synchronizer comprises counter, sync logic, feedback loop, low pass filter etc.Employing reaches the purpose that improves the low-frequency clock accuracy with low-frequency clock and the synchronous method of high frequency clock, realizes with hardware circuit.The shortcoming of the method is need add extra hardware circuit on terminal to realize.
Summary of the invention
Purpose of the present invention, provide a kind of method that improves preciseness of mobile communication terminal low frequency crystal oscillator, it is by waking the synchronous difference of back terminal and base station up, calculate low frequency crystal oscillator frequency theoretical value in real time, make it approach actual value, to reach the purpose that improves the low frequency crystal oscillator accuracy, make behind the terminal wake-up fast quick-recovery system sequence accurately.
The present invention is at the microprocessor synchronized algorithm of terminal, by waking the synchronous difference of back terminal and base station up, calculate low frequency crystal oscillator frequency theoretical value in real time, make it approach actual value, thereby reach the purpose that improves the low frequency crystal oscillator accuracy, make behind the terminal wake-up fast (embodiment only needs 5 milliseconds) to recover system sequence accurately.
The present invention is mainly used in the mobile phone that the band clock shows, the frequency of its low frequency crystal oscillator is about 32KHz, and the present invention has good effect to the mobile communication system of the relative high accuracy sequential of needs.
The method of the invention may further comprise the steps:
1) terminal receives base station signal;
2) upper-layer protocol in the terminal is planned the length of one's sleep, makes terminal at the initial moment t of data designated piece
wWake up, terminal is closed high frequency clock and is entered sleep state;
3) terminal begins accumulative total low frequency crystal oscillator clock periodicity, when count value between sleep period during low frequency crystal oscillator periodicity sleepclk_mun, terminal is opened high frequency clock and is entered operating state, at the t time of reception of data block reality
w' reception base station signal;
4) base station data that receives of terminal processes is done synchronous calculating, obtains synchronous difference T
Gap, terminal recomputates low frequency crystal oscillator frequency theory value F according to synchronous difference
t, make it approach the actual frequency F of low frequency crystal oscillator in real time
R, wherein;
F
t=sleepclk_num÷(sleepclk_num*(1/F
R)+T
gap),
Sleepclk_num is a low frequency crystal oscillator periodicity during the terminal sleep in the formula,
Be terminal real length of one's sleep, T
GapBe synchronous difference.
Described synchronous difference T
GapEqual the terminal sleep error.
The real length of one's sleep of the length of one's sleep-terminal of terminal sleep error=terminal planning,
Therefore have,
In the formula
Be the length of one's sleep of terminal protocol planning.
Whenever terminal upper-layer protocol planning length of one's sleep, the low frequency crystal oscillator frequency theory value F that all calculates when repeating said method with the last time
tFor planning the length of one's sleep in the basis.
Behind the starting up of terminal, obtain the initial value F of low frequency crystal oscillator frequency theory value by the hardware counter of low frequency crystal oscillator
T0After this, according to the synchronous difference T that wakes up at every turn
GapCalculate the theoretical value F of low frequency crystal oscillator in real time
t, make it approach actual value F
R, detailed process such as Fig. 5 show.
Referring to Fig. 5.Terminal receives base station system message, obtains base station assigned by analysis and gives its channel and the moment.If no task needs to carry out, terminal is with low frequency crystal oscillator frequency theory value F
t(for example, sleepclk_num low frequency crystal oscillator periodicity promptly planned the length of one's sleep=sleepclk_num* (1/T to plan the length of one's sleep
t)), make the t of terminal in appointment
w(being the initial moment of data block) wakes up constantly; Terminal is closed high frequency clock and is entered sleep state then, and terminal begins accumulative total low frequency crystal oscillator periodicity simultaneously, and when count value expired sleepclk_num, terminal was opened high frequency clock and entered operating state, at t
w' (received signal should be t constantly in theory constantly to receive base station signal
w, but because of between sleep period, terminal is with the low frequency crystal oscillator accumulative total periodicity of actual frequency, the promptly true length of one's sleep=sleepclk_num* (1/F
R), F
tWith F
RBetween the error that exists cause the true length of one's sleep short or be longer than planning length of one's sleep, so the actual t time of reception
w' in advance or lag behind t
w, because of sleep shifts to an earlier date or time of lagging behind (is t
w-t
w') being sleep error (be the system sequence error, its value is poor for the planning length of one's sleep and the true length of one's sleep), therefore error size can draw the sleep error by synchronous difference with difference is identical synchronously; The base station data that terminal processes receives is done synchronous calculating, obtains synchronous difference T
Gap(be t
w' with t
wDifference).The synchronous difference of terminal utilization, employing formula (4) recomputate low frequency crystal oscillator frequency theory value F
t, make it approach actual value F in real time
R(for different communication systems, the synchronized algorithm difference all can be used for F and which kind of method to obtain synchronous difference with
tCalculating).As this low frequency crystal oscillator frequency theory value F
tAfter calculating was finished, terminal received base station information once more, repeated above step.Whenever terminal upper-layer protocol planning length of one's sleep, the low frequency crystal oscillator frequency theory value F that all calculates when repeating said method with the last time
tFor planning the length of one's sleep in the basis.
Calculate low frequency crystal oscillator frequency theory value F
tMethod as follows:
If the low frequency crystal oscillator periodicity is sleepclk_num between sleep period, then have:
The real length of one's sleep of the length of one's sleep-terminal of sleep error=terminal planning.Formula (3)
Because the sleep error equals synchronous difference T
GapSo formula (3) can be expressed as follows:
So, can utilize synchronous difference T
GapRecomputate F
tAnd make it approach F in real time
R, reach the purpose that improves low frequency crystal oscillator frequency accuracy.Computing formula is as follows:
F
t=sleepclk_num ÷ (sleepclk_num (1/F
R)+T
Gap), formula (4).
From formula (1)~(3) as can be known, F
tApproach F more
R, sleep error more little (that is, the system sequence error behind the terminal wake-up is more little), terminal (embodiment is 5 milliseconds, depends on the required time synchronously) is at short notice finished synchronous calculating, recovers system sequence accurately.
Wherein:
Theoretical value F
t: the low frequency crystal oscillator frequency that terminal calculates in real time
Actual value F
R: the actual frequency of low frequency crystal oscillator
The invention has the beneficial effects as follows:
After terminal is waken up, receive base station signal at every turn,, do synchronous calculating, obtain synchronous difference by the base station data that terminal processes receives.And recomputate low frequency crystal oscillator frequency theory value according to synchronous difference, make it approach actual value in real time, improved the low frequency crystal oscillator accuracy, still keep system sequence more accurately after making terminal wake-up, finish fast easily with the base station synchronously, recover system sequence accurately at short notice.
Adopt this scheme, can improve the low frequency crystal oscillator accuracy, make behind the terminal wake-up fast quick-recovery system sequence accurately.This programme is applicable to the mobile communication system that all need relative high accuracy sequential.
Description of drawings
Fig. 1 is a terminal and the schematic diagram of communicating by letter of base station;
Fig. 2 is for adopting this method correction F
tThe sleep sum of errors for not revising F
tSleep error comparison diagram;
Fig. 3 is the hardware counter circuit diagram;
Fig. 4 is a TD-SCDMA system burst structural representation;
Fig. 5 is terminal sleep and wakeup process;
Fig. 6 is sleep of OMAP platform control terminal and wakeup process schematic diagram.
Embodiment
With the TD-SCDMA system is example, briefly introduces the notion of synchronous and synchronous difference.
TD-SCDMA system burst structure as shown in Figure 4.The information of terminal and base station communication is placed on data symbol block, and intermediate code is used for synchronously and the identification user.Terminal must be in that constantly (the initial moment of data block be made as t accurately
wConstantly) receive or send signal (we claim this moment terminal and base station synchronization), could realize and the communicating by letter of base station.Receive and send signal if shift to an earlier date or lag behind, all can not set up and communicate by letter with the base station; The time difference that shifts to an earlier date or lag behind, difference (is designated as T synchronously exactly
Gap).
Wherein, nominal value F
C: the nominal frequency of low frequency crystal oscillator, the 32KHz clock nominal frequency that present embodiment adopts is 32768Hz.
Terminal is if know the frequency actual value F of low frequency crystal oscillator
R, just can obtain the accurate length of one's sleep of (low frequency crystal oscillator periodicity * (1/F between the length of one's sleep=sleep period
R)).Yet, as previously mentioned, F
RWith the variation of external environment among a small circle (10~20ppm) changes, Here it is length of one's sleep coarse reason.Terminal can't be known F
RReal-time exact value.Adopt the inventive method, calculate the theoretical value F of low frequency crystal oscillator in real time
t, make it approach actual value F
R, reach the purpose that improves the low frequency crystal oscillator accuracy.
Referring to Fig. 3.CPLD is a CPLD among the figure; OMAP is an OMAP; SPI is a Serial Peripheral Interface (SPI).With CPLD and OMAP is the main hardware platform, realizes this method in the TD-SCDMA system.Wherein, the OMAP platform is realized the function of base band signal process, comprises synchronously and the real-time calculating of low frequency crystal oscillator frequency the switch of each device of CPLD platform control terminal and high-frequency clock, accumulative total clock periodicity.The SPI interface is realized the exchanges data of CPLD and OMAP.During the terminal operate as normal, be work clock with high frequency clock F1 (13MHz), power consumption is higher; During terminal sleep, be work clock with low-frequency clock F2 (the frequency nominal value is 32768Hz), power consumption is lower.
A hardware counter is arranged among the CPLD, and it and OMAP associated working, effect are the frequency initial theory value F that obtains the low frequency crystal oscillator
T0, hardware counter designs referring to Fig. 3.The course of work is as follows:
CPLD adds up F respectively
1And F
2The periodicity of clock is as full M the F of counting
2Stop during clock periodicity, at this moment F
1Clock periodicity is N.OMAP reads hardware counter value M and N the CPLD from the SPI interface, according to computing formula (5), calculates the frequency initial theory value F of low frequency crystal oscillator
T0, preserve with the form of global variable.Gate time is long more, the initial theory value F that calculates
T0Approach actual value F more
RThe CPLD resource that takies simultaneously (mainly being the register of CPLD) is many more.
(second), formula (5)
The method implementation procedure that improves preciseness of mobile communication terminal low frequency crystal oscillator is as follows:
After starting up of terminal entered the free time, the hardware counter of CPLD began to add up respectively F
1And F
2The periodicity of clock, after counting was finished, OMAP read hardware counter value the CPLD from the SPI interface, calculated the frequency initial theory value F of low frequency crystal oscillator according to formula (5)
T0
After this, terminal is with step shown in Figure 6, realization theory value F
tReal-time calculating:
Referring to Fig. 6.Terminal receives base station system message, the upper-layer protocol software analysis system message in the OMAP and obtain base station assigned and give the channel of terminal and constantly.If no task will be carried out, and the upper-layer protocol planning length of one's sleep in the OMAP (for example, sleepclk_num low frequency crystal oscillator periodicity, promptly
) make the t of terminal in appointment
wConstantly wake up, sleepclk_num is sent to CPLD from the SPI interface.CPLD begins to carry out following work: CPLD and closes high frequency clock and other devices that can close, and terminal enters sleep pattern.Simultaneously, CPLD begins accumulative total low-frequency clock periodicity.Expire sleepclk_num low-frequency clock during the cycle when the CPLD counting, open high frequency clock and other devices of closing, send wake-up interrupts notice OMAP and wake up, terminal enters mode of operation.
Terminal is at t
w' the moment receives base station signal.OMAP does the slip correlation computations with the data that receive and the midamble sign indicating number (intermediate code) of current use, the position of midamble correlation peak reaches chip level (the system sequence error that is terminal and base station is in the 1chip scope, and wherein the 1chip time span is 0.78125 microsecond) synchronously; Do difference with same group of received data again and calculate synchronously, the position of midamble correlation peak reaches 1/8chip level (the system sequence error that is terminal and base station is in the 1/8chip scope) synchronously.The position of the midamble correlation peak that obtains at this moment, is positioned at the centre position t of midamble sign indicating number
m,, can obtain t according to TD-SCDMA system burst structure chart
wPosition constantly:
t
w=t
m-352chip, formula (6)
Wherein the time span of 1chip is 0.78125 microsecond.
Thereby obtain synchronous difference T
Gap=t
w-t
w'.
OMAP utilizes synchronous difference to recomputate F according to formula (4)
tThereby, make it approach F in real time
RTerminal receives base station system message once more then, repeats above step.Whenever terminal upper-layer protocol planning length of one's sleep, the low frequency crystal oscillator frequency theory value F that all calculates when repeating said method with the last time
tFor planning the length of one's sleep in the basis.
Adopt this method, the sleep error range after waking up is in 1 microsecond.Referring to Fig. 2.Fig. 2 adopts this method correction F
tThe sleep sum of errors for not revising F
tSleep error comparison diagram.More as can be known, after employing this method improves the low frequency crystal oscillator accuracy, can reduce the error of sleeping greatly.
No matter use which kind of hardware platform and synchronized algorithm, can adopt this method to improve the low frequency crystal oscillator accuracy, all can reach above-mentioned same effect.