cancel
Showing results for 
Search instead for 
Did you mean: 

SysTick_GetCounter() generates fault - RTOS to blame?

jeevan
Associate
Posted on October 31, 2009 at 03:52

SysTick_GetCounter() generates fault - RTOS to blame?

2 REPLIES 2
jeevan
Associate
Posted on May 17, 2011 at 13:28

Hi All,

I am trying to read the Systick value in an RTOS task - using RL ARM / RTX in Keil uVision with the MCBSTM32E board (which has an STM32F103ZE onboard), using STM32F10xR.Lib FWLib.

My code runs fine when I don't call Systick_GetCounter(). If I do call it, everything hangs. Using the debugger, I see that this function call (which is 3 lines of assembly) immediately throws a fault:

PRECISERR

BFARVALID

The disassembly:

SysTick_GetCounter:

0x08000F64 F04F20E0 MOV r0,#0xE000E000

0x08000F68 6980 LDR r0,[r0,#0x18]

0x08000F6A 4770 BX lr

It seems to go into the exception handler on the second instruction.

Ideas? Can one not read the Systick when using an RTOS that is clocking off the system tick? That sort of stinks - I'm just reading, not writing, of course. I would hate to have to waste a timer that is just a read only slave of the Systick.

akaiser9
Associate II
Posted on May 17, 2011 at 13:28

Privileged mode is required for systick access. If your RTOS enforces unprivileged mode for the threads (selectable as far as the processor is involved), the systick timer cannot be directly accessed.

[ This message was edited by: prx on 31-10-2009 08:29 ]