/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / Systick interrupt interruption!

Username:     
Password:     
             

Forum

# 1   2009-05-18 15:36:50 Systick interrupt interruption!

slimphony
Member
Registered: 2009-01-27
Posts: 13

Systick interrupt interruption!

Hi everyone,

I am using a custom DMA1 IRQ Handler to perform A LOT of calculations on values captured by ADC1&2.

The handler is called roughly every 0.5 ms, reads data from a 2Ko buffer in RAM and performs several floating points operations using math.h...

Looks like the handler takes all the CPU time given that the CircleOS managed button no longer works!

I guess my handler interrupts the CircleOS scheduled handlers... is that right ?

If so, what can I do to force the CircleOS handlers to execute -not every 1 ms but possibly every 10ms or so ?

I can probably schedule them directly from my code but I'd rather avoid that for the time being if there is a workaround...

Thanks

Offline

 

# 2   2009-05-18 16:30:19 Systick interrupt interruption!

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: Systick interrupt interruption!

First of all, you can select in your application the highest CPU frequency. Did you do it ?
If it is not sufficcent, you could reprogram the reload value of the Systick (and restore it when you leave your application).

Offline

 

# 3   2009-05-21 10:56:03 Systick interrupt interruption!

slimphony
Member
Registered: 2009-01-27
Posts: 13

Re: Systick interrupt interruption!

Yes VERY_HIGH_SPEED (72 Mhz) was set in Application_Ini.

Looking at this line in CircleOS main.c : NVIC_SystemHandlerPriorityConfig( SystemHandler_SysTick, 3, 3 );  //6,6

I figured out that I had left the "default" priority settings for my own DMA1_IRQHandler, that is 0,0.

So I changed it. Priority values from 3,3 to 5,5 had no effect whatsoever.

But setting priorities to 6,6 worked just fine!

I guess priorities stronger than 3,3 caused preemption over the SysTick Handler but who has priorities 4,4 and 5,5 ?


One further question about the reload value of the Systick which would indeed allow me to have a systick interrupt for CircleOS routines every 10ms for instance rather than every 1ms.

The default value is 3000. With this setting and the CPU Frequency at 72MHz, my (CircleOS) application handler actually gets called every 100ms. Given that the "Application divider" is set to 100, it is consistent with the Systick handler being called every 1ms as expected.

That's fine but what is the exact relation between the systick reload value and the CPU freq ?

The information provided in the Primer2 ref manual (CPU Freq/Systick = 24000), the STM32 ref manual (Systick calibration = 9000), and the Cortex-M3 ref manual (CPU Freq / 3000 = Systick) is very confusing!!

Thanks a lot.

Offline

 

# 4   2009-05-25 13:04:50 Systick interrupt interruption!

slimphony
Member
Registered: 2009-01-27
Posts: 13

Re: Systick interrupt interruption!

Point #1 : interruption priority

OK. Somewhere in my code (in the Stdout2Usb lib) the Systick handler priority was set to 6,6 instead of the original 3,3 in CircleOS.
This setting was actually copied from the Primer2Mouse sample code. I guess there is a good reason for that...

Point #2 : systick reload value

Setting the reload value to 6000 instead of the original 3000 in CircleOS causes the systick handler to be called every 2ms rather than 1ms when the CPU is running at 72MHz.
This behaviour is consistent with the definition of the reload value, and must be independent from the CPU speed but I still didn't catch how to derive the systick timer from the reload value...

Offline

 

Board footer