2013-07-26 01:58 AM
Hi all
I've a question: How does I have to configure the systick timer to operate without interrupts and so I can check the count value... I've tried this, but if I check if SysTick-VAL < 480 or < 48000 is the same. The pin toggels with ~360ns
int
main(
void
)
{
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE);
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
SysTick->LOAD = 0xFFFFFF;
/// -> Max
SysTick->VAL = 0;
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk;
/// Enable timer
while
(1){
SysTick->VAL = 0;
while
(SysTick->VAL < 48000);
GPIOB->ODR ^= GPIO_Pin_2;
}
return
0;
}
Best regards
P51D
2013-07-29 09:50 AM
PM0214, ch.4.5:
The processor has a 24-bit system timer, SysTick, that counts down from the reload value to zero, reloads (wraps to) the value in the STK_LOAD register on the next clock edge, then counts down on subsequent clocks. JW