I am currently using SysTick to count milliseconds in my device. This works fine, however with it enabled I can't sleep the device as it wakes up instantly.
I have tried to disable it, however it does not work. The following code blinks the LED unless I remove the references to SysTick_Config
int main(void)
{
SysTick_Config(SystemCoreClock / 1000);
syshal_gpio_init(GPIO_LED_GREEN);
for (;;)
{
syshal_gpio_set_output_high(GPIO_LED_GREEN);
for (uint32_t i = 0; i < 1000000; ++i)
__NOP();
SysTick->CTRL = 0;
nrf_pwr_mgmt_run();
syshal_gpio_set_output_low(GPIO_LED_GREEN);
for (uint32_t i = 0; i < 1000000; ++i)
__NOP();
SysTick_Config(SystemCoreClock / 1000);
}
}I'm almost certainly going to switch to using an RTC but it would be nice to understand why this does not work.
I am using the nRF52840 with no softdevice