Sign in

username:

password:



Not a member?

Search c3x



Search tips

Subscribe to c3x



c3x by Keywords

Boot | C31 | TMS320VC33 | VC33

Sponsor

Evaluate multicore with Texas Instruments:
Low-cost evaluation module & free software development kit available NOW.

Discussion Groups

See Also

Embedded SystemsFPGAElectronics

Discussion Groups | TMS320C3x | Timer counters

Technical discussions about the TI C3x DSPs (including the C31, C32 and C33 DSPs).

  

Post a new Thread

Timer counters - "Brunert, Hugo (US SSA)" - Sep 16 9:22:49 2008

Hello,

First of all, I am at work, and we cannot have yahoo messenger on, so
please do not try to reach me via IM.

Thank you

Now the real problem, I have a C31 with 2 timers and they are mapped as
such:

// Memory Mapped Registers

 #define TIMER_0_CONTROL  0x00808020  // Timer 0 Global Control

 #define TIMER_0_COUNTER  0x00808024  // Timer 0 Counter 

 #define TIMER_0_PERIOD   0x00808028  // Timer 0 Period

 #define TIMER_1_CONTROL  0x00808030  // Timer 1 Global Control

 #define TIMER_1_COUNTER  0x00808034  // Timer 1 Counter 

 #define TIMER_1_PERIOD   0x00808038  // Timer 1 Period

I have been able to set the period on both timers and I have been able
to start both timers.

However I have not been able to read the counter register.

I assume it is a 32 bit word, which gets set to 0 when you start the
timer, and it increments by one on every tic of the timer.

Is this assumption correct?

If so, I get 0 all the time, I never see it increment.

What am I doing wrong.

All I'm doing is reading the unsigned long int at location 0x00808034
and storing it in a local array of unsigned long ints.

Thank you for the help.

Hugo Brunert

Software Engineering

BAE Systems

Electronic & Integrated Solutions

Sensor Systems, Identification & Surveillance

MS 1-12

1 Hazeltine Way

Greenlawn, NY 11740-1606

Voice: (631)912-2885

Fax:    (631)912-2909

Email: H...@BAESystems.com






______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c3x -- send a blank email to c3x-subscribe@yahoogroups.com )

RE: Timer counters - Bill Finger - Sep 16 12:31:53 2008

Hugo,

How do you know you've started the timer if you never see it increment?
What values are you setting the control registers to?

Some simple code:

	// Reset timer:
	*T0_ctrl = 0;
	
	// Setup timer function as external counter:
	*T0_ctrl = C3X_TIMER_CLKSRC_EXT | C3X_TIMER_FUNC_TIMER;
	
	// Reset counter and period register:
	*T0_prd = -1;  // maximum value so no overflow.
	*T0_count = 0;
	
	// Start counter:
	*T0_ctrl |= C3X_TIMER_GO | C3X_TIMER_NHLD;
where

#define C3X_TIMER_TSTAT              0x00000800
#define C3X_TIMER_INV                0x00000400
#define C3X_TIMER_CLKSRC_INT         0x00000200
#define C3X_TIMER_CLKSRC_EXT         0x00000000
#define C3X_TIMER_C_NP               0x00000100
#define C3X_TIMER_NHLD               0x00000080
#define C3X_TIMER_GO                 0x00000040
#define C3X_TIMER_DATIN              0x00000008
#define C3X_TIMER_DATOUT             0x00000004
#define C3X_TIMER_NI_O               0x00000002
#define C3X_TIMER_FUNC_TIMER         0x00000001
#define C3X_TIMER_FUNC_IO            0x00000000

and

#define T0_ctrl    ((volatile unsigned long *) 0x808020L) /* TIM0 gl
control           */
#define T0_count   ((volatile unsigned long *) 0x808024L) /* TIM0 count
*/
#define T0_prd     ((volatile unsigned long *) 0x808028L) /* TIM0 prd
*/
Hope this helps.
Bill 

> -----Original Message-----
> From: c...@yahoogroups.com [mailto:c...@yahoogroups.com] On 
> Behalf Of Brunert, Hugo (US SSA)
> Sent: Tuesday, September 16, 2008 8:56 AM
> To: c...@yahoogroups.com
> Subject: [c3x] Timer counters
> 
> Hello,
> 
>  
> 
> First of all, I am at work, and we cannot have yahoo messenger on, so
> please do not try to reach me via IM.
> 
> Thank you
> 
>  
> 
> Now the real problem, I have a C31 with 2 timers and they are 
> mapped as
> such:
> 
> // Memory Mapped Registers 
> 
>  
> 
>  #define TIMER_0_CONTROL  0x00808020  // Timer 0 Global Control
> 
>  #define TIMER_0_COUNTER  0x00808024  // Timer 0 Counter 
> 
>  #define TIMER_0_PERIOD   0x00808028  // Timer 0 Period 
> 
>  
> 
>  #define TIMER_1_CONTROL  0x00808030  // Timer 1 Global Control
> 
>  #define TIMER_1_COUNTER  0x00808034  // Timer 1 Counter 
> 
>  #define TIMER_1_PERIOD   0x00808038  // Timer 1 Period
> 
>  
> 
> I have been able to set the period on both timers and I have been able
> to start both timers.
> 
> However I have not been able to read the counter register.
> 
> I assume it is a 32 bit word, which gets set to 0 when you start the
> timer, and it increments by one on every tic of the timer.
> 
> Is this assumption correct?
> 
> If so, I get 0 all the time, I never see it increment.
> 
> What am I doing wrong.
> 
> All I'm doing is reading the unsigned long int at location 0x00808034
> and storing it in a local array of unsigned long ints.
> 
>  
> 
> Thank you for the help.
> 
>  
> 
> Hugo Brunert
> 
> Software Engineering
> 
> BAE Systems
> 
> Electronic & Integrated Solutions
> 
> Sensor Systems, Identification & Surveillance
> 
> MS 1-12
> 
> 1 Hazeltine Way
> 
> Greenlawn, NY 11740-1606
> 
> Voice: (631)912-2885
> 
> Fax:    (631)912-2909
> 
> Email: H...@BAESystems.com
> 







______________________________
StarterWare provides C-based no-OS platform support for the C6000 DSP devices.
Click here for details.




(You need to be a member of c3x -- send a blank email to c3x-subscribe@yahoogroups.com )