<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Lindy kellams</title>
    <description>The latest articles on DEV Community by Lindy kellams (@feiyunifeng).</description>
    <link>https://dev.to/feiyunifeng</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4110619%2Fc1c694b2-4346-4692-971d-62ec1742e2db.jpg</url>
      <title>DEV Community: Lindy kellams</title>
      <link>https://dev.to/feiyunifeng</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/feiyunifeng"/>
    <language>en</language>
    <item>
      <title>Why Is an RC Filter's Cutoff Frequency -3 dB?</title>
      <dc:creator>Lindy kellams</dc:creator>
      <pubDate>Mon, 21 Sep 2026 06:02:45 +0000</pubDate>
      <link>https://dev.to/feiyunifeng/why-is-an-rc-filters-cutoff-frequency-3-db-43kk</link>
      <guid>https://dev.to/feiyunifeng/why-is-an-rc-filters-cutoff-frequency-3-db-43kk</guid>
      <description>&lt;h1&gt;
  
  
  Why Is an RC Filter's Cutoff Frequency -3 dB?
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Alternative titles
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;RC Filters at Cutoff: Why the Signal Is 0.707, Not 0.5&lt;/li&gt;
&lt;li&gt;What the -3 dB Point Actually Means in a First-Order RC Filter&lt;/li&gt;
&lt;li&gt;From RC to 159 Hz: Understanding the First-Order Filter Transition&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Short description / excerpt
&lt;/h2&gt;

&lt;p&gt;The familiar RC cutoff formula gives a frequency, but the -3 dB label explains what that frequency means. Using a 10 kΩ resistor and 100 nF capacitor, this article connects the calculation to amplitude, power, low-pass and high-pass behaviour, and real circuit limits.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recommended tags
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;electronics&lt;/code&gt;, &lt;code&gt;embedded&lt;/code&gt;, &lt;code&gt;engineering&lt;/code&gt;, &lt;code&gt;beginners&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Article
&lt;/h2&gt;

&lt;p&gt;An RC filter is often introduced with one compact equation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fc = 1 / (2πRC)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Put 10 kΩ and 100 nF into that equation and the result is 159.15 Hz. That part is easy to calculate. The more useful question is what the number means in a circuit.&lt;/p&gt;

&lt;p&gt;Why is the point called “-3 dB”? Why not call it the frequency where the signal is half? And why do low-pass and high-pass filters share the same cutoff expression even though they pass opposite parts of the spectrum?&lt;/p&gt;

&lt;p&gt;The answer is in the word &lt;em&gt;transition&lt;/em&gt;. A first-order RC filter does not behave like an on/off switch. Its cutoff frequency is the conventional marker in a gradual change from passband to attenuation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with one concrete RC value
&lt;/h2&gt;

&lt;p&gt;For a resistor of 10 kΩ and a capacitor of 100 nF:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;R = 10,000 Ω
C = 100 × 10^-9 F

fc = 1 / (2π × 10,000 × 100 × 10^-9)
   = 159.154943... Hz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So a sensible engineering display is &lt;strong&gt;159.15 Hz&lt;/strong&gt;. This is the same cutoff frequency whether the parts are wired as a basic RC low-pass or a basic RC high-pass. The response around that point is different, but the RC time scale is the same.&lt;/p&gt;

&lt;h2&gt;
  
  
  The key number at cutoff is 1/√2
&lt;/h2&gt;

&lt;p&gt;For an ideal first-order RC low-pass, the output magnitude is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;|HLP(f)| = 1 / √(1 + (f / fc)^2)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At &lt;code&gt;f = fc&lt;/code&gt;, the ratio &lt;code&gt;f / fc&lt;/code&gt; is 1. Substituting it gives:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;|HLP(fc)| = 1 / √(1 + 1^2)
          = 1 / √2
          ≈ 0.70710678
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The high-pass magnitude is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;|HHP(f)| = (f / fc) / √(1 + (f / fc)^2)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At the same frequency, it also becomes &lt;code&gt;1 / √2&lt;/code&gt;. In other words, a low-pass has fallen to about 70.7% of its passband voltage amplitude at cutoff, while a high-pass has risen to about 70.7% of its passband amplitude.&lt;/p&gt;

&lt;p&gt;That is why the same &lt;code&gt;fc&lt;/code&gt; is meaningful for both topologies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why 0.707 becomes -3 dB
&lt;/h2&gt;

