Relative Content

Tag Archive for stm32f4

DWT on STM32F411 running in debug mode but not release mode

Using the example code from this site (and all other examples appear to be similar):
https://mcuoneclipse.com/2017/01/30/cycle-counting-on-arm-cortex-m-with-dwt/
The DWT counter on the STM32F411 appears to increment correctly when running a debug session but not in a release session. Here’s an example function that uses DWT to execute a timeout on the I2C bus: