Skip to main content
WHuan.11
Associate
November 20, 2020
Solved

SysTick does not interrupt in project created by STM32CubeIDE

  • November 20, 2020
  • 1 reply
  • 1356 views

I used STM3CubeIDE to create a default project (no settings changed) for a stm32l496ve chip. It generates a main file that has:

int main(void)
 HAL_Init();
 
 SystemClock_Config();
 
 while (1)
 {
 }
 return 0;
}

And a SysTick_Handler defined in stm32l4xx_it.c:

void SysTick_Handler(void)
{
 /* USER CODE BEGIN SysTick_IRQn 0 */
 
 /* USER CODE END SysTick_IRQn 0 */
 HAL_IncTick();
 /* USER CODE BEGIN SysTick_IRQn 1 */
 
 /* USER CODE END SysTick_IRQn 1 */
}

The startup file startup_stm32l496vetx.s has SysTick defined in the vector table:

_pfnVectors:
	.word	_estack
	.word	Reset_Handler
	.word	NMI_Handler
	.word	HardFault_Handler
	.word	MemManage_Handler
	.word	BusFault_Handler
	.word	UsageFault_Handler
	.word	0
	.word	0
	.word	0
	.word	0
	.word	SVC_Handler
	.word	DebugMon_Handler
	.word	0
	.word	PendSV_Handler
	.word	SysTick_Handler
	.word	WWDG_IRQHandler
	...
 ...

But despite this, it doesn't seem like the SysTick is being interrupted. HAL_Delay() would cause an infinite loop and a breakpoint at HAL_IncTick in SysTick_Handler() is never called.

This topic has been closed for replies.
Best answer by WHuan.11

So I found out why. I moved the start of FLASH to a different address via the linker script. I forgot to change the FLASH_BASE define accordingly in stm32l496xx.h

1 reply

WHuan.11
WHuan.11AuthorBest answer
Associate
November 20, 2020

So I found out why. I moved the start of FLASH to a different address via the linker script. I forgot to change the FLASH_BASE define accordingly in stm32l496xx.h