&lt;p&gt;Decibels for a voltage or amplitude ratio are calculated as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;20 log10(Vout / Vin)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At cutoff, the amplitude ratio is &lt;code&gt;1 / √2&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;20 log10(1 / √2) = -3.0103 dB
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Engineers usually shorten that to &lt;strong&gt;-3 dB&lt;/strong&gt;. The approximation is close enough for the label, but the distinction matters when explaining it.&lt;/p&gt;

&lt;p&gt;“-3 dB” does &lt;strong&gt;not&lt;/strong&gt; mean the voltage amplitude is half. Half voltage would be approximately -6.02 dB. At the cutoff of this RC filter, voltage amplitude is about 0.707 of the passband value.&lt;/p&gt;

&lt;p&gt;Power is proportional to voltage squared when impedance is unchanged. Squaring the cutoff amplitude ratio gives:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(1 / √2)^2 = 1 / 2 = 0.5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So at the -3 dB point, the power is half of the passband power for the same impedance. This is the origin of the common “half-power point” phrase.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reading the low-pass response
&lt;/h2&gt;

&lt;p&gt;In a low-pass RC circuit, low frequencies see little attenuation. At frequencies well below 159.15 Hz in this example, the output is close to the input. At 159.15 Hz, the magnitude is 0.707. Above that, the capacitor increasingly shunts the output toward ground and the output falls gradually.&lt;/p&gt;

&lt;p&gt;Far above cutoff, an ideal first-order low-pass rolls off at roughly -20 dB per decade. That is a slope, not a vertical edge. A 1 kHz component is attenuated more than a 200 Hz component, but neither disappears simply because it is above 159 Hz.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reading the high-pass response
&lt;/h2&gt;

&lt;p&gt;A high-pass RC circuit tells the complementary story. Very low frequencies are attenuated because the series capacitor presents a large reactance. At 159.15 Hz, the output has reached 0.707 of its high-frequency passband amplitude. At much higher frequencies, the capacitor’s reactance becomes small and the output approaches the input.&lt;/p&gt;

&lt;p&gt;Far below cutoff, the ideal high-pass magnitude changes at about +20 dB per decade as frequency rises. Again, cutoff is the center of a transition, not a brick wall.&lt;/p&gt;

&lt;h2&gt;
  
  
  A useful way to check the intuition
&lt;/h2&gt;

&lt;p&gt;It helps to calculate a few frequencies rather than treating &lt;code&gt;fc&lt;/code&gt; as a magic boundary. For the 159.15 Hz low-pass:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;At 15.9 Hz, one tenth of cutoff, the amplitude is close to 0.995.&lt;/li&gt;
&lt;li&gt;At 159.15 Hz, it is 0.707.&lt;/li&gt;
&lt;li&gt;At 1.59 kHz, ten times cutoff, it is close to 0.0995.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The high-pass has those endpoint magnitudes reversed: close to 0.0995 at one tenth of cutoff and close to 0.995 at ten times cutoff. These values make the gradual transition visible.&lt;/p&gt;

&lt;p&gt;You can vary R, C, topology, and a frequency probe with the free &lt;a href="https://circuit-clarity.pages.dev/tools/rc-filter-cutoff-calculator/" rel="noopener noreferrer"&gt;CircuitClarity RC Filter Cutoff Calculator&lt;/a&gt;. Watching the response update is a useful complement to the equation.&lt;/p&gt;

&lt;h2&gt;
  
  
  The ideal formula is a starting point
&lt;/h2&gt;

&lt;p&gt;The formula assumes an ideal source and an ideal load. In a physical circuit, the source resistance can become part of the effective R, and the next stage’s input impedance can load the output. Resistor and capacitor tolerances shift the actual cutoff. Capacitor ESR and parasitic capacitance or inductance matter more as frequency rises.&lt;/p&gt;

&lt;p&gt;Those effects do not invalidate &lt;code&gt;fc = 1 / (2πRC)&lt;/code&gt;. They explain why it is best used as the nominal design value, followed by a check of the full circuit and the component data.&lt;/p&gt;

