There is provided a phase locked loop, PLL, that sets gain automatically. The PLL comprises a frequency discriminator for providing a first signal that represents the difference between a first frequency and a second frequency. The PLL also comprises a comparator coupled to the frequency discriminator for receiving the first signal and providing a second signal based on information from the first signal. The second signal is representative of a gain setting for the phase locked loop to set.