cancel
Showing results for 
Search instead for 
Did you mean: 

Systick interrupt fail on STM32L072KZUX

kuzdmin
Visitor

Hello, I have a problem with SysTick interrupt on STM32L072KZUX.

I am using the latest version of STM32CubeIDE + the latest package for my MCU - FW_L0 1.12.3. An absolutely clean project, which was created in IDE and flashed into the device using ST-Link, starts up fine after flashing, but when the SysTick count reaches overflow and an interrupt should be called, for some reason the program goes to the wrong address (PC = 0x1ff00dd0), of course the interrupt handler itself is declared and there is a pointer to the function in the assembler file. Moreover, it does not matter which framework to use: LL or HAL. I checked the vector table both in the firmware image and in the microcontroller memory, all addresses are correct. Moreover, it does not matter how to use it. We checked it on 2 chips from the same batch, a similar program flashed into NUCLEO-L073RZ works correctly.

kuzdmin_0-1751535605988.png

 

int main(void)
{

  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration--------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SYSCFG);
  LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR);

  /* SysTick_IRQn interrupt configuration */
  NVIC_SetPriority(SysTick_IRQn, 3);

  /* USER CODE BEGIN Init */

  /* USER CODE END Init */

  /* Configure the system clock */
  SystemClock_Config();

  /* USER CODE BEGIN SysInit */

  /* USER CODE END SysInit */

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  /* USER CODE BEGIN 2 */

  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  LL_InitTick(16000000, 1);
  LL_SYSTICK_EnableIT();
  while (1)
  {
	  LL_GPIO_TogglePin(GPIOA, LL_GPIO_PIN_9);
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}

// startup_stm32l072kzux.s
   .section  .isr_vector,"a",%progbits
  .type  g_pfnVectors, %object
  .size  g_pfnVectors, .-g_pfnVectors


g_pfnVectors:
  .word  _estack
  .word  Reset_Handler
  .word  NMI_Handler
  .word  HardFault_Handler
  .word  0
  .word  0
  .word  0
  .word  0
  .word  0
  .word  0
  .word  0
  .word  SVC_Handler
  .word  0
  .word  0
  .word  PendSV_Handler
  .word  SysTick_Handler
  .word     WWDG_IRQHandler                   /* Window WatchDog              */
  .word     PVD_IRQHandler                    /* PVD through EXTI Line detection */
  .word     RTC_IRQHandler                    /* RTC through the EXTI line     */
  .word     FLASH_IRQHandler                  /* FLASH                        */
  .word     RCC_CRS_IRQHandler                /* RCC and CRS                  */
  .word     EXTI0_1_IRQHandler                /* EXTI Line 0 and 1            */
  .word     EXTI2_3_IRQHandler                /* EXTI Line 2 and 3            */
  .word     EXTI4_15_IRQHandler               /* EXTI Line 4 to 15            */
  .word     TSC_IRQHandler                     /* TSC                           */
  .word     DMA1_Channel1_IRQHandler          /* DMA1 Channel 1               */
  .word     DMA1_Channel2_3_IRQHandler        /* DMA1 Channel 2 and Channel 3 */
  .word     DMA1_Channel4_5_6_7_IRQHandler    /* DMA1 Channel 4, Channel 5, Channel 6 and Channel 7*/
  .word     ADC1_COMP_IRQHandler              /* ADC1, COMP1 and COMP2        */
  .word     LPTIM1_IRQHandler                 /* LPTIM1                       */
  .word     USART4_5_IRQHandler               /* USART4 and USART 5           */
  .word     TIM2_IRQHandler                   /* TIM2                         */
  .word     TIM3_IRQHandler                   /* TIM3                         */
  .word     TIM6_DAC_IRQHandler               /* TIM6 and DAC                 */
  .word     TIM7_IRQHandler 				          /* TIM7                         */
  .word     0              					          /* Reserved                     */
  .word     TIM21_IRQHandler                  /* TIM21                        */
  .word     I2C3_IRQHandler                   /* I2C3                         */
  .word     TIM22_IRQHandler                  /* TIM22                        */
  .word     I2C1_IRQHandler                   /* I2C1                         */
  .word     I2C2_IRQHandler                   /* I2C2                         */
  .word     SPI1_IRQHandler                   /* SPI1                         */
  .word     SPI2_IRQHandler                   /* SPI2                         */
  .word     USART1_IRQHandler                 /* USART1                       */
  .word     USART2_IRQHandler                 /* USART2                       */
  .word     RNG_LPUART1_IRQHandler            /* RNG and LPUART1              */
  .word     0                                 /* Reserved                     */
  .word     USB_IRQHandler                    /* USB                          */


// stm32l0xx_it.c
/**
  * @brief This function handles System tick timer.
  */
void SysTick_Handler(void)
{
  /* USER CODE BEGIN SysTick_IRQn 0 */

  /* USER CODE END SysTick_IRQn 0 */

  /* USER CODE BEGIN SysTick_IRQn 1 */

  /* USER CODE END SysTick_IRQn 1 */
}

// Map listening file is
                0x20005000                        _estack = (ORIGIN (RAM) + LENGTH (RAM))
                0x00000200                        _Min_Heap_Size = 0x200
                0x00000400                        _Min_Stack_Size = 0x400

.isr_vector     0x08000000       0xc0
                0x08000000                        . = ALIGN (0x4)
 *(.isr_vector)
 .isr_vector    0x08000000       0xc0 ./Core/Startup/startup_stm32l072kzux.o
                0x08000000                g_pfnVectors
                0x080000c0                        . = ALIGN (0x4)

.text           0x080000c0      0x9b0
                0x080000c0                        . = ALIGN (0x4)
...
 .text.SysTick_Handler
                0x08000750        0xa ./Core/Src/stm32l0xx_it.o
                0x08000750                SysTick_Handler

 

1 ACCEPTED SOLUTION

Accepted Solutions
kuzdmin
Visitor

The problem was in the connected BOOT0 pin, which caused interrupts to call the handler from system memory.

View solution in original post

1 REPLY 1
kuzdmin
Visitor

The problem was in the connected BOOT0 pin, which caused interrupts to call the handler from system memory.