2010-12-27 10:36 AM
SysTick interrupt priority does not work?
2011-05-17 05:19 AM
Unfortunatelly, when DMA interrupt is active the gating period sometimes changes from exact 100.00 ms about 0.3 us less (probably DMA handler duration). I/O toggling was measured by a precise counter instrument.
99.9997 ms? or 100.0003 ms? Your description suggest the former. Tail chaining may result is reduced latency as it transitions from the DMA to ticker IRQ. What's the frequency of your CPU and DMA bandwidth? 300 ns, that's 7-21 instructions at 72 MHz. The M3 pushes/pops 8 32-bit register on interrupt.2011-05-17 05:19 AM
Thanks for response.
I am sorry for the mistake. The difference in 100 ms periods is 0.3 MILIsecond - really similar to the duration of DMA IRQ handler as I wrote. Of course, one period is longer and next one is shorter. However, I need a precision better then 1E-4 every period. The counter error (1 LSB variation) makes only 2E-5 for full scale counter value about 50000. I use STM32F103RBT running on 72 MHz. When DMA IRQ handler is empty, MAX-MIN difference in the 100 periods is 13 ns only i.e. 1 instruction. It seems for me that SysTick IRQ priority is NOT higher than the DMA one.2011-05-17 05:19 AM
I'm not sure that NVIC_Init is suitable for System Handler interrupts, with the older library I used NVIC_SystemHandlerPriorityConfig() for SysTick, for the newer library the following may be more appropriate.
/* 2 bits for pre-emption priority and 2 bits for subpriority */ NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); /* Set SysTick Interrupt priority to 0 (highest) */ NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0,0)); /* Set DMA1/1 Interupt priority to 3 (lowest) */ NVIC_SetPriority(DMA1_Channel1_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),3,0)); SysTick_IRQn is negative.2011-05-17 05:19 AM
/* Set SysTick Interrupt priority to 0 (highest) */
NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0,0));
It works by this way. Thank you very much, Clive1, for the advise. Ivan