Question:
How to calculate period and width register of TIMER in continuous PWM mode using ADSP-21593 Evaluation kit?
Answer:
The timer runs on serial clock SCLK0 frequency. Here the generation of PWM signal having different duty cycles in TMR pin is done by programming period and width registers of Timer.
Below examples will help us to understand how to program timer period register. High time (ON time) = 50% of the period.
Low time (OFF time) = 50% of the period.
Example 1: What is the value to be given in Timer period register if PWM signal having period of 500 μs with 50% Duty cycle
Period = 500 microseconds
Width = 250 microseconds (50% duty cycle)
SCLK0 = 125 MHz
Timer Period Register Value * SCLK0 frequency = Expected period of PWM
Timer Period Register Value * 1/(125*10^6) = 500^-6
Timer Period Register Value = 62500
Example 2: Generate PWM signal having period of 10 seconds with 50% Duty cycle
PWM Signal Period = 10 seconds
Width = 5 seconds (Duty Cycle = 50%)
Suppose generated SCLK0 Frequency is 1 MHz
= 1 × 10^6HZ (1,000,000 cycles per second).
Timer Period Value = 10 × 1,000,000 = 10,000,000
Timer Width Value = 5 × 1,000,000 = 5,000,000
Example 3: Having 125MHZ of SCLK0, generate PWM having period of 6 seconds:
Period = 6 seconds
Width = 3 seconds (50% duty cycle)
SCLK0 = 125 MHz
Timer Period Value = 6×125,000,000=750,000,000
Timer Width Value = 3×125,000,000=375,000,000
Verify the Timer Values:
Period(sec) = Timer Period Value/Clock Frequency
= 750,000,000/125,000,000
= 6secs
Width(sec) = Timer Width Value/Clock Frequency
= 375,000,000/125,000,000
= 3secs