22 ohm current limiting resistors for stm32 programming - Page 1
Forum section: electronics / general

author: Etesla
author_rank: Regular Contributor
timestamp: November 05, 2021, 08:24:30 pm
content: Hey guys. I noticed that all of the STM32 discovery and nucleo schematics that I find have 22 ohm resistors in series with the SWDIO, SWCLK, nRST lines used for programming. I have seen them referred to as current limiting resistors. I have a project that uses an STM32F0 microcontroller. I want to program it with one of these:https://www.st.com/resource/en/user_manual/dm00026748-st-link-v2-in-circuit-debugger-programmer-for-stm8-and-stm32-stmicroelectronics.pdfDo I have to include these 22 ohm resistors between the programming header and my microcontroller, or can I live without them? Experimentally I find that I can program just fine without them being there. I am wondering if there is some good reason to include them. There has to be some reason all the example discovery and nucleo boards use them right?I hate including things if I don't completely understand why they need to be there. To me it seems digital signals do not require current limiting normally, and even if they did the 22 ohms would likely only limit the current to 3.3/22 = 150mA with seems high enough to cause damage anyways???Thanks in advance!

author: capt bullshot
author_rank: Super Contributor
timestamp: November 05, 2021, 08:39:01 pm
content: Some designers include components into every new design just because someone else did once, or because some obscure design rules call for them ...Anyway, in this particular case, the resistors serve a purpose: It's not current limiting as in DC current, but rather adding some damping to the signals. Fast signal edges can cause signal ringing and ground bouncing, depending on the layout and length of the traces or wires. At some point this leads to interferences or non-working circuits. Putting small valued resistors in series with the signals mitigates this. Usually you'd place them at the signal source (for unidirectional signals).So in general it's not a bad idea to include them, but most probably you can live well without them and they're not necessary. They're better placed at the debugger end of the programming cable (so most probably they're already included in the ST-Link). Technically, the pin header you've shown above is the debugger end of the cable as this header is intended to debug an external target (if you open some jumpers on the nucleo board).

author: Benta
author_rank: Super Contributor
timestamp: November 05, 2021, 08:42:09 pm
content: ^ This.They are damping resistors.

author: Etesla
author_rank: Regular Contributor
timestamp: November 05, 2021, 08:57:00 pm
content: Yup makes sense to me. Would a good way to verify that I don't need them be to probe the clk and data signals really well and see what I see. If I have peak voltages less than like .3V above and below the rails I would assume I'm safe without them?

author: radar_macgyver
author_rank: Frequent Contributor
timestamp: November 05, 2021, 09:01:45 pm
content: They also serve to limit fault currents if one accidentally puts a voltage > VCC on these pins (for example, an ESD event). This will turn on the I/O protection diodes and unless the current is limited, can blow them. Nice to have on I/Os that go off-board.

author: thm_w
author_rank: Super Contributor
timestamp: November 05, 2021, 10:27:00 pm
content: This connector is for programming of *external* devices, via the onboard st-link, it has nothing to do with the internal STM32 on the board. as capt bullshot said.Do not include them.https://www.digikey.com/htmldatasheets/production/2365230/0/0/1/STM32-Nucleo-64-P-User-Manual.pdf

author: PCB.Wiz
author_rank: Super Contributor
timestamp: November 05, 2021, 11:23:37 pm
content: Quote from: Etesla on November 05, 2021, 08:57:00 pmIt's not so much the peaks, but the ringing that can bite you, as that can cause double-clocking, which certainly gives programming issuesI've found 100~120 ohms series R can be needed, if programming over not-short ribbon cable with an external adaptor. Mostly the CLK pin needs it, and they are best on thedrivenend.On other pins, such parts can help ESD or other oops events. If you only want factory pgm, on a fixture with known short leads, it's probably ok to omit them

author: Siwastaja
author_rank: Super Contributor
timestamp: November 06, 2021, 02:10:12 pm
content: Google "series termination" or "source termination".Usually doesn't matter. The interface is used on the lab table, with a short cable, and doesn't need to pass EMI regulations.22ohms is better-than-nothing safety layer against accidental short circuits, and maybe a tiny improvement in ESD survival by limiting ESD current but this effect is almost negligible, I think.I don't usually add such termination on the debug port unless it's going to be repurposed for something else.For low-noise applications where you read a high-resolution ADC through SPI, for example, you may really want to add those 22ohm resistors. Or if you have a long trace of a piece of ribbon cable in a fast digital signal and want to pass EMI. In both examples, avoiding voltage peaks and oscillations from transmission line reflections is a good idea. You may also want to use slightly larger value if speed is noncritical.

author: dietert1
author_rank: Super Contributor
timestamp: November 06, 2021, 02:29:18 pm
content: Nowadays it seems good engineering practice to systematically include EMI filters on all external interfaces. I have seen younger EEs do this without even asking whether it is necessary in each single case. Maybe they learn this at university.The circuit should work if a mobile phone or WLAN router is active right next to it, with maybe 0.5 to 1 W RF emission.At GHz frequencies the 22 Ohm resistor already helps, if it sits near the interface resp. near the circuit board rim.Regards, Dieter

author: RoGeorge
author_rank: Super Contributor
timestamp: November 06, 2021, 02:54:53 pm
content: Quote from: Etesla on November 05, 2021, 08:24:30 pmYes. They are against ringing and reflections (in the sense of signal reflections in a wire acting like a transmission line). They are not for current limiting. Put them near the pins of the source signal.If you don't include the resistors, programming might work unreliable, or not at all. As an example, I've seen a case where the same programing cable sometimes was working great and some other times was unusable only because the clock was the nearby or the faraway wire relative to the GND wire in a flat cable.If you feel lucky you can remove the resistors, but if you want a reliable communication you must have the dumping resistors.