cancel
Showing results for 
Search instead for 
Did you mean: 

TIMEBASE TIMER problem

ngaylard
Associate II
Posted on May 29, 2007 at 16:58

TIMEBASE TIMER problem

4 REPLIES 4
ngaylard
Associate II
Posted on May 22, 2007 at 17:19

Hello,

I am struggling to get a timebase timer to work on an STR735. The processor is running (verified through flashing LED's). I need a timer on a 500 millisecond timebase to schedule activities. The following steps have been done with no success:

In Main initialisation:

Use Timer Base with End Of Count Interrupt

------------------------------------------------------------------------------*/

/* TB2 Clock Enable */

CFG_PeripheralClockConfig(CFG_CLK_TB2 , ENABLE);

/* EIC Clock Enable */

CFG_PeripheralClockConfig(CFG_CLK_EIC , ENABLE);

/* EIC Configuration */

EIC_IRQChannelConfig(TB2_IRQChannel, ENABLE );

EIC_IRQChannelPriorityConfig(TB2_IRQChannel,1);

/*TB2 Configuration to toggle Leds each 500ms */

TB_InitStructure.TB_CLK_Source = TB_CLK_INTERNAL;

TB_InitStructure.TB_Prescaler = 0xEF; /* The internal TB Frequency = 100KHz */

TB_InitStructure.TB_Preload = 0xC350 ; /* 100000Hz * 0.5 s = 0xC350 */

TB_Init (TB2, &TB_InitStructure);

EIC_IRQCmd(ENABLE);

TB_ITConfig (TB2,ENABLE);

TB_Cmd(TB2, ENABLE);

In the interupt vectors I have:

void TB2_IRQHandler (void)

{

GPIO_BitWrite(GPIO1,GPIO_PIN_14 ,~GPIO_BitRead(GPIO1,GPIO_PIN_14));

TB_FlagClear(TB2);

}

(Please note the pin read/write and hardware was tested using the main loop previously).

Many thanks

xaviooo
Associate II
Posted on May 23, 2007 at 05:08

Well, i'm currently working on the timebase timer (see my topic above...).

I can create an update every 10us (I could have a 500ms), but I can't use this timer in other functions...

To me, what you've done seems good, but are you sure of the Prescaler and Preload values ?

What is your problem ? Is the timebase too fast or too quick ?

If you have something new, you can contact me at

mailto:xaviooo@gmail.com

or look at my topic :).

ngaylard
Associate II
Posted on May 23, 2007 at 16:16

I have resolved the issue, the PLL is not setup correctly and therefore the device speed was completely different to that expected.

Working well now thanks

kaouther
Associate II
Posted on May 29, 2007 at 16:58

Good!

The STR73x firmware library provides a helpfull example for TB as well as for all peripherals. ;)