CPU Clock Frequency Measurement
Contents
The J-Link DLL supports the CPU clock frequency measurement of connected target devices.
This i.e. is mandatory for CMSIS compatible flash loader which require the clock frequency being passed to the Init function:
int Init (unsigned long adr, unsigned long clk, unsigned long fnc);
Core Support
The generic clock frequency measurement is based on counting loop passes over a specified time. However, this requires knowledge of the instruction-to-clock ratio of each individual device. Some cores provide additional core modules and allow hardware-sided clock counting for precise measurements. One example is the cycle counter (CYCCNT) of the Data Watchpoint and Trace Unit (DWT) integrated in ARM Cortex-M cores. If such unit is available, the DLL will make use of it.
This table gives an overview about the supported CPU cores and the implemented measurement methods:
Core | Methods | Supported |
---|---|---|
ARM11 | ||
ARM79 | Loop counter | |
BT5511 | ||
Coldfire BDM3 | Loop counter | |
PIC32 | ||
PowerPC | ||
ARM Cortex-A/R (ARMv7-A) | Loop counter + DWT CYCCNT (opt.) | |
ARM Cortex-A/R (ARMv8-A) | ||
ARM Cortex-M | Loop counter + DWT CYCCNT | |
RISC-V | ||
Renesas RX | Loop counter |
Requirements
For successful CPU clock frequency measurements, some requirements have to be fulfilled:
- The clock frequency measurement must be supported by the DLL
- There must be not watchdog running while clock frequency measurement
- If the core has a DWT CYCCNT, it must be kept enabled at any time
A deviation of described reqiurements can cause unknown behavior and failing of flash programming.