STM32F769 DWT CYCCNT
I'm using the STM32F769-DISC0 development board and am utilizing the DWT->CYCCNT to calculate cpu load as well as using it as a high speed timer that runs at the clock frequency. When the debugger is plugged in, it functions fine. However, with the debugger unplugged, it iterates at a much lower rate and does not match the clock frequency.
I'm using the following code to enable DWT_CNT, and the LSR and CTR registers indicate it is on, but the problem continues with the debugger unplugged. I *must* be missing something, however I cannot find anything in the user manual that indicates what register (if any) I'm missing?
CoreDebug->DEMCR &= ~0x01000000;
CoreDebug->DEMCR |= 0x01000000; // TRCENA
DWT->LAR = 0xC5ACCE55; // unlock
DWT->CYCCNT = 0; // reset the counter
DWT->CTRL &= ~0x00000001;
DWT->CTRL |= 0x00000001; // enable the counter
