How this works
Duty cycle % = CCR / (ARR+1) × 100, using the common convention where the timer period corresponds to ARR+1 counts. Some peripherals define this slightly differently (ARR vs ARR+1, or active-low outputs) — verify against your specific timer's reference manual if the result seems off by a small amount.