cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Systick

ngaylard
Associate II
Posted on April 26, 2009 at 11:36

Problem with Systick

3 REPLIES 3
ngaylard
Associate II
Posted on May 17, 2011 at 13:08

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.

wattos
Associate II
Posted on May 17, 2011 at 13:08

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?

ngaylard
Associate II
Posted on May 17, 2011 at 13:08

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.