USB controlled stepper motor board works from laptop but not desktop?   - Page 1
Forum section: electronics / projects

author: frmdstryr
author_rank: Contributor
timestamp: January 10, 2024, 02:33:12 pm
content: I'm working on a DIY pick and place machine (mainly for learning/something to tinker with) and designed a small control board for the head that has 6 stepper motor drivers and a single mcu that communicates over USB serial.The board works fine when I control it from my laptop, but when try it from the machines desktop pc the USB connection becomes unresponsive as soon as I apply power to the motor supply.I imagine it's some sort of ground loop / noise causing interference with the usb lines but cannot figure out how to fix or even debug it.... what's more odd is I have another board to control the vacuum pump & valves that runs off the same power supply and has the same usb design and that works fine.The board has separate traces for the motor power pins (see large traces on bottom) and the digital gnd and motor supply V- are connected by a small net tie trace to the right of the M6H connector. The usb shield is directly connected to the usb ground. It's a 4 layer board with 3 ground planes (inner 2 is 3.3V). The usb D+ / D- are routed next to each other and have a solid plane ground below.I tried:- shorter power cables- floating the DC supply (disconnect the link from dc - to gnd)- shorter usb cable- different usb ports / unplugging all other usb devices- adding extra ground wire from the board mount chassis to the pcI've been reading USB layout guidelines and some suggest adding a ferrite between the usb shield and gnd and inline with vbus (with a 10nF into gnd on each) but not sure if that will help?I was also thinking of trying to cut the net tie but not sure if that's a good idea.I ordered a USB isolator to try but have hit a wall as to how to properly fix it...Any suggestions?

author: MuhScopeBroke
author_rank: Contributor
timestamp: January 10, 2024, 03:05:16 pm
content: If you can get access to an oscilloscope, probing the data lines on the USB would be very very valuable. Hard to say what it could be though, cool project!

author: frmdstryr
author_rank: Contributor
timestamp: January 10, 2024, 03:46:38 pm
content: Well maybe it is a firmware problem or something. Communication stops working after I turn the psu on but I still see usb frames.With the power supply on if I try to un-plug and re-plug it in it does not enumerate.The data line traces look okay to me, a little noise after the ps is on.

author: frmdstryr
author_rank: Contributor
timestamp: January 10, 2024, 04:13:21 pm
content: It looks like there is a difference with the supply on on the vbus line.

author: wraper
author_rank: Unknown
timestamp: January 10, 2024, 04:35:20 pm
content: Why no MCU/USB schematic? Besides quite poor USB arrangement next to the stepper driver, via stitching is really really poor. You put some stepper driver related circuit and crystal oscillator on a single ground polygon on the top layer and then connect it to the large GND plane on the bottom with just a single via. Like really, no concern about injecting noise from the stepper driver directly into sensitive oscillator circuit? It would not surprise me if USB communication fails due to clock instability and one USB host may be more sensitive to that than other. Decoupling capacitors are not better. Your board should have at least 20x more GND via stitching and you should not mix together stepper and MCU ground polygons on top layer. Connect all GND return paths to GND plane on the bottom as close as possible to the component terminals, not a mile away by a single via for everything. Because solid polygon on the bottom becomes pretty useless if you screw up all GND return paths on the top.

author: frmdstryr
author_rank: Contributor
timestamp: January 10, 2024, 04:38:50 pm
content: Sorry here is the mcu and usb schematic (this is slightly revised, I don't have the original one, I added the ferrite and caps on the usb connector).

author: Siwastaja
author_rank: Super Contributor
timestamp: January 10, 2024, 04:45:35 pm
content: Yeah, forgetting the vias seems quite a big deal here. All those SMD parts which connect to GND form long loops.

author: wraper
author_rank: Unknown
timestamp: January 10, 2024, 04:50:06 pm
content: Throw out FB1 and CFB1 and connect micro USB connector shield directly to the bottom ground plane at all 4 shell terminals. AFAIK older USB standards did not describe it that clearly but newer USB-C demands it outright. This commonly made USB shield interruption nonsense propagated through many papers may be not that harmful in non noisy circuits but is a direct path to failure with anything motor related. TLV75733 requires at least 1uF MLCC right next to its output.

author: frmdstryr
author_rank: Contributor
timestamp: January 10, 2024, 05:14:02 pm
content: Thanks for all the feedback! Should FB2 and CFB2 remain or is it better to not use those at all?I pulled out the logic analyzer and it looks like the host is repeatedly sending the first setup packet like it's never getting the ack or something.

author: coromonadalix
author_rank: Super Contributor
timestamp: January 10, 2024, 05:45:32 pm
content: could the usb interface drop communication with current consumption on the stepper motors, some voltages / drops / swings ??

author: Siwastaja
author_rank: Super Contributor
timestamp: January 10, 2024, 05:51:48 pm
content: Everything wraper said.I would drop FB2, CFB2 too. They could be helpful in some cases but just slapped in randomly are more likely to worsen than help; the FB possibly saturates anyway, and if not lossy enough you can create a resonance which amplifies some unlucky frequency. A relatively safe way to add power filtration is an electrolytic capacitor (e.g. 100µF for such small interface board), because it has significant damping ESR.Generally:* Contiguous ground planes, no splits* Direct, short connections, never ferrite beads on ground net* Local MLCC bypass caps near consumer ICs, all same part number per one power rail, smallest physical package (and largest capacitance value you can get in that package, but this is secondary as long as it's big enough. e.g. 0.22µF 0402 or 1µF 0402, doesn't matter. Classic 0.1µF works but is on the low side). Definitely no "parallel different sizes" BS.* One electrolytic cap at board power inputTurns out good practices also happen to be simpler and cheaper!

author: frmdstryr
author_rank: Contributor
timestamp: January 10, 2024, 06:15:46 pm
content: There's a separate enable line (& command) to actually turn on the motors. It drops communication before I can even turn the motors on...

author: wraper
author_rank: Unknown
timestamp: January 10, 2024, 07:33:54 pm
content: Quote from: frmdstryr on January 10, 2024, 05:14:02 pmNo harm in those. I'd leave ferrite bead, probably not cap.

author: Ice-Tea
author_rank: Super Contributor
timestamp: January 10, 2024, 07:51:44 pm
content: 2V VBUS?

author: frmdstryr
author_rank: Contributor
timestamp: January 10, 2024, 08:59:32 pm
content: I don't have a good way to measure usb lines. Does someone sell a splitter board or something?I tore apart some otg cable I had laying around and soldered some pins on it... I had the ground clips on the usb plug from that board instead of the control board.I moved the ground clips to the usb housing on the control board and clamp on the VIN pin of the swd header, it reads 5.127V. I can post new screenshots but data lines look the same and VIN is just flat.Edit: I think I'm just going to add a bunch of vias and a 1uF on the regulator output and try a new board.

author: frmdstryr
author_rank: Contributor
timestamp: January 10, 2024, 10:33:23 pm
content: I noticed that when the power supply is on the voltage on the the yellow data - increases by 0.5V.It does the same thing with my laptop, though.. The bus voltage when plugged into my laptop is slightly higher (5.297V).

author: frmdstryr
author_rank: Contributor
timestamp: January 10, 2024, 10:50:34 pm
content: I plugged it into a usb hub, now it works.Maybe noise was being interpreted as a usb high speed chirp? IDK