TI E2E Community
Stellaris® ARM® Microcontrollers
Stellaris® ARM® LM3S Microcontrollers Forum
Output Compare on Timer Channel
I am using an LM3S1P51 for my design. I have read the datasheet multiple times to confirm I am not missing anything, however, I am unable to find an output compare feature on the Timer channels. This basic feature is available on 8 bit controllers I have used. What I am looking for is to change the state of a Timer channel pin when the timer count expires. On 8 bits, I can set up the count, the timer expires and the output compare pin for the associated timer channel automatically toggles or pulls high/low (can be configured during initial setup). However, with the 1P51, I have to set the GPIO to a state in the timer interrupt (causing a slight delay on GPIO). Anyone know if I am missing something? Thanks for your time.Rajah
RajahRe: "Missing Timer Direct-Toggle Pin." Anyone know if I am missing something?
Believe your finding to be correct - recall that the ARM was never intended to "maintain all similarities" with near-dead/dying 8 bit devices.
Stellaris response time to interrupts is excellent and quite predictable (deterministic). Further - as the timers reach to 32 bits (even 64 bits on new M4s) and the MCU System clock exceeds that of 8 bit ones - you may be able to "tune out" any interrupt response time "delay" via lessening of Timer match value. You may want to employ a high priority for this timer interrupt as well...
Thanks for your reply cb1_mobile. I have multiple interrupts that HAVE to be at a higher priority than the timer channel interrupt. I see a little jitter when I probe the GPIO on to a scope. While, I can live with the jitter, I wanted to know if I was missing something on the data sheet (because timer channel implementations from ST and Freescale ARM offerings have the output compare feature). While I agree that 8-bits are being replaced, I would argue that output compare feature is a very useful regardless of the data bus widths/processor architecture.
Can't argue your point - many have raised same - protested. Historically LMI was very underserviced in GPIO dept. (may explain why timer GPIO link went bye-bye) Way improved w/new M4 - very nearly reach "holy grail" of 80% GPIO/Pin Total.
On a lighter note (re your avatar) met, knew Matt G. - we both lived in Hermosa Beach, CA - few blocks apart. His early drawings bore very slight visual resemblance to the polished artwork pumped now from Korea. (you would not recognize "original" Bart/Homer in dark alley - LA Times would not accept - appeared only in "throw-away" Easy Reader...) Wonder if slight timer jitter would impede Springfield reactor...
The timer PWM mode may have the functionality you're looking for. In PWM mode you can configure a CCP GPIO to go high or low depending if a timer is above or below a certain value. I know you can configure the CCP output for periodic mode, but I don't know if it would still work if you wanted do to a one-shot count. If you have Stellarisware installed, there's some example code in Stellarisware/examples/peripherals/timer/pwm.c.
Rajah (aka Bart) - Stellaris John has totally outclassed me with his, "Timer in PWM Mode" suggestion. This does not "invade" your formal PWM Module use (should your MCU be so equipped) but is an option w/in your Timer - and directly controls that particular GPIO (confined to CCP pin). This output is rock stable - if you set it up for 50% PWM suspect that you'll get precisely what you sought. As a fringe benefit you can "tweak" the PWM width if desired. (frequency will remain constant) We've used this mode at (and beyond) 20KHz (out of human hearing range). The formal PWM modules are more complex - such use would probably be bad application of a precious resource - but the Timer in PWM Mode should fulfill your requirement nicely. Good job Stellaris John...
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.