2014-08-20 05:53 PM
As far as I knew, SYSTICK Timer is a 24-bit down counter. For now, I need to know the precise consumption time for the memcpy function. Suppose I set SysTick->RELOAD = 511, it will turn out two cases as the following description.
Define: 1. One cycle means 511 to 0 must be finish.2. Two or more cycles mean 511 to 0, 511 to 0, ... , 511 to 0, 511 to i, i in [0, 511].Case 1: Offset is small or normal, so the memcpy will finish in one cycles.Case 2: Offset is very big, e.g. 16K. So the memcpy will finish in two or more cycles.How do I get the ''cycles'' ? #systick2014-08-20 07:27 PM
It's 24-bit, but you have foreshortened it to 9-bit, suggest you either extent the wrapping point, ideally to a maximal value or just use a 32-bit free running timer like DWT_CYCCNT, where you know it's running at the core clock frequency, runs for close to a minute at 72 MHz and the math is trivial.
2014-08-21 12:02 AM
''Suppose I set SysTick->RELOAD = 511''
As clive1 says, why do that? Why choose such a small value - why deliberately make the wrap-around such a big issue?http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka8713.html
If you envisage that the operation will still take longer than one ''cycle'', then enable the SysTick interrupt, and have the handler count the ''cycles''...http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka8713.html
http://www.keil.com/pack/doc/cmsis/Core/html/group___sys_tick__gr.html
2014-08-21 06:09 AM
If I define it equals MAX, e.g. 65536, how does it guarantee that will not turn out two or more cycles?
2014-08-21 09:02 AM
Well presumably you could count SysTick interrupts?
The 24-bit maximal would be 16777215 wouldn't it. 2^24-1