This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Function Called by Current Valure Register(SYST_CVR) with SysTick

Hello guys,
Im trying to use the timer registers of my ARM Cortex M0 while using my pga970EVM. Unfortionally there aren't any files/Commands refering to using the 3 registers SYST_CSR, SYST_RVR, SYST_CVR. I figured out how these registers are working quite easily: SYST_CVR is set to the Reload Value which is defined by SYST_RVR. When SYST_CSR is enabled, SYST_CVR  gets lowered periodically and when reaching 0 its Value is reset to the reload Value. Normally there should be a function which is called as soon as the Current Value Register hits 0 but there is none in my generic firmware. The link provides the information I have on these registers.

Cortex-M0 Devices Generic User Guide (arm.com)

D
o I have to write a function my own? If so how can i do it?
I already tried checking the CVR hitting 0 with an if-function: if(SYST_CVR==0x00000000)  but everything if this loop never got triggered.
Regards, Paul

Parents
  • Hi Paul

    Sorry, I missed the mention of the PGA970 earlier. I'm not familiar with CCS, does it allow you to directly visualize the SysTick registers? For example the Keil MDK shows:

    Can you share your initialization code of SysTick, it should be simple... first setting the reload value (any value up to 0x00FFFFFF), and then enabling by writing 0b__1 to the control register.

    Have you declared these registers as volatile so that the compiler isn't (likely silently) optimizing away your initialization? I found this document [http://www.ti.com/lit/pdf/SLDU024] which mentions (section 4.2) that you should define SYST_TESTING to ensure the init code is added to your code base.

    I see you write 0x7 (0b_111), the upper bit sets the clock source. Again, I am not familiar with this device, but may be worth experimenting with writing 0x3 (0b_011) instead.

    You should indeed have a function to branch to at that location in the vector table, even a simple function that just loops to itself so that you can catch it when it occurs could be useful. Do you have breakpoint capabilities on your device?

    Apologies if some or all of the above are things you have already tried... the SysTick timer is a very simple peripheral, there aren't many things that can go wrong, so I am rather stumped...

Reply
  • Hi Paul

    Sorry, I missed the mention of the PGA970 earlier. I'm not familiar with CCS, does it allow you to directly visualize the SysTick registers? For example the Keil MDK shows:

    Can you share your initialization code of SysTick, it should be simple... first setting the reload value (any value up to 0x00FFFFFF), and then enabling by writing 0b__1 to the control register.

    Have you declared these registers as volatile so that the compiler isn't (likely silently) optimizing away your initialization? I found this document [http://www.ti.com/lit/pdf/SLDU024] which mentions (section 4.2) that you should define SYST_TESTING to ensure the init code is added to your code base.

    I see you write 0x7 (0b_111), the upper bit sets the clock source. Again, I am not familiar with this device, but may be worth experimenting with writing 0x3 (0b_011) instead.

    You should indeed have a function to branch to at that location in the vector table, even a simple function that just loops to itself so that you can catch it when it occurs could be useful. Do you have breakpoint capabilities on your device?

    Apologies if some or all of the above are things you have already tried... the SysTick timer is a very simple peripheral, there aren't many things that can go wrong, so I am rather stumped...

Children