Debug of "on-line" mains referenced MCU - Page 1
Forum section: electronics / general

author: uer166
author_rank: Super Contributor
timestamp: November 17, 2022, 08:51:50 pm
content: I have a project coming up where the logic parts (incl. STM32) are sitting on Cat 3 230V/400V mains in field. For lab work/debug off of a cat 1 AC source, I think the ST-link isolated hat would work pretty well due to 300V basic insulation:https://www.st.com/en/development-tools/b-stlink-isol.html.One thing that I worry about is the common interface for regular ST-link vs isolated. If a clue-less person plugs in the regular ST-link into this device, they'll be in for a surprise! Has anyone dealt with on-line or otherwise HV-referenced micros, and the challenges of debugging over SWD and a UART? Any ideas are welcome.

author: harerod
author_rank: Frequent Contributor
timestamp: November 17, 2022, 09:22:00 pm
content: Protect the users from themselves - use a proprietary connector.One client build a box with the programmer inside, which had the cable with the proprietary connector dangling from it.Don't forget to cover your own behind by sticking a ton of appropriate warning labels on the device and the programmer.

author: uer166
author_rank: Super Contributor
timestamp: November 17, 2022, 09:31:22 pm
content: Quote from: harerod on November 17, 2022, 09:22:00 pmThis would be inaccessible/sealed away to any end-user. This is for fellow engineers. Proprietary connector is wise, however, it essentially makes it an inherently controlled component. The issue with the solution here though is that the isolated ST-Link itself has a "normal" header connector, so one can always swap that bit and get hurt regardless.

author: Phoenix
author_rank: Frequent Contributor
timestamp: November 18, 2022, 12:11:26 am
content: Quote from: uer166 on November 17, 2022, 08:51:50 pmAll the time in large power converters. I don't debug a live system over JTAG - any minor slip and it blows up!How about only a UART debug terminal, then you just need to isolate TX and RX?

author: uer166
author_rank: Super Contributor
timestamp: November 18, 2022, 12:30:32 am
content: Quote from: Phoenix on November 18, 2022, 12:11:26 amYeah UART is a given. One option is to flash the boards during ICT and do the rest closed-box. The problem is that still adds cost and external isolation (whether it's UART or SWD or both) would be better. Another issue is I'm not sure if ST-link will have enough power (if any) to provide to the device to flash it. If not, it pretty much requires the thing to be connected to HV since it's a 400V 3 phase supply.

author: harerod
author_rank: Frequent Contributor
timestamp: November 18, 2022, 08:37:50 am
content: Quote from: uer166 on November 17, 2022, 09:31:22 pmWell, even a fellow engineer is a user, if he behaves like one. More importantly, when you partially quoted me, you left out this part:"One client build a box with the programmer inside, which had the cable with the proprietary connector dangling from it."This was exactly to cover the point of providing a specific debug/service tool. The manual then states "only debug/service with original service tool".@Phoenix: well, sometimes there are things that require JTAG. A pretty uneasy situation, but it does happen. However, this should be restricted to development. Then the cost for a specific communication adapter shouldn't be an issue.For several reasons I'd also prefer RS232 or Ethernet for service.

author: woofy
author_rank: Frequent Contributor
timestamp: November 18, 2022, 09:52:59 am
content: Quote from: uer166 on November 17, 2022, 08:51:50 pmI would not allow this at all in my workplace.Use an isolating transformer and make certain the micro is grounded.

author: paulca
author_rank: Super Contributor
timestamp: November 18, 2022, 10:05:09 am
content: Stick an OTA module on the board with it. Never touch it again.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 18, 2022, 10:14:53 am
content: Put the ST-Link in the box and wire it with a USB isolator?Tim