简体   繁体   English

在调试中停止 STM32F4 RTC

[英]Stop STM32F4 RTC in debug

A test was assigned to me by my professor.我的教授给我分配了一个测试。

In the test I need to make a STM32f4XX discovery to act like a clock by using the internal RTC and be able to stop it in any time and then the clock be able to resume the count (like a stopwatch).在测试中,我需要让 STM32f4XX 发现通过使用内部 RTC 来像时钟一样工作,并且能够在任何时间停止它,然后时钟能够恢复计数(如秒表)。

One of the points of the test is be able to stop the program via the STMCube debugger like the suspend execution or a breakpoint, and when the execution is resumed the "clock" continues in the exact point it left.测试的要点之一是能够通过 STMCube 调试器停止程序,如挂起执行或断点,并且当恢复执行时,“时钟”继续在它离开的确切点。

Is it possible?是否可以?

At this point, if I pause the execution in the debugger and then hit resume, the clock "jumps" to another second/minute just like I never paused it.在这一点上,如果我在调试器中暂停执行然后点击恢复,时钟“跳”到另一秒/分钟,就像我从未暂停过一样。 Because the RTC is still running in the background.因为 RTC 还在后台运行。

According to the Reference manual of the chip, once the RTC starts, it can't be stopped until the chip is powered off.根据芯片的参考手册,RTC一旦启动,直到芯片断电才能停止。

Is it possible in any way ?有可能吗?

Debug peripheral has special registers where you can program which peripheral to run or stop in the debug top mode.调试外设具有特殊的寄存器,您可以在其中编程哪个外设在调试顶部模式下运行或停止。 They are called "freeze registers"它们被称为“冻结寄存器”

So if you want RTC to be stopped when the processor is stopped by the breakpoint you need to program those registers.因此,如果您希望在处理器被断点停止时停止 RTC,您需要对这些寄存器进行编程。

在此处输入图片说明 在此处输入图片说明 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM