AnsweredAssumed Answered

Delay() and System Clock in STM32VLDiscovery ?

Question asked by kurlik.ed on Oct 10, 2012
Latest reply on Oct 10, 2012 by kurlik.ed
Hi everyone,

I'm new with STM's MCU and I'm doing some tests on the the STM32VLDiscovery board (with MCU : STM32F100RB) I've just bought.
I wrote a simple code for blinking a LED and tested it successively on the evaluation board.
To make the LED blinking, I used a Delay function I found in some sample code. 
My problem is that my calculating of the time that the Delay() function would take according to its parameter doesn't mach the real time.

here is the function:

void Delay (unsigned int volatile nCount)
   for (; nCount! = 0; nCount -);

On the board there is an external 8 Mhz oscillator. So if this is the clock system , the clock cycle would take : 0125 us.

for example, if we use the function takes 0xFFFFF as parameter.
0xFFFFF = 1048575 (Decimal) so  the time the Delay() function takes would be:
1048575 x 0,125 10 ^ -6 = 0,131 s

But in practice, on the Discovery board the time is much larger, the delay time is about a second or 3/4 of a second !

Where do you think is my error ? could you give me an explanation ?

Thanks in advance.