You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

STM32H723 Nucleo板SysTick初始化无需开启SysCfg的原因咨询

STM32H723 Nucleo板SysTick初始化无需开启SysCfg的原因咨询

首先,你的观察完全正确,这个疑问其实挺常见的——很多新手会被不同教程里的“SysCfg依赖”搞混,我来给你理清楚:

核心原因:SysTick是ARM Cortex-M7内核外设,和STM32的SysCfg模块完全独立

SysTick属于ARM Cortex-M内核自带的定时器,它的时钟来源、使能控制都由内核寄存器(就是你代码里的SYSTICK->CTRL这类)直接管理,根本不需要依赖STM32专门的SysCfg系统配置模块。

你代码里注释掉的RCC->APB4ENR |= BIT(1)是用来开启STM32 SysCfg模块的时钟,这个模块负责的是STM32片上的系统配置功能,比如:

  • GPIO引脚重映射
  • 外部中断线的映射配置
  • SRAM的奇偶校验控制
  • 一些电源管理相关的配置

这些功能和SysTick半毛钱关系都没有,所以即使你不开启SysCfg的时钟,SysTick依然能正常工作,包括它的中断。

为什么有些教程会提到“用SysTick需要开SysCfg”?

大概率是两种情况:

  1. 教程混淆了功能:可能是把其他需要SysCfg的功能(比如外部中断)和SysTick放在一起讲,导致你误以为SysTick需要它;
  2. 旧型号的惯性:部分早期STM32型号(比如F1系列)的某些外设配置可能和SysCfg有间接关联,但在H7系列里,SysTick和SysCfg的边界已经非常清晰,完全没有依赖关系。

关于低功耗模式的疑问

和低功耗模式没关系!SysCfg默认是关闭的,但SysTick的运行不依赖它的时钟。哪怕你进入低功耗模式,只要内核时钟还在运行,SysTick就能工作(当然低功耗模式下内核时钟可能会调整,但这和SysCfg无关)。

最后再确认下你的代码:你已经正确配置了SysTick的加载值、清零当前值,并且通过SYSTICK->CTRL开启了定时器、中断,同时选择了时钟源——这些完全足够让SysTick正常运行,根本不需要碰SysCfg的任何配置。

附你的问题原文和代码:
although this question may be trival, I do not quite understand the results of my work. I followed bare metal programming articles and tried to implement some basic functionalities on my Nucleo board with STM32H723 without any external libraries. I understand most of it, but some article mentioned that I need to enable SysCfg in order to use systick.

static inline void systick_init(uint32_t ticks) {
  if ((ticks - 1) > 0xffffff) return;  // Systick timer is 24 bit
  SYSTICK->LOAD = ticks - 1;
  SYSTICK->VAL = 0;
  SYSTICK->CTRL = BIT(0) | BIT(1) | BIT(2);  // Enable systick
  //RCC->APB4ENR |= BIT(1);                   // WHY NOT NEEDED?
}

What I am observing, is that I do not need last line (the commented out one), which is mentioned SysCfg enabling. I am not touching this register in any other part of my code, yet interrupt is still working. I even checked startup.s file which Cube generated for me and all I can see there is initialization of interrupt vector. Is it because of power mode? SysCfg is disabled by default only in low power?

备注:内容来源于stack exchange,提问作者Michał Brodziak

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.15 10:13:02