&lt;p&gt;The -3 dB point is therefore not a failure threshold. It is a clear, reproducible reference: the frequency where a first-order RC filter’s amplitude is &lt;code&gt;1 / √2&lt;/code&gt;, its same-impedance power ratio is one half, and its transition is well underway.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>hardware</category>
      <category>science</category>
    </item>
    <item>
      <title>Why Your Voltage Divider Output Changes When You Connect a Load</title>
      <dc:creator>Lindy kellams</dc:creator>
      <pubDate>Sat, 19 Sep 2026 10:16:50 +0000</pubDate>
      <link>https://dev.to/feiyunifeng/why-your-voltage-divider-output-changes-when-you-connect-a-load-1fnb</link>
      <guid>https://dev.to/feiyunifeng/why-your-voltage-divider-output-changes-when-you-connect-a-load-1fnb</guid>
      <description>&lt;h1&gt;
  
  
  Why Your Voltage Divider Output Changes When You Connect a Load
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Alternative titles
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Voltage Dividers Are Not Voltage Regulators: Understanding the Loading Effect&lt;/li&gt;
&lt;li&gt;The Missing Resistor in Your Voltage Divider Calculation&lt;/li&gt;
&lt;li&gt;Why a 3.33 V Divider Can Become a 2.5 V Node&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Short description / excerpt
&lt;/h2&gt;

&lt;p&gt;A voltage divider can produce the expected voltage in a textbook calculation and still shift when another circuit connects to its output. This worked example shows why the load becomes part of the divider, how to calculate the new output, and when a divider is appropriate in a real design.&lt;/p&gt;

&lt;h2&gt;
  
  
  Article
&lt;/h2&gt;

&lt;p&gt;A voltage divider gives 3.33 V on paper.&lt;/p&gt;

&lt;p&gt;You connect something to the output.&lt;/p&gt;

&lt;p&gt;Now the voltage is closer to 2.5 V.&lt;/p&gt;

&lt;p&gt;Why?&lt;/p&gt;

&lt;p&gt;The formula was not wrong. The circuit changed.&lt;/p&gt;

&lt;p&gt;This is the voltage-divider loading effect: the thing connected to the output is not invisible. If it draws current, it changes the effective resistance seen by the divider and therefore changes the output voltage.&lt;/p&gt;

&lt;h2&gt;
  
  
  The ideal voltage divider
&lt;/h2&gt;

&lt;p&gt;The familiar two-resistor divider has an input voltage, a top resistor R1, and a bottom resistor R2 connected to ground. The output is measured at the node between the two resistors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Vin ── R1 ──┬── Vout
            │
            R2
            │
           GND
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With no external load, the output is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Vout = Vin × R2 / (R1 + R2)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This equation assumes that the output measurement draws negligible current. That assumption is often useful, but it is still an assumption.&lt;/p&gt;

&lt;h2&gt;
  
  
  A worked 5 V example
&lt;/h2&gt;

&lt;p&gt;Take the following values:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Vin = 5 V&lt;/li&gt;
&lt;li&gt;R1 = 10 kΩ&lt;/li&gt;
&lt;li&gt;R2 = 20 kΩ&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The unloaded output is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Vout = 5 × 20 / (10 + 20)
     = 100 / 30
     = 3.333 V approximately
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The current through the series divider is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;I = 5 / (10 kΩ + 20 kΩ)
  = 166.7 µA approximately
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So far, the result is exactly what we expect.&lt;/p&gt;

&lt;h2&gt;
  
  
  What changes when a load is connected?
&lt;/h2&gt;

&lt;p&gt;Now connect a load resistor of 20 kΩ from Vout to ground:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Vin ── R1 ──┬── Vout
            ├── R2 ── GND
            └── RL ── GND
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important detail is the connection location. Both R2 and RL connect between the same two nodes: Vout and ground. That means they are in parallel, not in series.&lt;/p&gt;

&lt;p&gt;The load therefore becomes part of the voltage-divider calculation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Replace the lower branch with an equivalent resistance
&lt;/h2&gt;

&lt;p&gt;The parallel equivalent of R2 and RL is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Req = R2 || RL
    = (R2 × RL) / (R2 + RL)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For two 20 kΩ resistors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Req = 20 kΩ || 20 kΩ
    = 10 kΩ
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The loaded circuit is now equivalent to a 10 kΩ top resistor in series with a 10 kΩ lower branch. Reapplying the divider equation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Vout_loaded = 5 × 10 / (10 + 10)
            = 2.5 V
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output did not move because the original formula stopped working. It moved because the lower resistance changed from 20 kΩ to 10 kΩ.&lt;/p&gt;

