STM32: Best practices for adding an STDC14 (STLink) debug connector - Page 1
Forum section: electronics / general

author: dkonigs
author_rank: Regular Contributor
timestamp: October 22, 2020, 09:54:55 pm
content: As I work through the design for my current project (likely using an STM32F4), it seems obvious that I'm going to want some way to actually do in-circuit programming and debugging of the target. To that end, the "standard" way of connecting a recent ST-Link (v3) device seems to be via an STDC14 connector.While the pin-out and physical part for this connector is quite easy to come by, what I have not yet found are actual guidelines for how to most appropriately integrate this into your actual target device.Thus far, my strategy has been to find one of STM's development boards that actually has an STDC14 connector (many don't, but some do), and see how they've managed to wire it in. Looking at the schematics for the Nucleo64 STM32G4, for example, its mostly just wired to the obvious pins. (Along with ESD protection on most of the lines, an in-line resistor on JTDI, and some notes about SWDIO/SWCLK routing.)In any case, does anyone know of good documents and/or schematics that contain the "best practices" guidance for how to integrate an STDC14 connector?

author: langwadt
author_rank: Super Contributor
timestamp: October 22, 2020, 09:58:51 pm
content: I just put SWDIO,SWCLK,Reset,Vcc and ground on a connector, usually just a SIL pinheader

author: S. Petrukhin
author_rank: Super Contributor
timestamp: October 23, 2020, 09:16:28 pm
content: Quote from: langwadt on October 22, 2020, 09:58:51 pmI'm still adding SWO. And I make a separate RX/TX/GND connector for USART0, which I use as a console.

author: LootMaster
author_rank: Regular Contributor
timestamp: October 23, 2020, 09:24:16 pm
content: I also put on the SWO everytime if possible. But its not mandatory (if you really need that pin).It should always be the mini cortex 10 pin header, for a single ARM uC.If you intend to have a chain of uC, then you need the JTAG. This can also be had in 10 mini cortex header.Be aware that ST-LINK ( all versions) dont support JTAG chains. Only J-ink does.If no intention of chain, dont use JTAG over SWD.No need for ESD, just dont hotplug it...Pullup on SWO and NRST, pull down on Boot0. direct connection SWDIO and SWDCLK. That's it...ESD is for really big boards with long traces, they recommend putting it for legal/liability reasons in case you are a moron who does not know basics.In reality, not many people in the real world put ESD on their debugging/flashing lines.Good luck!

author: S. Petrukhin
author_rank: Super Contributor
timestamp: October 24, 2020, 01:13:44 am
content: Quote from: LootMaster on October 23, 2020, 09:24:16 pmI output SWO so that I can remotely see the output to the console. I use the CodeGrip programmer-it allows you to perform wireless debugging and monitoring SWO via WiFi. This is very convenient, there is no need to be in an inconvenient and aggressive environment of an industrial enterprise, you can connect the programmer and stay in the operator's room.Quote from: LootMaster on October 23, 2020, 09:24:16 pmIt takes up a lot of space on the board. Simple pins are much more compact.

author: LootMaster
author_rank: Regular Contributor
timestamp: October 24, 2020, 01:36:37 am
content: Whatever fits with st-link v3 out of the box.I aint THAT space constrained.

author: S. Petrukhin
author_rank: Super Contributor
timestamp: October 24, 2020, 02:07:30 am
content: Quote from: LootMaster on October 24, 2020, 01:36:37 amYou probably haven't squatted with a notbook and ST-Link v3 near a hot, stinking, and rumbling machine - for you, remote debugging doesn't matter.

author: ataradov
author_rank: Super Contributor
timestamp: October 24, 2020, 02:09:00 am
content: Quote from: S. Petrukhin on October 24, 2020, 01:13:44 amStandard Cortex-M debug connector (5x2 0.05" spacing) is the same area as 3 pins of 0.1" connector. Just don't use shrouded connector. Shroud takes most of the space.

author: LootMaster
author_rank: Regular Contributor
timestamp: October 24, 2020, 02:13:25 am
content: Quote from: S. Petrukhin on October 24, 2020, 02:07:30 amI have not.But I like that method, sounds interrestint for future projects.What IDE/ what debugger/ what processor?Right now I have all free software or inexpensive debuggers... ST-LINK V3 mini is 20$

author: S. Petrukhin
author_rank: Super Contributor
timestamp: October 24, 2020, 02:41:15 am
content: Quote from: S. Petrukhin on October 24, 2020, 02:07:30 amQuote from: LootMaster on October 24, 2020, 02:13:25 amYou're lucky. And I have to invent systems for managing industrial equipment and often perform on-site debugging.Quote from: LootMaster on October 24, 2020, 02:13:25 amI use mikroPascal compiler and debugger, CodeGrip programmer, STM32F107VE processor.

author: S. Petrukhin
author_rank: Super Contributor
timestamp: October 24, 2020, 02:50:55 am
content: Quote from: LootMaster on October 24, 2020, 02:13:25 amMy kit is more expensive... Compiler $299, programmer $99 + WiFi license $100. Total: $498.

author: Kjelt
author_rank: Super Contributor
timestamp: October 24, 2020, 07:10:26 am
content: Quote from: ataradov on October 24, 2020, 02:09:00 amAre these connectors still that expensive?Last time I bought them four years ago they were over $1 a piece.

author: ataradov
author_rank: Super Contributor
timestamp: October 24, 2020, 07:19:25 am
content: Quote from: Kjelt on October 24, 2020, 07:10:26 amDepends on whether you are ok buying direct from China. Here is the first result when searching for "2x5 1.27mm 100pcs" -https://www.aliexpress.com/item/32795241952.html($3.10 + $4.72 shipping to US). 8 cents/piece is pretty cheap."Reputable" distributors always charge outrageous amounts of money for trivial connectors. So I'm not even considering them anymore.

author: Kjelt
author_rank: Super Contributor
timestamp: October 24, 2020, 07:28:43 am
content: Yes that was for the company I worked for back then.In the end we kept the pcb footprint but left the connector out due to price.Also if you place/remove the connector a lot of times they damage quite quickly.Company bought (custom order) a few fast debug/program adapters. Those are milled from POM/Delrin, contain those gold probe contacts and a few fastclamps to clamp the board to the probe contacts.If you ever make something for yourself over 50 pieces I can recommend that.PS those are TH connectors , we had SMD types, those are way more expensive.

author: ataradov
author_rank: Super Contributor
timestamp: October 24, 2020, 07:32:31 am
content: I use that connector on all my boards, I have not had one damaged yet. I'm not sure how much you need to be disconnecting/reconnecting the debugger for it to be damaged.Plus you really don't need that connector on the mass production boards. Having just the footprint for the bed of nails is a much better idea.SMD connectors take up more room. And having a though hole connector is much easier for routing in most cases anyway.Also, they are not all that more expensive. Here is SMT listing for 10 pcs (I can't easily fine one for 100 pcs)https://www.aliexpress.com/item/32972376101.html($0.90 + $1.03) - 20 cents/piece. And you can combine shipping, so buying in bulk will be much cheaper.

author: Kjelt
author_rank: Super Contributor
timestamp: October 24, 2020, 08:00:33 am
content: Oh the same troubles you have with the micro usb connectors, they sometimes snap off the board but that is rare.TH will be much sturdier than smd. Always keep a stock of the cables they sometimes just make bad contact after hundreds use.

author: ataradov
author_rank: Super Contributor
timestamp: October 24, 2020, 08:05:04 am
content: Quote from: Kjelt on October 24, 2020, 08:00:33 amFrom the same source, I've got corresponding connectors and wire, so I can make my own cables any time I like with any connector polarity and cable length. Again, you get 10x price reduction compared to pre-made cables from typical suppliers. I also sell debuggers that come with those cables, so I need to have that anyway.Sometimes the pricing of the readily accessible cables makes no sense at all. There are cases when it is cheaper to buy a dev. kit that includes the cable than to buy the cable alone.That being said, I have not really worn any of the cables I have. And I do quite a bit of switching between the boards.

author: S. Petrukhin
author_rank: Super Contributor
timestamp: October 24, 2020, 02:13:16 pm
content: Quote from: ataradov on October 24, 2020, 07:32:31 amI was trying to find a needle-like spring-loaded plug that could somehow be securely attached to the board when plugged in.In production, this is easy when the board is fixed in bed -just put your fingers down.But I haven't managed to implement this connection in the fields yet. Something like a magnetic USB I want to use.

author: ataradov
author_rank: Super Contributor
timestamp: October 24, 2020, 05:10:25 pm
content: Quote from: S. Petrukhin on October 24, 2020, 02:13:16 pmYou are describing Tag-Connect system.But I personally see no use for the Tag-Connect It blows up your board space requirements and does not really add anything.For development, I just rather plug in a real connector. For production you will use a bed of nails. Or if you are doing manual programming, just hold the through hole connector on the holes.

author: cgroen
author_rank: Unknown
timestamp: October 24, 2020, 05:23:38 pm
content: I use Tag-connect for everything I make. I use the "no legs" version, using SWD and SWO also.Compared to (in this case a 2x6 pin 0.05" header, the space saving is significant)For prototyping, there is a small "lock" you push on the pins on the back of the PCB, this will keep the TAG connect probe for weeks. I also use it for programming finished boards (if low(er) quantities).

author: ataradov
author_rank: Super Contributor
timestamp: October 24, 2020, 05:31:07 pm
content: But if you compare it to the though hole 2x5 standard connector, then it is the same area as you 6 pin Tag-Connect. You still have to drill holes for the Tag-Connect, so the advantage of the SMT connector is not really there anyway.And the connector thing from the Tag-Connect is huge and always gets in a way and applies leverage to the board.The only times I had to use them is when customer's boards used them, and every time it was a pan in the rear.I really don't get them.

author: cgroen
author_rank: Unknown
timestamp: October 24, 2020, 05:37:50 pm
content: Quote from: ataradov on October 24, 2020, 05:31:07 pmWe use only SMD whenever possible. The "lock" for "permanently" attaching the probe is super small, 4.5 x 11 mm. No problem for us and we avoid a through hole footprint

author: Kjelt
author_rank: Super Contributor
timestamp: October 24, 2020, 07:04:28 pm
content: Quote from: ataradov on October 24, 2020, 05:31:07 pmThe only advantage is that it is assymmetrical, you can not connect it the wrong way around as you can with the 2x5 idc connector.But I also prefer the 5x2 idc because there are multiple (cheap) suppliers.

author: blueduck577
author_rank: Newbie
timestamp: October 24, 2020, 07:08:30 pm
content: If you don't need the virtual COM port on the STDC14 connector, I would recommend just using the standard ARM 10-pin connector. Fitting the 14-pin connector prevents you from using 10-pin cables. If you use the 10-pin Samtec header FTSH-105-01-L-DV-K-A-TR, you can still plug in the 14-pin cable from the ST Link and use it no problem but also remain compatible with debuggers using the 10-pin standard.

author: Harjit
author_rank: Regular Contributor
timestamp: October 24, 2020, 09:13:20 pm
content: Quote from: cgroen on October 24, 2020, 05:37:50 pmCan you provide more details about what we are looking at?I see two pins protruding up. Are those the two signal pins? Aren't they too close and will short?I see a hole with a pin pushed (from the bottom). What is that about. Looks interesting how it is holding the board.Thanks!

author: cgroen
author_rank: Unknown
timestamp: October 24, 2020, 09:15:05 pm
content: Quote from: Harjit on October 24, 2020, 09:13:20 pmHave a look here:https://www.tag-connect.com/product/tc2030-ctx-nl-6-pin-no-legs-cable-with-10-pin-micro-connector-for-cortex-processors

author: S. Petrukhin
author_rank: Super Contributor
timestamp: October 24, 2020, 09:17:00 pm
content: Quote from: ataradov on October 24, 2020, 05:10:25 pmThank you! I didn't know what this type was called. It's also obscenely expensive. It doesn't really provide anything more than inexpensive pins, but it requires the entire board to have an immersion gold coating - this is very expensive. Another one drawback - exposure to the appearance of puddles of condensate. My devices work in the atmosphere, I varnish them.Unfortunately, it is not possible to find the opposite part of the connector for magnetic USB yet, and this would be good, it looks very convenient, but it is not clear how the polarity is provided.

author: Harjit
author_rank: Regular Contributor
timestamp: October 24, 2020, 09:22:58 pm
content: A neat scheme I saw was where someone had put pads on the edge of the board and then 3D printed a "clothespin" to attach the pins. The pins were test pins used for bed of nails testing.The tag connect is a nice scheme but a little pricey.

author: cgroen
author_rank: Unknown
timestamp: October 24, 2020, 09:24:51 pm
content: Quote from: Harjit on October 24, 2020, 09:22:58 pmWell, pricey or not, you only need 1 cable, the cost pr PCB is exactly 0

author: Dubbie
author_rank: Unknown
timestamp: October 24, 2020, 09:56:53 pm
content: I also use tag connect 6 pin on all my boards. Works great. Is very small and is one less component to buy place and solder. I have done a couple of boards where I have the tag connect on the bottom of the board for access when I have the board mounted in place. It’s nice that when you remove the plug, it is zero height. Important for small compact designs.

author: Kjelt
author_rank: Super Contributor
timestamp: October 24, 2020, 10:57:22 pm
content: Quote from: cgroen on October 24, 2020, 09:24:51 pmIf you always have an ENIG surface finish yes but I never do, always HASL for me.

author: ataradov
author_rank: Super Contributor
timestamp: October 24, 2020, 11:00:06 pm
content: Tag connect works fine on HASL.I'm not sure what you all are doing with your debug connectors. I use them while developing the firmware. If connector somehow wears out in that time, you should reconsider your development times.

author: S. Petrukhin
author_rank: Super Contributor
timestamp: October 25, 2020, 12:08:50 am
content: Quote from: ataradov on October 24, 2020, 11:00:06 pmNot necessarily programming. I am installing a diagnostic/console connector, it may be required in a year or several. I don't trust naked HASL - it's friendly with corrosion.

author: ataradov
author_rank: Super Contributor
timestamp: October 25, 2020, 12:10:48 am
content: Quote from: S. Petrukhin on October 25, 2020, 12:08:50 amYeah, but for this kind of stuff you are better off with more protected connectors anyway.Tag-Connect is too fragile for field work anyway. It is only really suitable for bench use.