2009-04-26 02:36 AM
Problem with Systick
2011-05-17 04:08 AM
Hello,
I am having real problems getting the Delay() function that is provided as part of the STM library to run when I am not connected to the IDE (Rowley crossworks for ARM). If I am connected to Rowley then the Delay function works as expected in both debug and release modes, but the system ''hangs'' when coming up from an external boot. I believe the root problem is the Systick counter or interrupt not firing but don't know where to look to fix the problem? The code works without the Delay function and by toggling an LED I am 100% certain that it is the delay function/systick but don't know what could be wrong. Any help would be appreciated.2011-05-17 04:08 AM
Hey,
I am not too experienced with the stm32 either, but here is what I would do to debug the code. First of all, I would use the reference manual as your guide, as the firmware library is just supplementary and assumes you have read the reference manual. But most importantly, are you using an evaluation board? If yes which one? One way to start would be to set up a Hyperterminal so that you can print data to your computer screen. For this you will be needing the USART and there is sample code provided in the firmware libraries examples on how to do that. If you set up your logging terminal, then I would print the corresponding status registers and see if the interrupt bit is high and so on (again, look at the reference manual, it will tell you what the register configuration should be for the interrupts). Also, did you remember to use a volatile variable for your counter?2011-05-17 04:08 AM
Hi Thanks for the suggestion.
The problem actually appears to be that the firmware example for systick has a flaw. From the ARM reference manual the count value following a reset is unknown and although the STM library has a command to reset the counter value to 0, it is not called in the firmware example. As a result the first time through the systick count is indeterminate and in my case was could have been upto 20 hours for the first 1millisecond ''tick'' if the count was at its full 32 bit value.