&lt;p&gt;The current through R1 is now 250 µA. At the output node, that current splits between R2 and RL. Since both branches are 20 kΩ and both have 2.5 V across them, each branch carries 125 µA.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quantifying the loading error
&lt;/h2&gt;

&lt;p&gt;Comparing the ideal and loaded results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;loading error = (3.333 - 2.5) / 3.333 × 100%
              ≈ 25%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A 25% shift is large enough to break many designs that looked correct when only the unloaded formula was considered.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this matters in real circuits
&lt;/h2&gt;

&lt;p&gt;The load does not have to be an obvious resistor. It can be the input network of another circuit, a measurement instrument, a sensor interface, a bias network, or an ADC input. In each case, the next stage has some finite input impedance and may also have leakage or bias currents. From the divider's point of view, that next stage is part of the load.&lt;/p&gt;

&lt;p&gt;For a high-impedance measurement input, the loading may be small compared with R2. For a lower-impedance input, it may be significant. The right question is not simply “What voltage does the divider formula give?” It is “What impedance does the next stage present to this node?”&lt;/p&gt;

&lt;h2&gt;
  
  
  A common mistake
&lt;/h2&gt;

&lt;p&gt;The most common mistake is to calculate Vout from R1 and R2, then connect a load without recalculating. A related mistake is to treat the load as if it were in series with R2 because it appears later in the signal path. Topology matters more than drawing order: components sharing the same two nodes are parallel.&lt;/p&gt;

&lt;h2&gt;
  
  
  A useful design intuition
&lt;/h2&gt;

&lt;p&gt;There is another way to see the same result. Before a load is attached, the divider can be viewed from its output node as a Thevenin source. Its open-circuit voltage is the ideal 3.333 V, and its source resistance is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Rth = R1 || R2
    = 10 kΩ || 20 kΩ
    = 6.667 kΩ approximately
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When a load is connected to that source, the load and Rth form another divider. A 20 kΩ load is not enormously larger than 6.667 kΩ, so it causes a noticeable drop. This viewpoint is useful when evaluating a divider as the source for a later stage: a low source resistance makes the node less sensitive to loading, but lowering both divider resistors also increases the continuous current drawn from Vin.&lt;/p&gt;

&lt;p&gt;That tradeoff is why simply making every resistor smaller is not a complete design rule. Smaller values can reduce the percentage error from a given input impedance, but they consume more power and may be inappropriate for a battery-powered circuit. A buffer can provide a high input impedance and a low output impedance when the application needs both low loading and useful drive capability.&lt;/p&gt;

&lt;p&gt;The same reasoning applies to a multimeter or oscilloscope probe. The instrument has a specified input resistance, so it can be modeled as another load. If that resistance is many times larger than R2, the measurement error may be small. If it is comparable to R2, the measurement is part of the circuit and must be included.&lt;/p&gt;

&lt;h2&gt;
  
  
  When is a voltage divider appropriate?
&lt;/h2&gt;

&lt;p&gt;A divider is useful when the output is a signal or reference that will feed a high-impedance input and only a small current is required. It is also useful for sensing, setting bias levels, and creating a simple threshold reference when the tolerance and source impedance are acceptable.&lt;/p&gt;

&lt;p&gt;It is not a good general-purpose replacement for a regulated supply. A divider's output changes with its input, resistor tolerance, temperature, and load current. If a downstream circuit needs a stable voltage or meaningful power, consider a buffer, voltage regulator, or another circuit designed for that job.&lt;/p&gt;

&lt;p&gt;If you want to experiment with different resistor and load values, the &lt;a href="https://circuit-clarity.pages.dev/tools/voltage-divider-calculator/" rel="noopener noreferrer"&gt;CircuitClarity Voltage Divider Calculator&lt;/a&gt; shows both the ideal divider and the loaded result so the effect is visible as the circuit changes.&lt;/p&gt;

&lt;p&gt;The useful habit is simple: whenever something connects to a divider output, add that connection to the circuit model before trusting the number.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recommended DEV tags
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;electronics&lt;/code&gt; &lt;code&gt;embedded&lt;/code&gt; &lt;code&gt;engineering&lt;/code&gt; &lt;code&gt;beginners&lt;/code&gt;&lt;/p&gt;

