2010-09-27 12:35 AM
system tick timer - my program freezes
2011-05-17 05:09 AM
your function
SysTick_Config () is not working properly
use this for sysTick initialization
int main(void)
{
/* SysTick end of count event each 10ms with input clock equal to 9MHz (HCLK/8, default) */
SysTick_SetReload(90000);
/* Enable SysTick interrupt */
SysTick_ITConfig(ENABLE);
/* Enable the SysTick Counter */
SysTick_CounterCmd(SysTick_Counter_Enable);
}
in stm32f10x_it.c-----------------------------void SysTick_Handler(void){TIMERJOB=1;}regards.
2011-05-17 05:09 AM
for 100ms
SysTick_SetReload(900000);
2011-05-17 05:09 AM
hello thank you
which include file shall I include for the functions you mentioned ?2011-05-17 05:09 AM
nobody knows anything about system_tick ?
2011-05-17 05:09 AM
To find what header to include get your IDE (or windows) to search for the function name in you project ( filter = *.h). This is something we all do all the time. This function is in the ST library.
2011-05-17 05:09 AM
can anybody comment why my first message example doesnot work ?
2011-05-17 05:09 AM
the source code of systick_config is not written by me
it is a function from ST library all I do is to call systick_config function to set the tick to 100 milisecond and making a variable ''1'' in the systick_handler ISR please look my first message ( kashif ' s code is giving error becouse his functions not available in the ST library )2011-05-17 05:09 AM
As kashif87 already said it must be your systick_config function that is wrong. But since you have not provided your function there is no way for us to help you. Please provide the source and I will try to help.
Trevor2011-05-17 05:09 AM
They are functions from the V2.x library, the current one inlines Systick_Config()
But for goodness sake, how hard is it to code a simple Systick example, and post the complete source? The problem is probably in code you aren't showing, because this works just fine on the VL discovery board with Keil. /******************************************************************************/ #include ''stm32F10x.h'' #include ''STM32vldiscovery.h'' /******************************************************************************/ volatile int TIMERJOB = 0; // needs to be volatile void SysTick_Handler(void) { TIMERJOB = 1; } /******************************************************************************/ int main(void) { int led; /* Initialise LEDs LD3&LD4, both off */ STM32vldiscovery_LEDInit(LED3); STM32vldiscovery_LEDInit(LED4); STM32vldiscovery_LEDOff(LED3); STM32vldiscovery_LEDOff(LED4); /* Setup SysTick Timer for 100 msec interrupts */ if (SysTick_Config(SystemCoreClock / 10)) { /* Capture error */ while (1); } TIMERJOB = 0; led = 0; /* main while */ while(1) { if (TIMERJOB == 1) { TIMERJOB = 0; led ^= 1; if (led) STM32vldiscovery_LEDOff(LED3); else STM32vldiscovery_LEDOn(LED3); } } /* does not exit - kind of important */ } /******************************************************************************/ #ifdef USE_FULL_ASSERT void assert_failed(uint8_t* file, uint32_t line) { /* User can add his own implementation to report the file name and line number, ex: printf(''Wrong parameters value: file %s on line %d\r\n'', file, line) */ /* Infinite loop */ while (1) { } } #endif /******************************************************************************/