AnsweredAssumed Answered

SysTick ISR not called under debugger

Question asked by iwasz on Dec 14, 2016
Latest reply on Dec 14, 2016 by iwasz

Hi all.

 

    I noticed that when debugging a STM32F091 MCU my systick ISR never gets called. I Use STMCube library, so HAL_GetTick and HAL_Delay ceases to work as well (because uwTick is not increased). But only when I flash the micro and let it run without the debugger supervision, everything is fine. I observed this on STM32F030, 072 and 091 thus I assume that every F0 works this way. Stm32f4 and F7 works normally under my debugger. I use Ubuntu linux, gcc-6.2.0 (my own build), and I flash and debug with the help of st-flash and st-util (GitHub - texane/stlink: stm32 discovery line linux programmer ). My target board is connected via stm32f0-discovery to the PC, and has no crystal. My code looks this way:

int main (void)
{
        HAL_Init ();
        SystemClock_Config ();
        // ...
}

void SystemClock_Config (void)
{
        RCC_OscInitTypeDef RCC_OscInitStruct;
        RCC_ClkInitTypeDef RCC_ClkInitStruct;

        RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI14 | RCC_OSCILLATORTYPE_HSE;
        RCC_OscInitStruct.HSEState = RCC_HSE_ON;
        RCC_OscInitStruct.HSI14State = RCC_HSI14_ON;
        RCC_OscInitStruct.HSI14CalibrationValue = 16;
        RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
        RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
        RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL3;
        RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV1;
        HAL_RCC_OscConfig (&RCC_OscInitStruct);

        RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1;
        RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
        RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
        RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
        HAL_RCC_ClockConfig (&RCC_ClkInitStruct, FLASH_LATENCY_1);

        HAL_SYSTICK_Config (HAL_RCC_GetHCLKFreq () / 1000);
        HAL_SYSTICK_CLKSourceConfig (SYSTICK_CLKSOURCE_HCLK);

        __SYSCFG_CLK_ENABLE ();
        HAL_NVIC_SetPriority (SysTick_IRQn, 0, 0);
        HAL_NVIC_EnableIRQ (SysTick_IRQn);
}

PS. I tried to use HSE48 directly (without PLL) but still no luck.
Thanks.

Outcomes