I have an Arduino that accepts its UART I/O from a wired and a wireless connection. The wired portion is a standard CP2104 USB to UART bridge and the wireless portion is done, for now, through an HC-05 BT module. The two are switched using a MUX/DEMUX scheme in which the USB 5V acts as the select line. When the USB is unplugged, the BT module is turned on. While the USB cable is plugged in, the BT module is turned off. The MCU is used to control 4xTB6600 stepper drivers.
Here is the weird bit: When the motors are plugged in to the drivers, and the USB is unplugged to allow the BT module to take over (when the motors are off and there is no software actively using the USB), the MCU behaves very erratically constantly switching ON and OFF the enable pin (The MCU runs grbl. A video showing this behavior is shown here). This does not happen when the motors are unplugged and it works fine. I'd really appreciate it if anyone can help me understand why this is happening and give me some ideas on making this work.