nRF5340 use of DWT for timing measurements

Hi,

I've been using the DWT macro cell successfully on the app core to provide high accuracy timing information. E.g., with these declarations:

#define  ARM_CM_DEMCR      (*((volatile uint32_t *)0xE000EDFC))
#define  ARM_CM_DWT_CTRL   (*((volatile uint32_t *)0xE0001000))
#define  ARM_CM_DWT_CYCCNT (*((volatile uint32_t *)0xE0001004))

uint32_t timerStart = 0;
uint32_t timerEnd = 0;

and enabling the cycle counter via the ARM_CM_DWT_CTRL register, I am able to read the ARM_CM_DWT_CYCCNT register to derive timing between points in the code.

However, on the net core, I can't get the same behaviour. By default, reading ARM_CM_DWT_CYCCNT gives me a value of 0. I can write to the register and read back the same value but I can't get the register to count clock ticks.  I'm using the same address for these registers on both cores which I believe is correct per the documentation.

Should it be possible to get this working on the net core or am I trying something that isn't going to work?

Regards,

AC

Related