Are you using the USB cable that Sony supplies for charging the DS4? They are of notoriously low quality and tend to fail increasingly over time. It's not noticeable when merely charging, as an interruption of electrical current simply delays the charge momentarily, but interrupting the data flowing to/from the XIM is much more of a problem.
If you are, I would suggest trying another cable. If possible, try one you have lying around, and if it works better, then you know it's the cable and can, perhaps, budget for a new one. (I usually discourage buying new ones just to test the theory, but obviously that'd be your call to make.)