Integer Clock Divider Finder

Find the bounded positive integer divisor minimizing absolute frequency error, selecting the smaller divisor on a tie.

Description

An integer clock divider approximates a target frequency from an input clock.

An integer clock divider approximates a target frequency from an input clock. Minimizing frequency error need not choose the nearest integer to the ideal divider.1

Find the bounded positive integer divisor minimizing absolute frequency error, selecting the smaller divisor on a tie.

When to use Integer Clock Divider Finder

Use this tool to find the bounded positive integer divisor minimizing absolute frequency error, selecting the smaller divisor on a tie.

Prepare the single firmware record, sampled digital states or effective timing/register parameters requested. Confirm byte order, bit numbering, units and device-specific limits before interpreting the calculation.

How to use Integer Clock Divider Finder and understand its results

  1. Prepare the single firmware record, sampled digital states or effective timing/register parameters requested. Confirm byte order, bit numbering, units and device-specific limits before interpreting the calculation.
  2. Enter clockHz, targetHz, maximumDivider using the field table and calculation rules, then run the tool.
  3. Read divider, actualHz, errorPercent. The explanation below defines the units, signs, ordering and any flags or placeholder values.
  4. If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
Input fieldMeaningValue type; see rules belowRequirement
clockHzInput clock frequency. (Hz)number; strictly above: 0Required
targetHzTarget output frequency. (Hz)number; strictly above: 0Required
maximumDividerLargest supported effective divisor.integer; minimum: 1; maximum: 4294967295Required

Enter positive clock/target frequencies and maximum divider. Clamp adjacent ideal divisors to 1…maximum and choose the smaller absolute frequency error, favoring the smaller divisor on ties. Return divisor, actual Hz and signed relative error percent.

ideal=clock/target; compare clamped floor/ceil; actual=clock/divider

Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.

Output fieldMeaningValue type
dividerSelected effective divisor.integer; minimum: 1
actualHzAchieved output frequency. (Hz)number; strictly above: 0
errorPercentSigned frequency error relative to the target. (%)number
json
{
  "input": {
    "clockHz": 48000000,
    "targetHz": 10000000,
    "maximumDivider": 32
  },
  "output": {
    "divider": 5,
    "actualHz": 9600000,
    "errorPercent": -4
  }
}

Limitations and assumptions

This returns an effective divisor, not a device register encoding. Supported hardware restrictions, clock accuracy and jitter are not checked.

Numeric inputs must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors.

Alternative or Complementary methods

Use CAN Bit Timing Calculator: Calculate nominal CAN bitrate and sample point from effective prescaler and segment lengths, including the one-quantum synchronization segment. For a complementary task, use Register Field Encoder: Replace an unsigned 32-bit register field using exact integer bit operations and explicit field bounds.

References

  1. Integer Clock Divider Finder — tool.io

Similar or alternative tools

  • CAN Bit Timing Calculator

    Calculate nominal CAN bitrate and sample point from effective prescaler and segment lengths, including the one-quantum synchronization segment.

  • Register Field Encoder

    Replace an unsigned 32-bit register field using exact integer bit operations and explicit field bounds.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies