This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Can't write into DWT Registers

Hello,

I want to measure microseconds with the Cycle Counter of the DWT-Unit on a STM32F7. After long long searching, I found a lot of examples to do this by setting the CoreDebug->DEMCR register with TRCENA and the DWT->CTRL register with CYCCNTENA.

So it seems to be a very easy code:

CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
DWT->CYCCNT = 0;
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;

But with this code, nothing happens in the controllregisters (DEMCR and CTRL) all enable bits are 0 and the Cycle Counter doesn't run. I tested with and without a connected ULINKpro. With ULINKpro, the counter is running and my measurement works (CYCCNTENA=1).
But without ULINKpro despite with "DWT->CTRL |= 1" stays the CYCCNTENA bit 0 and the counter don't run...

Have anybody an idea, whats the reason for the missing write-access to the control register is? Also tests with "DWT->LAR = 0xC5ACCE55" don't change anything.

After the study of the ARMv7-ArchitectureRM and all the other referenced manuals I'm happy about any new ideas! Maybe I miss any bits in other modules like ITM...?

Thanks a lot!