Abstract:
The present invention provides a communications unit for operation in a communication system in accordance with a protocol that operates to a first clock resolution, the communications unit comprising a first clock, operating to the first resolution, a second clock operating to a second resolution higher than the first resolution, means configured to respond to a request to report a clock value by reporting: (a) the current value of the first clock and (b) information indicating the time on the second clock at which the first clock ticked to its current value.

Description:
BACKGROUND OF THE INVENTION 
     This invention relates to accurately obtaining the Bluetooth Master clock. 
     A Bluetooth piconet is an ad-hoc Bluetooth network featuring a master node and one or more slave nodes. There can be up to seven active slave nodes in a piconet although additional nodes (up to 255) may remain synchronized to the master but ‘parked’ and not active in the piconet. 
     Each Bluetooth device features a clock, that has a tick period of 312.5 μs (this equates to half a Bluetooth slot period). The clock of the master device is used as a ‘Master Clock’ within the piconet and is transmitted to the slave devices. Each slave device maintains a clock offset value which is the offset between the master clock and its own clock. This offset value is updated every time a packet is received from the master clock. 
     For an application running on a slave device, the most accurate available network synchronised clock is the Master Clock. However, the resolution of the Master Clock available to the application is limited by the Host Controller Interface. This limitation, defined by the Bluetooth specification, allows only the most recent clock tick to be visible to the application. Furthermore, the command time, defined as the period of time between when the application requests the Master Clock through the Host Controller interface and when it receives the Master Clock data, is significant, and can add to the inaccuracy of the low resolution representation of the Master Clock time. 
     Therefore, when the application running on a slave device attempts to estimate the Master Clock time, the estimate is approximated by the equation:
 
Master Clock Estimate=Master Clock+Clock Rounding Error+Clock Drift+Command Time
 
     Given the resolution of the Bluetooth clock, the clock rounding error is 0-312.5 μs. The clock drift of the Master device internal clock is approximately 20 ppm (parts per million) and so assuming that the Master Clock is transmitted to each slave device at least every 25 ms, this will be +/−1 μs. The command time varies with implementation but is typically in the order of several milliseconds. 
     Therefore, the worst case error is given by:
 
