Activity Counters
The activity counters are used for accurately measuring the execution time of processes between user-defined start and stop points. This, in turn, helps firmware developers to analyze how actively the Arm Cortex-M33 processor and the flash memory are being used by a user application. This information helps when estimating and optimizing the power consumption of the application.
To gauge how many cycles have elapsed, a reference counter that counts SYSCLK cycles is accessed through the SYSCTRL_SYSCLK_CNT register. This cycle count can be compared with cycle counts for three other critical system elements:
- Execution of cycles on the Arm Cortex-M33 processor is recorded in the SYSCTRL_CPU_CNT register. This counter only counts when the Arm Cortex-M33 processor is running, and does not increment when the core is sleeping or otherwise inactive.
- The number of CBus read instructions is recorded in the SYSCTRL_CBUS_CNT register.
- Read accesses from the flash memory are tracked in the SYSCTRL_FLASH_READ_CNT register.
The activity counters are configured and controlled using the SYSCTRL_CNT_CTRL register. These counters are:
- Cleared by writing 1 to the SYSCTRL_CNT_CTRL_CNT_CLEAR bit
- Started by writing 1 to the SYSCTRL_CNT_CTRL_CNT_START bit
- Stopped by writing 1 to the SYSCTRL_CNT_CTRL_CNT_STOP bit. The write to SYSCTRL_CNT_CTRL_CNT_STOP is ignored when a 1 is written to the SYSCTRL_CNT_CTRL_CNT_START bit at the same time.
NOTE: The SYSCTRL_SYSCLK_CNT register is used by the program ROM during the boot to store error flags, so we recommend that you clear it before use.
When the counters are tracking activity, the SYSCTRL_CNT_CTRL_CNT_STATUS bit in the SYSCTRL_CNT_CTRL register is set to CNT_RUNNING.
When the SYSCTRL_SYSCLK_CNT register is saturated (0xFFFF_FFFF), the SYSCTRL_CNT_CTRL_CNT_STATUS bit of the SYSCTRL_CNT_CTRL register is reset and all the counters are stopped automatically.
For registers, see Activity Counters Registers.