SWD over TRRS 3.5mm jack with +5V power, what pins would be best? - Page 1
Forum section: electronics / projects

author: tonyp12
author_rank: Contributor
timestamp: August 19, 2023, 11:39:25 pm
content: Telling user to no turn anything on until cable is plugged not always going to be followed.As the TRR touches all connectors while moving in out, what would be best order?Though it can be bus-powered by the cable, there may already be +5V from the system on the pin.Would you do this? , I saw a USB cable using this arrangement for power and ground, each step you pull connector out.1: SWIO > +5V > SWCLK > GND2: +5V > SWCLK > GND > no connect3: SWCLK > to GND > no connect4: GND > no connectIf GND is removed first, is the other 3 pins not just floating?

author: NiHaoMike
author_rank: Super Contributor
timestamp: August 20, 2023, 12:45:11 pm
content: The old iPod Shuffle uses pin 4 for 5V and pin 3 for ground. Use a diode in the device so that only the cable has a connection to voltage.https://pinoutguide.com/PortableDevices/ipod_shuffle_pinout.shtml

author: DavidAlfa
author_rank: Super Contributor
timestamp: August 20, 2023, 12:56:31 pm
content: Is it a new design? Why not use "Service port" USB-C conector? D+ and D- are 3.3V spec, so no problem with SWD.Definitely, it would be much better if you remove the 5v from it.

author: tonyp12
author_rank: Contributor
timestamp: August 20, 2023, 02:03:11 pm
content: I could remove +5V and use it as reset pin instead,but would force user to use the usb-c port as power source.Found the Automotive AUX port pinout for when in USB mode.But as in my case the Sleeve on the female connector may have +5V at all times, unlike a USB-A that don't get reverse current.so when you slide out the 3.5mm plug the ground connection from LinkeE debugger will touch the Sleeve's +5V.There are 500mA current limiters on all power sources, but seems not professional to allow them to override a short

author: DavidAlfa
author_rank: Super Contributor
timestamp: August 20, 2023, 02:11:41 pm
content: Forcing the user to use a supercommon, standarized USB-C cable?Instead that much weirder usb-jack cable?

author: tonyp12
author_rank: Contributor
timestamp: August 20, 2023, 02:23:51 pm
content: The cartridge has USB-C port, but may be occupied.I like standalone self-powering whenever possible, one cable.Use a second c-connector for SWD debugging?,but as it also is to be used as general GPIO, a TRRS connector seems more DIY friendly.Use a a nmos to discount the LinkeE's gound pin when it detects that it's getting +5V?Don't like to use diodes do to the 0.3V drop.

author: DavidAlfa
author_rank: Super Contributor
timestamp: August 20, 2023, 02:26:15 pm
content: Sorry I have no idea what are you referring to.Is it a product you're designing? Or what?Because in that context, there's no difference to the user between using a UsbA-jack or UsbA-C.However the USB-C cable will be available everywhere.Quote from: tonyp12 on August 20, 2023, 02:23:51 pmYes. Just like some devices, having a "Service port".Plugging in a normal USB won't work, but also won't damage anything.If space is a problem, you can get them in angled, vertical configuration:https://www.aliexpress.com/item/4001338340686.html

author: tonyp12
author_rank: Contributor
timestamp: August 20, 2023, 02:36:08 pm
content: Yes it's a product I'm designing, a C64 Cartridge.80% of users will probably only use the USB bootloader, to upload firmware updates,but 20% will get the debugger package.That the LinkE connects directly to the USB port I'm not a fan of,so instead of including a USB extension cable, I was think making a 10pinheader-TRRS adapter and include a 1meter TRRS cable.

author: DavidAlfa
author_rank: Super Contributor
timestamp: August 20, 2023, 02:41:47 pm
content: I see!Well, these are some configurations used comercially:The safest seems the one connecting VCC to the last last ring.