</description>
      <category>hardware</category>
    </item>
    <item>
      <title>3 Common STM32 Timer Mistakes That Give You the Wrong PWM Frequency</title>
      <dc:creator>Lindy kellams</dc:creator>
      <pubDate>Sat, 05 Sep 2026 04:20:38 +0000</pubDate>
      <link>https://dev.to/feiyunifeng/3-common-stm32-timer-mistakes-that-give-you-the-wrong-pwm-frequency-g5</link>
      <guid>https://dev.to/feiyunifeng/3-common-stm32-timer-mistakes-that-give-you-the-wrong-pwm-frequency-g5</guid>
      <description>&lt;h2&gt;
  
  
  The symptom: PSC and ARR look right, but the frequency is wrong
&lt;/h2&gt;

&lt;p&gt;STM32 timer math is compact enough to fit in one line, yet small assumptions can move a PWM output far from its target. Before changing firmware at random, check the timer clock, the register offsets, and the way you chose PSC and ARR. The examples below use an up-counting, edge-aligned time base.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mistake #1: forgetting both “+1” terms
&lt;/h2&gt;

&lt;p&gt;For this mode, the project calculator uses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;counterClock = timerClock / (PSC + 1)
PWM frequency = timerClock / ((PSC + 1) × (ARR + 1))
period = 1 / PWM frequency
duty = CCR / (ARR + 1) × 100%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The register values are zero-based. PSC=71 means a divide-by-72 prescaler, not divide-by-71. Likewise, an up-counter that runs from 0 through ARR=999 has 1,000 timer ticks per period. Using &lt;code&gt;timerClock / (PSC × ARR)&lt;/code&gt; introduces two independent off-by-one errors and is especially misleading when either register is zero.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mistake #2: using the wrong timer input clock
&lt;/h2&gt;

&lt;p&gt;The CPU frequency is not automatically the input clock of every timer. Start at the clock tree: identify the APB bus, its prescaler, and the effective clock routed to the specific timer instance. Some STM32 families apply a timer-clock multiplication rule when an APB prescaler is not 1; other families and timer domains have different details. Treat that as a device-specific rule, not a universal STM32 constant.&lt;/p&gt;

&lt;p&gt;The calculator's &lt;code&gt;timerClock&lt;/code&gt; field means this effective input clock in hertz. If you enter the APB peripheral clock when the timer receives another value, the arithmetic can be internally correct and still disagree with the pin waveform. The exact reference manual for the MCU and its clock configuration is the authority.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mistake #3: guessing PSC and ARR
&lt;/h2&gt;

&lt;p&gt;PSC and ARR are a pair. Many integer pairs can produce the same frequency, but they do not provide the same counter rate or duty-cycle resolution.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PSC sets the counter clock after prescaling.&lt;/li&gt;
&lt;li&gt;ARR sets the number of counter ticks in a period.&lt;/li&gt;
&lt;li&gt;CCR sets the compare point. With PWM mode 1, edge alignment and active-high polarity, &lt;code&gt;CCR / (ARR + 1)&lt;/code&gt; is the ideal duty calculation.&lt;/li&gt;
&lt;li&gt;Both PSC and ARR must fit the selected timer width, and CCR must be within the useful range for ARR.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Choosing a pair is therefore a design decision, not a guessing game. A larger ARR generally gives more discrete compare values for duty control. The target-frequency solver in the calculator searches valid integer pairs, minimizes relative frequency error, and reports that error; it is still your responsibility to check the timer's actual capabilities and clock setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  Worked example: 72 MHz timer clock, 1 kHz PWM
&lt;/h2&gt;