Worst Case Error=312.5 μs+1 μs+2000 μs=2313.5 μs
 
     Given the speed of sound, a sound wave will travel approximately 78 cm in 2313.5 μs. In a stereo environment in which the left and right audio channels are controlled by separate Bluetooth devices, this could result in one channel having a delay of 2313.5 μs relative to the other channel. Given the sophisticated auditory and spatial calculations performed by the brain, this would present to the listener the illusion of a speaker 78 cm away from the expected position. Particularly when used in the present context of a pair of headphones, such spatial variation would be disorientating to the listener. 
     SUMMARY OF THE INVENTION 
     In the above example, the estimation error is dominated by the Command Time and the Clock Rounding. If these could then be removed and an adjustment made for the Clock Drift, the only difference between the Master Clock estimate and the actual Master Clock would be a small amount of clock drift. 
     According to one aspect of the present invention, the problem of inaccuracies introduced as a result of the Command Time and the Clock Rounding is addressed. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       An embodiment of the present invention will now be described by way of example with reference to the accompanying drawings. In the drawings: 
         FIG. 1  shows a Bluetooth device featuring an embodiment of the invention. 
         FIG. 2  shows a Bluetooth network featuring wireless Bluetooth headphones. 
         FIG. 3  shows an alternative to  FIG. 2 , in which a third device provides the master clock. 
         FIG. 4  shows an alternative to  FIG. 2 , in which the left channel device provides the master clock. 
     
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
       FIG. 1  shows an embodiment of the invention in which a Bluetooth device  20  has joined a piconet as an active node, along with nodes  30  and  10 . A decision is made between the nodes as to which device will, at least temporarily, act as the Master device (in this case node  10 ), and the internal clock  70  of said Master device  10  is then used to directly generate the Master Clock  60  for the Bluetooth network. 
     On Bluetooth device  20 , a local representation of the Master Clock  60  is kept and is maintained using the internal clock  50  and a stored offset value between the Master Clock and the internal clock. The offset value is updated every time a packet is received from the Master device. 
     Internal clock  50  is available to application  80  directly. However, Master clock  60 , which is the only network-wide synchronised clock, is only available to application  80  through the Host Controller Interface (HCI), and only at the resolution defined by the Bluetooth specification. This is limited to the Master Clock period, and only the most recent clock tick is available to the application. Furthermore, the command time for retrieving this clock value using the HCI is significantly long, and so the received clock value will be old by the time it is received back by the application. 
     In order to enhance the clock resolution, an embodiment of the present invention provides a means for obtaining a more accurate representation of the master clock. 
     In one embodiment of the present invention, the application running on the Bluetooth device may request an ‘accurate representation of the Master clock’ instead of usual standard Master clock value available through the HCI. This request is then passed to the HCI firmware  90 . Instead of using the Bluetooth method defined in the Bluetooth specification, the HCI firmware obtains the most recent Master clock tick value, and a local timestamp value in μs for when the Master clock tick changed. The time stamping is performed by extracting from internal clock  50  (readily accessible to firmware  90 ) at the time when the Master clock tick changed. 
     A data package is then formed using the tick value and the time stamp. This data package is then sent back to the application. 
     The application then compensates for the delay in obtaining the ‘accurate representation of the Master clock’ value by adjusting the accurate Master clock value by the offset between the timestamp and the present internal clock value. 
     Using the accurate Master clock value, the application can then accurately schedule playback of audio data. The audio data may be locally generated, or sent to Bluetooth device  20  from another device on the network. 
     This embodiment of the invention provides the application with a more accurate representation of the Master clock value than previously available. Further more, although it might receive this representation relatively late, it can compensate by adjusting the representation by the offset between the received timestamp and the present internal clock value. 
     Therefore, the representation of the Master clock has following relationship to the actual Master clock. 
     
       
         
           
             
               
                 
                   Representation 
                   = 
                     
                   ⁢ 
                   
                     
                       Master 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       Clock 
                     
                     + 
                     
                       Clock 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       Rounding 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       Error 
                     
                     + 
                   
                 
               
             
             
               
                 
                     
                   ⁢ 
                   
                     
                       Clock 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       Drift 
                     
                     + 
                     
                       Command 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       Time 
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         
                           Master 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           Clock 
                         
                         ± 
                         
                           0 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           µ 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           s 
                         
                       
                       ± 
                       
                         1 
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         µs 
                       
                     
                     ± 
                     
                       0 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       µs 
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       Master 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       Clock 
                     
                     ± 
                     
                       1 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       µs 
                     
                   
                 
               
             
           
         
       
     
     The worst case error between the representation and the master clock is 1 μs. Given the speed of sound, 1 μs amounts to less than 1 mm, and would therefore not be perceivable to the user. 
     Therefore, an advantage of the present invention is to allow synchronised stereo headphones, in which the right and left ears are controlled by separate Bluetooth devices. The present invention allows, by means of the accurate representation of the Master clock, the audio playback in each headphone to be very accurately scheduled to a network wide clock, and so any spatial disorientation by the user can be avoided. 
     In the embodiment shown in  FIG. 2 , Bluetooth audio device  10  is the Bluetooth master device, which provides the Master Clock for the piconet. Bluetooth audio device  10  sends the appropriate audio data to the left and right channel playback Bluetooth devices  20  and  30  and playback at the respective channel is scheduled according to the Master Clock, set by Bluetooth audio device  10 . 
     In the embodiment shown in  FIG. 3 , Bluetooth audio device  110  sends the audio data to Bluetooth master device  120  using Advanced Audio Distribution Profile (A2DP). Bluetooth master device  120  provides the Master Clock for the piconet. Bluetooth master device  120  sends the appropriate audio data to the left and right channel playback Bluetooth devices  20  and  30  and playback at the respective channel is scheduled according to the Master Clock, set by Bluetooth master device  120 . 
     In the embodiment shown in  FIG. 4 , left channel playback device  220  is the Bluetooth master device, which provides the Master Clock for the piconet. Bluetooth audio device  210  sends the appropriate audio data to the left and right channel playback Bluetooth devices  220  and  230  and playback at the respective channel is scheduled according to the Master Clock, set by left channel playback Bluetooth device  220 . 
     The audio data sent to the left and right channel playback Bluetooth devices preferably comprises ‘time to play’ information which provides scheduling information for playback of the specific audio samples at specific times relative to the accurate Master Clock. The ‘time to play’ information allows playback of the audio samples within the audio data to occur at the left and right channels at substantially the same time, allowing close synchronization of the channels. 
     In an alternative embodiment, the ‘time to play’ information can be sent to the playback devices separately from the audio data. 
     By feeding the accurate representation of the Master clock and internal clock pair into a digital signal processor (not shown) that also has access to the internal clock, it is possible for it to make slight speed adjustments to the audio playback rate, to ensure that the audio streams are accurately synchronised. This speed adjustment technique is known as warping. 
     Audio data sources may include a Bluetooth enabled CD player, MP3 player, mobile phone device, or any other device used for playback of music or sound. 
     The present invention can also be used for transmitting synchronised video data rather than audio data. For example, any application that requires synchronised video streams between separate Bluetooth devices would find this invention advantageous. This may include monitor banks or 3D glasses. 
     Further uses of the present invention may relate to non-media applications, in which a high degree of temporal accuracy is required, such as a controlling device for a computer game, or a Bluetooth network based stopwatch system. 
     The applicant hereby discloses in isolation each individual feature described herein and any combination of two or more such features, to the extent that such features or combinations are capable of being carried out based on the present specification as a whole in light of the common general knowledge of a person skilled in the art, irrespective of whether such features or combinations of features solve any problems disclosed herein, and without limitation to the scope of the claims. The applicant indicates that aspects of the present invention may consist of any such feature or combination of features. In view of the foregoing description it will be evident to a person skilled in the art that various modifications may be made within the scope of the invention.