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

Enabling the SysTick interrupt appears to put the processor into low power mode

I am trying to enable the SysTick, but am having some difficulty.

I initially tried this:

#include "./headers/stm32f767xx.h"
 
void init_sysTick(void)
{
    SysTick->LOAD = 18749UL; // set the reload value, speed is 18.75MHz
    SysTick->VAL = 0UL; // set the starting value
    SysTick->CTRL = 0b111; // enable SysTick, SysTick interrupt and set clock source to the processor clock
}

...though it resulted in the debugger being disconnected. Having looked a little further into this, I came to the conclusion that the most likely reason is the processor has been put into low power mode and has disabled the clocks needed in order to run the debugger.

For reference, this is the message returned by the debugger:

Error! Failed to read target status
Debugger connection lost.
Shutting down...

I am using an ST-LINK.

I was under the impression that it should only go into low power mode if there is a WFI or WFE instruction, though as far as I am aware, I have not included either of these.

I played around with this function, and tried this instead:

#include "./headers/stm32f767xx.h"
 
void init_sysTick(void)
{
    SysTick->LOAD = 18749UL; // set the reload value, speed is 18.75MHz
    SysTick->VAL = 0UL; // set the starting value
    SysTick->CTRL = 0b101; // enable SysTick and set clock source to the processor clock
}

...as you can see, I set the CTRL register (or named SysTick SYST_CSR in the ARM manual) to 0b101 rather than 0b111. This should mean that I am not enabling the interrupt for the SysTick.

With this modification, the debugger was not disconnected.

I need to use interrupts, but cannot get them working without the debugger being disconnected. 

Can anyone point me in the right direction as to what I should do from here?

If it helps, here is all the code: https://github.com/Starman3787/motor-driver-test/tree/experimental - and yes, I do have a vector table and ISR function setup.