Using DWT Peripheral to Write Delay Functions in STM32

Using DWT Peripheral to Write Delay Functions in STM32

DWT is a debugging peripheral, and one of its core functions is CYCCNT, which is a 32-bit incrementing counter used to record the number of clock cycles executed by the CPU. We can achieve rewriting the HAL_Delay function or implement microsecond-level delays by monitoring the changes in this counter. Appendix: 1. Source Code dwt.delay.h file … Read more

Embedded Software Debugging: How to Calculate Task Execution Cycles?

Embedded Software Debugging: How to Calculate Task Execution Cycles?

1. DWT Trace Component Trace Component: Data Watchpoint and Trace (DWT) In DWT, there are remaining counters that are typically used for “performance profiling” of program code. By programming them, they can generate events (in the form of trace packets) when the counter overflows.The most typical use is to measure the number of cycles taken … Read more

How to Enable DWT for Counting in STM32 Based on Arm®v7-M Architecture

How to Enable DWT for Counting in STM32 Based on Arm®v7-M Architecture

Keywords: DWT, DEMCR Table of Contents 1. Introduction 2. Research 3. Enabling DWT for Counting 4. Conclusion 01 Introduction When using the STM32H7, the customer wants to utilize DWT counting to measure code execution time and evaluate execution efficiency. The customer found that after power cycling or resetting, they could not enable DWT for counting. … Read more

Unexpected Discovery: Cortex-M Core with 64-bit Timestamp

Unexpected Discovery: Cortex-M Core with 64-bit Timestamp

Tencent Video: Bilibili Video: Introduction: According to the Debug section of the parameter manual, those in the System ROM Table with Timestamp generator are supported, while those without are not supported. The current tested series H743/H750, etc. come with it. Similar to the DWT clock counter, it can be used for debugging as well as … Read more