This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

comprehension question Timer

Hi,

maybe i have a silly question, but i didn't programm timers before. I know how they work. But how is it possible that there are only three Timers in the 51822 and so many parts of the programm part (PWM,BLE,GPIOTE...) which need a timer? How can i organize my timers?

and is it possible to run one timer and write a function like "get_actual_time" which gives me the time in the moment i call the function?

Best reagards, Nils :)

  • Hi Philip,

    thanks for your usefull informations. Every time you telling me how to understand the things i realy get more and more points of reference (sorry for my english, i am german :D), thanks because this is great for a newbie. I just read the part you told me. Is it better , for tempreture compensating, to use an RC or an XTAL or to synth?

    Why does it depent on Vcc ?

    best regards Nils :)

  • Hi Nils,

    I'm glad to help. (sorry for my english, I am Australian and American :-)

    With regard to temperature, it is better to describe it as temperature dependence rather than compensation.

    The short answer to your question is Xtal or synth are both better than RC.

    The long answer is:

    Since the synthesizer depends on a crystal (16 or 32 MHz) , both the synthesizer and 32768 Hz crystal options will have similar characteristics. It depends on the crystal you specify and buy, but typically in the range of +/- 10 ppm to +/- 100ppm. On page 31 of the product spec, Nordic gives the worst case values of 60 ppm or 40 ppm. Lower values usually mean more expensive parts, but not always.

    In general, crystal oscillators will always be less affected by temperature than an RC oscillator. This is why crystals are used whenever an accurate clock is needed. There are also special crystal oscillators with extra stuff to compensate for temperature effects (TCXO) and oscillators that include a miniature oven to create a stable temperature (OCXO). Look here if you want to learn more http://www.vectron.com For work with the Nordic chips, you do not need these type of oscillators, I just thought you might be interested.

    Also, you may want to consider other things: 32768 Hz RC oscillator is totally inside the chip, XTAL/Synth both require an external crystal, but if you are using the radio, you need a crystal anyway. Also the 16/32 MHz crystal oscillators requires about 400 uA (page 31 and 32). The 32768 crystal oscillator needs only 1 uA (page 33, fabulous), and the RC oscillator need 0.8 uA (page 34). These are all typical numbers.

    You asked "Why does it depend on Vcc ?"

    A crystal oscillator is only affected a tiny amount by change in VCC. An RC oscillator is affected more by change in VCC.

    The reason is that the resistor (R) and capacitor (C) are implemented with various structures on the chip, and these structures are affected by the voltage the chip runs at, and also by temperature.

    When Nordic give a +/- 2% accuracy range for the RC oscillator, that range includes the combined effects of voltage (1.8V to 3.6V, page 29), and temperature (-25C to 75C, page 29), and the general variability from one chip to another (usually described as "Process"). This is usually referred to as PVT parameters.

    Cheers, Philip

  • This is for sure the best post I found related with timers explanations in this forum. I'm trying to work with timers with a nRF51822 BLUETOOTH SMART BEACON KIT but I'm not able to make it work well. I get the date as I want ( I haven't programmed timers at this level before) but I haven't modified any timer in the example provided with the kit. The problem is that I use strftime call to get the time in the format I want but the hours pass like seconds and the minutes and seconds... really fast. I think that maybe the timer RTC0 is used for another task and there is a conflict with it. I don't know well how can I check in order to modify the code to get the date as I want to.

    Regards.

    Iván Gómez.

Related