I have designed the following optoisolator for SWD interfacing with an STM32 device and J-LINK programmer:

This is the generic schematic: enter image description here

And this is a single optoisolator schematic: enter image description here

I am not able to interface with the board in the J-Link commander. I see that J-Links attempts to reset the device but fails to communicate. Is there any basic flaw in my design? Can the bidirectional SWDIO line be the case? I would appreciate all help.

  • 2
    \$\begingroup\$ Out is inverted from In . Is that OK? \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Mar 12 '18 at 15:02
  • \$\begingroup\$ Yes. When LED is ON, the out is LOW. When LED is off, out is high. \$\endgroup\$ – Łukasz Przeniosło Mar 12 '18 at 16:23
  • \$\begingroup\$ Please explain the resistor values. (All of them appear to be too low.) \$\endgroup\$ – CL. Mar 12 '18 at 17:53
  • \$\begingroup\$ R3 is the closesest one for 10 mA LED current. R5 is from datasheet test circuit design. R1 and R2 are the same as R3, just to have them at hand. I did not want to force any high instantaneous current on the bidirectional patch. Do you have any idea what could be the case? \$\endgroup\$ – Łukasz Przeniosło Mar 12 '18 at 17:54
  • \$\begingroup\$ What do you see on the STM32 side on SWDIO? You should see the switching sequence, and a target ID read, followed by an ACK (1+3+1 bits), 32 bits data and parity. This much progress occurs mastered by the J-link, and the ID read needs to be seen to show the target is present. \$\endgroup\$ – Sean Houlihane Mar 26 '18 at 20:19

Yes, you're right X5 and X6 are making a positive feedback loop. You need a bidirectional optoisolator for SWDIO line. For speeds up to 1 Mhz you can find guidance in this NXP Application note. You also need to see if the 160 ns delay induced by the optocouplers (2x80ns,forward path + backward path) is acceptable for the programmer. You might want to change the point of view and insulate the USB side of the programmer with a device like USB ISO form Olimex

|improve this answer|||||
  • \$\begingroup\$ Thanks for answer. I ended up using Si8605 eventually. Simplified the whole design. \$\endgroup\$ – Łukasz Przeniosło Apr 2 '18 at 8:21
  • \$\begingroup\$ Good to know. I didn't know if it's a one time solution for a particular issue or a product that you want to sell having cost constraints. For a one time design USB ISO interface is much expensive but gets the maximum speed from the programmer. The opto or Si8605 add some delays in the signals. \$\endgroup\$ – Dorian Apr 2 '18 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.