Jump to content
43oh

WTIMER0 and TIMER0


Recommended Posts

@

 

     TIMERA: = 32 bits wide           TIMERB = 32 bits wide
| ---------- TIMERA ---------- | | ---------- TIMERB ---------- |
00000000000000000000000000000000 00000000000000000000000000000000

          WTIMERx = 64 bits wide equals TIMERA + TIMERB
00000000000000000000000000000000 00000000000000000000000000000000
| --------- WTIMERxA ----------| | --------- WTIMERxB ----------|

     TIMERx: = 32 bits wide          TIMERx+1 = 32 bits wide
00000000000000000000000000000000 00000000000000000000000000000000
| -- TIMERxA --||-- TIMERxB -- | | - TIMERx+1A -||- TIMERx+1B - |
I probably messed that up, but I think it's correct.
Link to post
Share on other sites

@

 

Oh, sorry for my unclearly question, My trouble mean, is WTIMER0 and TIMER0A TIMER0B separate timers ?, is it not overlapping ?,  can I use them simultaneously ?

Thanks everyone!

 

Yes they are separate timers.  Yes you can use them simultaneously.

 

WTIMER0 is a separate device from TIMER0 (and from any part of timer 0, i.e. TIMER0A/TIMER0B), they do not overlap, you can use them simultaneously and independently.

 

WTIMER0A and WTIMER0B are parts of WTIMER0 (i.e. can't use WTIMER0 and WTIMER0A independently at same time).

likewise, 

TIMER0A and TIMER0B are parts of TIMER0 (can't use TIMER0 and TIMER0A independently at same time)

 

But you can use parts of WTIMER0 and parts of TIMER0 at the same time, independently.

(i.e. WTIMER0A does not overlap with TIMER0A, etc.)

The decision whether to split a timer or use it total is on a per timer basis (i.e. can use TIMER0 unsplit, but use WTIMER0A and WTIMER0B, etc.)

 

See TM4C123gh6pm datasheet - chapter 11, for instance look at the register map (11.5) 

Note that the 16/32 bit timer devices have separate addresses from the 32/64 bit devices. (i.e. they have separate control registers)

Note that the pins the various timers can control are different, etc.

Link to post
Share on other sites

It may be confusing that getting sometimes conflicting answers here.

I hope that the pointers to the documentation help.

Of course trying it out for yourself is the real way to be sure.  Unfortunately the only example code that I know of off the top of my head is parts of fairly large projects.

 

Looking in the source code to Energia if you look in hardware/lm4f/variants/stellarpad/pins_energia.h

in the digital pin to timer array you will see that some pins are mapped to wide timers (WTxx) and some to regular timers (Txx)

then in the cores/lm4f directory you can look at the source to wiring_analog.c - and see how it is using the respective timers to do PWM.

To prove that they operate independently do a quick sketch that uses PWM on a pin that is controlled by WT0A and a different PWM on a pin controlled by T0A (for instance).

You will find that you can control them independently.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...