&lt;p&gt;Suppose the clock tree and reference manual establish a 72,000,000 Hz timer input. Use PSC=71, ARR=999, and CCR=250.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Counter clock = 72,000,000 / (71 + 1) = &lt;strong&gt;1,000,000 Hz&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Period ticks = 999 + 1 = &lt;strong&gt;1,000&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;PWM frequency = 1,000,000 / 1,000 = &lt;strong&gt;1,000 Hz&lt;/strong&gt;; period = &lt;strong&gt;1 ms&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Ideal duty = 250 / 1,000 × 100 = &lt;strong&gt;25%&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The same formula gives useful cross-checks:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Timer clock&lt;/th&gt;
&lt;th&gt;PSC&lt;/th&gt;
&lt;th&gt;ARR&lt;/th&gt;
&lt;th&gt;CCR&lt;/th&gt;
&lt;th&gt;Counter clock&lt;/th&gt;
&lt;th&gt;PWM frequency&lt;/th&gt;
&lt;th&gt;Duty&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;72 MHz&lt;/td&gt;
&lt;td&gt;71&lt;/td&gt;
&lt;td&gt;999&lt;/td&gt;
&lt;td&gt;250&lt;/td&gt;
&lt;td&gt;1 MHz&lt;/td&gt;
&lt;td&gt;1 kHz&lt;/td&gt;
&lt;td&gt;25%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;72 MHz&lt;/td&gt;
&lt;td&gt;719&lt;/td&gt;
&lt;td&gt;999&lt;/td&gt;
&lt;td&gt;500&lt;/td&gt;
&lt;td&gt;100 kHz&lt;/td&gt;
&lt;td&gt;100 Hz&lt;/td&gt;
&lt;td&gt;50%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;80 MHz&lt;/td&gt;
&lt;td&gt;79&lt;/td&gt;
&lt;td&gt;999&lt;/td&gt;
&lt;td&gt;750&lt;/td&gt;
&lt;td&gt;1 MHz&lt;/td&gt;
&lt;td&gt;1 kHz&lt;/td&gt;
&lt;td&gt;75%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These are arithmetic examples, not measurements. Startup timing, preload and update events, oscillator tolerance, output polarity, interrupts, DMA and board effects can change what an instrument observes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Verify instead of guessing
&lt;/h2&gt;

&lt;p&gt;I develop and maintain the &lt;a href="https://embedded-engineering-toolkit.pages.dev/tools/stm32-timer-pwm/" rel="noopener noreferrer"&gt;STM32 Timer &amp;amp; PWM Calculator&lt;/a&gt;. It calculates counter clock, period, PWM frequency and ideal edge-aligned duty from timer clock, width, PSC, ARR and CCR, and includes a target-frequency solver with an error value.&lt;/p&gt;

&lt;p&gt;To reproduce the worked example, enter &lt;code&gt;72000000&lt;/code&gt; Hz, choose 16-bit, enter PSC &lt;code&gt;71&lt;/code&gt;, ARR &lt;code&gt;999&lt;/code&gt;, and CCR &lt;code&gt;250&lt;/code&gt;, then select Calculate. Check for 1 MHz counter clock, 1 kHz PWM frequency, 1 ms period and 25% duty. This is a repeatable arithmetic check, not an official STM32 configuration wizard or a hardware verification report.&lt;/p&gt;

&lt;h2&gt;
  
  
  A short debugging checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Check the effective timer input clock in the MCU clock tree.&lt;/li&gt;
&lt;li&gt;Keep both &lt;code&gt;PSC + 1&lt;/code&gt; and &lt;code&gt;ARR + 1&lt;/code&gt; terms.&lt;/li&gt;
&lt;li&gt;Confirm the timer width and register ranges.&lt;/li&gt;
&lt;li&gt;Decide whether your chosen ARR provides enough duty resolution.&lt;/li&gt;
&lt;li&gt;Check CCR against ARR and the selected PWM polarity/mode.&lt;/li&gt;
&lt;li&gt;Compare the calculated result with the exact device reference manual.&lt;/li&gt;
&lt;li&gt;Measure the final waveform separately when hardware behavior matters.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  References and disclosure
&lt;/h2&gt;

&lt;p&gt;ST's &lt;a href="https://www.st.com/resource/en/application_note/an4776-generalpurpose-timer-cookbook-for-stm32-microcontrollers-stmicroelectronics.pdf" rel="noopener noreferrer"&gt;AN4776 timer cookbook&lt;/a&gt; gives official timer and PWM configuration examples. STM32F1 users can also consult the timer and RCC chapters of &lt;a href="https://www.st.com/resource/en/reference_manual/rm0008-stm32f103xx-advanced-armbased-32bit-mcus-stmicroelectronics.pdf" rel="noopener noreferrer"&gt;RM0008&lt;/a&gt;. Other STM32 families require their matching manuals.&lt;/p&gt;

&lt;p&gt;AI assisted with drafting and language editing. The equations and numerical examples were independently recomputed from the stated model. No hardware measurements, user testimonials or performance guarantees are claimed.&lt;/p&gt;

</description>
      <category>debugging</category>
      <category>hardware</category>
      <category>iot</category>
    </item>
  </channel>
</rss>
