I need to write timer program to generate square waveform (TM0_TMR0) for ADSP BF-609 EZ board. How to configure these timers? Can you please share any sample/ example codes regarding this timer programming?
I believe this issue was discussed through private support. With the provided example code ShriShailesh was able to produce a train of pulses using timer.
Since the Generation of such waveforms requires precise stopping of the timer, TRU is used to stop the timer to avoid interrupt latency.Timer 1 is configured in continuous PWM mode and as a Trigger slave and "Stop On Trigger" mode and TMR 2 is configured in Single pulse mode and as trigger master. TMR 2 is configured to a count 9 times as TMR 1 (TMR1 is configured for Gracefully stop mode).
On completion TMR2 will trigger the TMR 1 to stop
In order to generate the square wave on the timer pin. Program the GP timer in Continuous PWM mode, with
Timer Period = 2 , Width = 1 , and delay = 0..
You will also have to configure the respective GPort in peripheral mode in order to observe the square wave on TMR pin.
Thank you so much for your kind reply. we are totally new to this board, can you please provide us some simple example code that can generate square wave for a duration of 100 micro sec,frequency 10MHz.
I've attached you very basic code.
You need to call it this way:
TimerEnable(0, ENUM_TIMER_TMR_CFG_EMU_CNT | ENUM_TIMER_TMR_CFG_PADOUT_EN | ENUM_TIMER_TMR_CFG_CLKSEL_SCLK | ENUM_TIMER_TMR_CFG_POS_EDGE | ENUM_TIMER_TMR_CFG_PWMCONT_MODE, 10000000);
In the TmrEnable function you see a call to a function named get_s0clk_hz():
unsigned long s0clk_hz = get_s0clk_hz();
You need to load s0clk_hz with the right value to get the right frequency output.
For stopping after a certain amount of time, you need to do your own code which then calls TmrDisable.
Hi Shri ,
Just to give you one idea to stop the output waveform after 100 usec.
You could use another GPTimer and configure it with a time period of 100usec, and in the ISR of this timer disable the timer configured in the PWM mode.
Retrieving data ...