PDA

View Full Version : How to set priority for systick?



Green
01-31-2013, 12:41 AM
Hi guys
I am recently doing a project by using Teensy3.0 to run code in a 1ms isr with PIT0. Since I am really familiar with STM32, and the priority is the lowest for systick_isr in STM32 and something like NVIC_SET_PRIORITY(n,p) won't be able to set the priority for the device has a smaller number than dma0 on the vector table. However, also there is no core_CM4.h included in the arduino folder, I know we can use NVIC_SetPriority(SysTick_IRQn, 0); included in core_cm4.h to set the priority for systick to highest possible. Because I want the Micros() and Millis() keep running when PIT0_isr is running, so I need systick has higher priority than PITO.
MY question is what is the default systick priority in teensy3.0 and can I just included core_cm4.h then call NVIC_SetPriority(SysTick_IRQn, 0); to raise the priority to highest? is there any other way to set the priority for systick? thank you.

btw, is the default NVIC_priority grouping is group 4? since we can set priorities from 0-15, I assume they are all preemption priority.

Green
02-01-2013, 12:26 AM
I found the default priority for systick is 0 since I used micros() to make a delay inside of PIT0_isr when the priority for pit0 is lower than 0, which proved that priority for systick is 0. But what if I want to lower the priority for systick, how I can set it. I included core_cm4.h and called function inside but I couldn't past the compile.

Dave X
04-01-2013, 06:14 PM
OT--SysTick documentation: I thought that since this SysTick stuff in doesn't seem to be in the MK20DX128 reference manual at http://www.pjrc.com/teensy/datasheets.html, folks might want to look at the SysTick documentation at http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0553a/Babieigh.html or google for "System timer -- SysTick ARMv7-M Architecture Reference Manual, B3.3."

adrianfreed
04-03-2013, 08:51 PM
Thanks for tracking down that documentation.
I have an application (OSC time stamps) that needs a rock-solid time count stored in more bits (i.e. for PTP resolution). It is good to know where to start from.