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: How to make frequency rate multiplier 1Hz to 4MHz ? How to count high sped external pulses (Counter Function for only single pulse train : 4 MHz ) ?

Part Number: TM4C1294NCPDT

I want to make prequency rate multiplier. How can I generate 1 Hz to 4 Mhz pulse train and its counter function ?

Old time, i8254 could use for rate generate by timer function. And counter function could count them.

I want to make high speed pulse generator and counter. 

Can I make the fundtion with TIVA General-Purpose Timer Function ? 

  • Hello,

    Why a, "Frequency Rate Multiplier"  - is not (your own) 'near' description, "Frequency Generator" superior?

    You are aiming for "7 orders of magnitude, frequency span" (1Hz - 10MHz) - producing those (very low) frequencies may prove the most challenging.   (i.e. you may have to (greatly) dial-down the MCU's System Clock AND employ a Wide Range MCU Timer - and even then - fail to produce sub 10Hz.)    That said - "Selectively switching-in" a "Counter IC" (which further divides down your output) should (greatly) ease your task.   (My group has long observed - that the "proper blend" of (both) HW & SW - often yields the, "Best, most flexible & fastest engineered solution!)

    You may employ the MCU's Timer in "PWM Mode" - which proves effective in enabling a (reasonably) wide-span of Output Frequencies.   The output will emerge from that Timer's designated I/O pin.   At/around 10MHz - some "rounding of signal edges should be expected."    (Yet remain, "Good for Gov't work.")

    The counter function can employ several of the Frequency Generator mechanisms - your proper review of the MCU Manual should suggest a variety of methods.    Note too - a "fast IC counter" - outputting to the Timer's input - will enable you to (nicely) extend the frequency range of your "MCU-based" Frequency Counter.

    A small Lcd/OLED appears as an excellent means to, "Guide/Control Operation - while providing measurement results..."

  • Thanks.

    I want to make PTO function on TIVA Series Device.  Can I make them ?

    I cound find PTO only for Hercules Series and PRU-ICSS on Sitara Devices.

    I want to make PTO functions and High speed counter.  How can I do that ?

  • Greetings,

    During my past military-service, RF & Radar Design role - "PTO" was defined as "Permeability Tuned Oscillator."   (I believe that your mention today - proves the "first ever mention" - this space.)   If that past definition is not shared - kindly advise "your meaning."

    My group are "outsiders" - we're not (especially) equipped to aid in this vendor's "Device Selection Process."

    Myoungkyun Yun said:
    I want to make PTO functions and High speed counter.  How can I do that ?

    Have I not - already - provided adequate detail regarding your High-Speed Counter desire?   (especially the employ of a fast, dedicated IC counter - placed "just ahead of" your MCU's Timer Input ... and vastly increasing its High-Speed capability!)    (Vendors rarely (never) provide such "blend/division" of task - required to (really) optimize design...)

  • Hi cb1,

    Given Hercules is referenced here, I presume PTO means Pulse Train Output.

    Hi Myoungkyun,

    cb1 has offered a lot of details already. I think it should be possible, but it also would not be trivial to do so. From an edge capture standpoint, if running at full clock speed you would need to use two 32-bit timers in order to get up to 1 second long captures. With two 24-bit timers, you can only capture up to 139.8 ms long pulses i.e. ~7 Hz. Depending on if you need USB or Ethernet, you may not be able to notably lower the clock speed.

    For generation you would have a bit more flexibility if you used the PWM generator because you can divide down the System Clock better, but you could also use the Timer's PWM mode instead.

  • Hi Ralph,

    Ralph Jacobi said:
    Given Hercules is referenced here, I presume PTO means Pulse Train Output.

    That is likely true - yet beyond obscure - is it not?    Proof follows:

    • my (reduced) group today noted, "Part Number: TM4C1294NCPDT"     
    • "PTO" thru the study of law - far more conventionally means, "PAID TIME OFF" - especially appropriate these days!    (Via work (sometimes/briefly) at home!)   
    • Its use otherwise is novel - and google "Fails to note T.I.'s definition - even "FIVE pages in!"    Note that (both) "Pre-Trial-Order" & my (earlier) "Permeability Tuned Oscillator" are noted.

    The earlier suggestion to "employ a high-speed, dedicated counter IC" - vastly, "Speeds, Eases & Enhances" such a "Frequency Counter Design."    (MCU - employing "Kitchen-Sink role" - is far outclassed by such a "blended (HW & SW) design!")

  • cb1_mobile said:
    "PTO" thru the study of law - far more conventionally means, "PAID TIME OFF"

    Heh, I immediately jumped to Power Take-Off.

  • You are correct Sir - "Power Take-Off" (Auxiliary Shaft used to drive other equipment) appears, Google Pg 3.

    Young staff here suspects such terminology originates in the "Massive Power End of the Machine Industry" - not so much in 'our group's Fractional HP, Motor/Controller concentration.'    

    (Aside) ... Quite a story unwinding in that (other) "Failed CAN_TX thread ... eh?"

  • Hi, Ralph Jacobi,

    Thank you for your answer. 

    PTO is; [ Pulse Train Output ]. 

    N2HET of Hercules can make 100Khz. And Sitara PRU-ICSS can make 500KHz.

    I think 32-BIT Timer could makes 1Hz to 4MHz with external clock. At this time, I do not use CPU Clock.

    I want to know how to make General pulpose timer of TIVA use external clock.

    And timer ouput directly GPIO without Interrupt.

    I can't find GPIO connect to GPTM(General Pulpose Timer Module). There is no inter-conection of  GPIO and GPTM, right ?

    Thank you  Ralph, Thank you cb1.

    Best regards, 

    Yun.

  • cb1_mobile said:
    Young staff here suspects such terminology originates in the "Massive Power End of the Machine Industry"

    I grew up on a farm. There it's a splined rotary output output on the rear of a tractor used to power towed equipment so your staff is correct.

    And yes the uncoiling continues.

    Robert

  • Hello again,

    Appreciate your reply - thank you.

    To your (combined) Frequency Generator & Frequency Counter creation:

    Myoungkyun Yun said:
    I think 32-BIT Timer could makes 1Hz to 4MHz with external clock. At this time, I do not use CPU Clock.

    Will that external clock be as stable, secure & as accurate as the MCU's (multiple) clocking options?    You are adding interconnects - which may prove vulnerable - as well.    While your clock may be external - it too has "MCU dictated frequency limits" - both high & low - which must be followed.

    Myoungkyun Yun said:
    I want to know how to make General purpose timer of TIVA use external clock.

    Would not you simply feed that external clock's output into the MCU's "Main Oscillator's input pin?"   Should be mounted close to the MCU - and avoid any/all (other) frequency generating signals and/or noise sources.

    Myoungkyun Yun said:
    And timer output directly into GPIO without Interrupt.

    See the answer (just below).   Vendor Ralph's recommendation to employ a PWM Module to generate your various Output frequencies - rather than a Timer Module (as I suggested) provides greater Frequency Span/Range - thus his idea is superior.

    Myoungkyun Yun said:
    I can't find GPIO connect to GPTM (General Purpose Timer Module). There are no inter-connections of  GPIO and GPTM, right ?

    Wrong - the Timers - as well as the PWM Modules - "share" the GPIO pins.   Your MCU manual describes this as an "Alternate Function" - I include an extract from a simpler TM4C manual - showing this "selection process."

    Note that pins "PB0-PB7 - for this particular MCU - may provide multiple functions."    (Yet only one at a time.)    This holds equally true for the Wide Timers.    Note that your selection of (any) alternate function is greatly eased by your use of the API - rather than (either) "DRM or ASM" code versions.

    May I report again - that your "blend" of External ICs (but not so much an external clock) is almost certain to, "speed, ease & enhance/improve" your design.   My tech group has long studied such similar, "Commercial Devices" - not one of these employed, "Only an MCU!"    

    Your resourceful "Find & Use" of a "High-Speed Counter IC" will greatly expand (both) the upper (and the lower) range of your Frequency Counter.   (In fact - may even enable your MCU to reach the "High-Frequency RF band."    (believed 4-100MHz - otherwise known as "80 to (near) 2 meter Band!)   That high-speed IC (perhaps an FPGA) may be selectively employed - even "Switched Out" - when/where the MCU is well w/in its "normal" capabilities!   

    As that "external, high-speed front-end IC" provides "eased external 'divide by' bits" likely enabling your use of the MCU's Wide Timer' (32 bits)  - to meet your "Low Frequency Measurement demands as well."

    Do consider the (major) role which an LCD/OLED plays - in leading to a "User Friendly" product...

  • Hi Ralph,

    Just a quick "sanity check" upon those calculations.

    Ralph Jacobi said:
    With two 24-bit timers, you can only capture up to 139.8 ms long pulses

    We agree completely w/your "139.8 mS" calculation - yet can't that be achieved via (just one) 24 bit timer?   (8.33nS * 16777216 = 0.139.8 Seconds.)   Assumes the "full, 120MHz System Clock provides the Timer's input clock.)

    Ralph Jacobi said:
    if running at full clock speed you would need to use two 32-bit timers in order to get up to 1 second long captures.

    Possibly not - again (8.33nS * 4294967296 = 35.79 Seconds!)   The 1294 MCU manual completely avoids such 32 bit Timer (Max) value calculations...

    It was noted that (both) "Input 'Edge Timer & Input Edge Counter" impose a "1/4 of Timer Input Clock Frequency" upon their measurement capability...

  • Hello cb1,

    cb1_mobile said:
    We agree completely w/your "139.8 mS" calculation - yet can't that be achieved via (just one) 24 bit timer?   (8.33nS * 16777216 = 0.139.8 Seconds.)   Assumes the "full, 120MHz System Clock provides the Timer's input clock.)

    For doing edge capture applications, we are using two timers. One each to capture the respective edges. I'd have to go back through my notes again to track down the reasoning behind 2 vs 1 - that was an activity done last year as it was an example put together for TM4C129x.

    cb1_mobile said:

    Possibly not - again (8.33nS * 4294967296 = 35.79 Seconds!)   The 1294 MCU manual completely avoids such 32 bit Timer (Max) value calculations...

    Agreed on the max time. 'Up to' wasn't a good wording, I was trying to imply 'up to' our posters slowly requirements, not 'up to' device capability which certainly exceeds beyond 1 second.

  • Hi cb1,

    Also to clarify...

    cb1_mobile said:
    yet can't that be achieved via (just one) 24 bit timer? 

    Are you meaning one Timer peripheral (Timer 0) or one of the Timer peripheral pairs only (Timer 0A only and not both Timer 0A and Timer 0B)?

  • Hi Ralph,

    Checking back - my group believes that "WE" were the "very first" to suggest that "Two Timers" - rather than just one - greatly eased the demands upon (both) Duty Cycle calculation & frequency measurement.   (we were first to note here: one timer triggered upon rising edges - the 2nd triggered upon falling edges.)    While this (may) be achieved via a single timer - the speed & ease of the two timer usage makes its use "preferred."

    Again we must note the 75% reduction in the "timer's input frequency handling" when commanded into (either) "Edge-Count or Edge-Time mode."    That's rather limiting - almost "painful" - thus the use of a wide timer (32 bits) would be our clear choice.   (due to its extended range capabilities.)    Note that "not all" ARM MCUs suffer such 75% (lost) frequency input...

  • Hi cb1,

    Okay, I think we are aligned now. I was thinking from an overall performance level, but yes for the longer period calculations, one timer is no problem to use & reconfigure between high and low edges. We both can agree on that. But as you stated, it's certainly best and generally recommended to use two timers for overall performance!

  • Good that - Ralph!

    And "now we know" the full range capability of a 32 bit Timer - clocked @ 120MHz - even though such is ABSENT from poster's TM4C1294 manual.   BTW - we find that your firm is "much beyond the pack" in offering (both) such high capacity Timers (32b) AND their substantial number!

    Note too - we acknowledged to this poster - that your suggestion, "Employ the MCU's PWM Generator" - rather than (my - not my group's) suggestion of, "Employ a Timer" to "Implement his Frequency Generator objective - proved superior!   (young staff - still here pounding - gave me a deserved "You suggested WHAT?"  for that short-fall...)

    We should note that (most) Frequency/Signal Generators provide a "powerful & protected, 50Ω Output."   (Not w/in the capability of your MCU (or any that we recognize!)     Thus this poster's job extends to, "Finding a proper device and/or circuit implementation which "enhances the MCU's output."  (i.e. both strengthens & yields that desired 50Ω output impedance)   With the imposition of such a "buffer/driver" - the MCU's output may return to a (much desired) REAL Square Wave!