Home arrow Support arrow Forums

Luminary Micro Forums

ringram2077

Expert Boarder

2006/12/12 08:35

Help with Delay

Hi
I need some help with delay routine. I don't see anything in the library for delay_ms() function or something equivalent. Can someone point me in the right direction ?

I have the LM3S811 eval board.

Thanks

login or register to reply

magnuslundinse

Gold Boarder

2006/12/12 17:30

Re:Help with Delay

Use SysTick as a system clock. You can set it as a free running clock, and divide systick values by the clock frequency.
Or you can set the SysTickPeriod to the number of clocks in 1 ms. Then a SysTick interrupt can increase a system millisecond clock variable and your delay_ms function waits for this variable to increase by the required number.

You can use a loop that wait for the sys tick value but then you must be more careful in handling wraparounds, and since this runs at processor clock speeds you cannot use exact matches to check when the timer period has expired.

Use the driver lib functions for SysTick:

SysTickPeriodSet(20000); /* Period for 1ms at 20MHz clock */
SysTickPeriodSet(0xFFFFFFFF); /* Period for free running systick */

SysTickEnable();
SysTickIntEnable();


The game example code for the 811 eval board has a SysTick based delay function.


Beware that there are some problems using the COUNTFLAG to signal a SysTick timer zero crossing. (Cortex-M3 errata 377490)

login or register to reply

ringram2077

Expert Boarder

2006/12/13 09:29

Re:Help with Delay

OK, Thanks.

I'll take a look at the game example. I am very new to the LM3S811 as well as the compiler. I have used the Microchip devices quite a bit but am struggling to get up to speed with this new challenge.

login or register to reply