This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1294NCPDT: 1 MHz Reference Timer For Frequency Measurement

Part Number: TM4C1294NCPDT
Other Parts Discussed in Thread: EK-TM4C1294XL

Hello Everyone,

I am using Tiva C Series evaluation board for the frequency measurement, for this I used a reference timer running on 1 MHz.

System is running on 120 MHz clock, timer source clock is also system clock. Actually I want to figure out the frequency up to ppm level.

My concern is here the reference timer which I am using for frequency measurement, this timer self has error of 0.0025%.

So, can I create a 1 uS timer with 0 ppm accuracy with this board?

Please help on this.

Thanks & Regards

Piyush Purohit

  • If you want to measure frequency I suggest you use a timer running from the 120MHz system clock in the TIMER_CFG_A_CAP_TIME mode and capture the time on successive rising (or falling) edges. You can calculate the frequency knowing that each count is 8.33333... nanoseconds. Your quantization error is your system clock period (8.333333...nS). You can minimize error from PLL jitter by averaging several readings. You overall error will then approximate your crystal drift/offset error.
  • Hi Bob,

    Thanks for your quick response.

    I am using timer0 as reference timer, timer is running from 120 MHz source clock.

    Tomorrow I will check accordingly to you and also share the code what I am doing.

    Thanks & Regards
    Piyush Purohit
  • Piyush Purohit said:
    So, can I create a 1 uS timer with 0 ppm accuracy with this board?

    May be (easier) to 'Turn iron into Gold!'    (that '0 ppm accuracy' (requirement?) ... somehow ... casts doubt upon the experience and realism compliance 'level' - of such a request.)

    Along w/such 'Hunt for extreme (likely unattainable) accuracy' - we must ask, "To what point?"     In the (unlikely) event that such '0ppm' is (at best) fleetingly achieved - what then?    Your desired 1MHz 'reference' has a period of 1µS - which proves inadequate for (almost) all - modern frequency measurement tasks.    (my 1970 era ham radio employed a similar frequency reference (100KHz oscillator) - technology has advanced far beyond your 1MHz!)

    You make no mention of stable supply voltage  and (near) constant temperature requirement - and quality of the 'Reference Oscillator & its support components.'    And aging!    (does not  '0ppm'  now 'drift' (sorry)  from 'real/valid'?) 

    Oven-based crystal oscillators may prove worthy of your investigation.     (and may be purchased - but likely (first) require your success w/'Alchemy!')     And still are unlikely to meet '0ppm' specification...

  • Hello cb1_mobile,

    Actually I want to use my Tiva Board as frequency counter.

    Recently we have measured that RTC of our system (energy meter) and found drifted, when I measured the 1 Hz signal of RTC on frequency counter I found 20 to 30 ppm error.

    Same type of measurement I want to be done by Tiva Board, so to do this first I generate a periodic timer using timer0 running on 1 MHz and then check the output of this timer (by toggling an io pin inside the timer interrupt) using the same frequency counter and found the frequency 499.98770 KHz (error about 0.0025%), now I want this error to be zero for the precise measurement.

    Output of frequency counter for 1 Hz input signal is 1.000005

    When I am measuring the same signal using Tiva Board it is around 1.05XXXX

    I think now you can understand the scenario why I was talking about ppm.

    Regards
    Piyush Purohit
  • Check the accuracy of your crystal. The EK-TM4C1294XL launchpad uses an NDK crystal with a +/- 20 x 10e-6 accuracy.
    www.ndk.com/.../c_NX3225GA-STD-CRG-2_e.pdf
  • As vendor's Bob (now) - and I (earlier) noted - your 'Chase of '0ppm' (pardon) 'HAS NO CHANCE!'
    'Premature Optimization' gets many into (serious) trouble!
    "Setting an "Impossible to Meet' Specification - seems w/out (much) merit.

    It proves 'fine to strive' for a 'reasonable' goal - chasing one 'impossible' - Not so much!
  • "So, can I create a 1 uS timer with 0 ppm accuracy with this board?"

    Definitely, so long as you use a 0 ppm accuracy oscillator with this board.
  • Hello Piyush,

    The Frequency counter you are talking about (using which you measured 1 Hz signal) itself have some tolerance. The reading you find on frequency counter is subject is not absolute measurement but with some tolerance, defined by manufacturer of that equipment. You can find that tolerance value in its datasheet.

    What i understand from you post is that you want to achieve high level of accuracy of frequency measurement on Tiva board similar/comparable to what you are measuring on frequency counter.

    For fair accuracy using Tiva board, you can simply follow what Bob have suggested in his first reply.
    In fact i have done same thing for my frequency measurement; with only difference that clock to my timer was systemclock/64. This was to have low frequency measurement without using timers in chain. However, for higher accuracy, you need to have sysclock=timerclock.

    Hope this is of any help.

    BR,
    Pranav.

  • It has been reported - that this  fellow (centuries past) - chased 'similar, unreasonable' goals.

    In either case - past or present - the 'Outcome was predictable' - and 'Not' to the 'goal-seeker's favor!'

    Setting 'FAR from reachable goals' is expected to waste:  'Time, Funds, Effort' - while plunging Morale!      Such is of (some) importance - is it not?(thus DEMANDS proper mention...)

  • " for higher accuracy, you need to have sysclock=timerclock."

    true for higher resolution. may not be true for accuracy.
  • Is it being suggested that, 'Hoof-beats per furlong' ... proves inadequate as SysClock?
    Reality - at some point - must make (some) entry into this 'wind-harvesting' thread...
  • Agreed with your comment. Thanks for pointing out.....
  • measuring frequency / counting pulses is very simple: you just need count the unknown pulse train vs. a known pulse train - typically the clock of the mcu.

    how to implement that regime depends on your hardware set-up, and the frequency range of your unknown pulse train. 

  • Thanks for your suggestions  and reply, also thanks for the story of man, horse, lance and the windmill!!!!!

    Great effort and great ideology!!!!!!!!

  • Thanks Danny,

    Yupp, i know its very simple to calculate the frequency /counting pulses with the help of reference clock source, i just tried out to accurate the reference clock source.

    Thanks for the reply and suggestions!!!