author: DavidAlfa
author_rank: Super Contributor
timestamp: August 20, 2023, 03:05:25 pm
content: Get connector with a tip switch, they're pretty common. A small a fet will prevent the power from accidentally getting out.The fet turns on only when the tip is fully inserted so the body diode is bypassed.Some 100R values should protect the insides while not affecting the SWD interface , also there's no possibility of reverse polarity.

author: tonyp12
author_rank: Contributor
timestamp: August 20, 2023, 04:22:58 pm
content: It has to be SMD, it has to be from jlcpcb/lcsc.At 3x the cost, though reasonable 15cents the: PJ-316A-6AGot dual disconnect pins.

author: DavidAlfa
author_rank: Super Contributor
timestamp: August 20, 2023, 04:45:11 pm
content: It's just an example. There trillions of 3.5mm jack connectors.Actually you could skip the fet anyways, it's only useful if some idiot plugs a headphone there.

author: tonyp12
author_rank: Contributor
timestamp: August 21, 2023, 11:44:58 pm
content: But you forgot that if the tip is 5V, it still gets power from the debugger, so it will touch ground sleeve on its way out.So sticking with sleeve is 5V and put a diode on the debugger was my ideaBut solely powered by the debugger don't work, 0mA through the 2K resistor, but that that was the requirement for adding 5V to the TRRS

author: janoc
author_rank: Super Contributor
timestamp: August 22, 2023, 10:17:11 am
content: If it is something you are designing new, then don't mess with stupid TRS connectors or repurposing USB connectors of any kind - terrible idea because someone somewhere is guaranteed to plug something into it that won't like the signals you are putting on those pins and trouble happens. E.g. hooks up a USB-C cable not realizing the other end is still connected to a phone charger or a PC. Poof, you have 5V where you don't want them.What's wrong with a normal SWD pin header, potentially under a cover? Either clip-on cover or even requiring to take the shell of the cart apart if you don't want to have this exposed. Moreover, header allows you to expose other useful signals too, not just SWDIO/SWDCLK/GND - e.g. power, reset, SWO, maybe UART ... If you don't have space for a full sized 0.1" header then a small 0.05" one is pretty comparable in size to the USB or TRS connectors.You can even go for a Tag Connect or one of the alternatives described here:https://bitvolatile.com/?p=415- basically zero cost solutions not requiring any actual connector on the board, only a footprint.If someone needs this functionality, they likely have some sort of SWD dongle too - and none of those use USB-C for connecting the signals but pin headers/IDC connectors instead. So having to keep around that one special cable that came with the cartridge or having to hack a non-standard cable just to hook up the debug dongle is dumb and won't get you any love from your customers.TL;DR: Don't do that.

author: NiHaoMike
author_rank: Super Contributor
timestamp: August 23, 2023, 03:20:30 am
content: One could mechanically interlock the connectors by placing them very close to each other, such that having a cable plugged into one blocks the other. You could go a step further and have a sliding shutter to enforce it even with aftermarket cables.

author: janoc
author_rank: Super Contributor
timestamp: August 25, 2023, 03:45:06 pm
content: Quote from: NiHaoMike on August 23, 2023, 03:20:30 amThat's a complicated solution that does nothing against people plugging in USB device into a port that only looks like USB but isn't, potentially causing problems.

author: NiHaoMike
author_rank: Super Contributor
timestamp: August 26, 2023, 02:09:06 am
content: Wasn't the original problem that there's a USB connector for USB and a 3.5mm connector for debug? And that for simplicity of implementation, the 5V on both connectors is paralleled?

author: janoc
author_rank: Super Contributor
timestamp: August 26, 2023, 10:35:44 am
content: Quote from: NiHaoMike on August 26, 2023, 02:09:06 amNo, read OPs posts at the start of thread.https://www.eevblog.com/forum/projects/swd-over-trrs-3-5mm-jack-with-5v-power-what-pins-would-be-best/msg5020708/#msg5020708It is something he is designing from scratch. So there is no reason to use a TRS jack or USB connector for SWD like he wanted to do or what was suggested by some people later.