Here is a short description of my system. I have a power management IC that notifies the MCU about presence of a USB host device (when the device is connected to computer). There is a UART to USB converter from FTDI in between of MCU and ADG787 which is USB powered. In short, when the MCU is informed about the presence of computer, it initiates the UART module, powers up the system voltage from 1.8V to 3.1V (to be compatible with VCCIO of FTDI chip), it powers up the switch through a 5V voltage bosster (before this time the swithc is off) and finally puts the switch in the condition that is connected to FTDI converter.
Everything works 90% of the time. But sometimes the USB is not detected by the computer. The MCU although, continues to works as expected in these conditions. I know that with no schematic it might be hard to comment on it, but it's pretty much what I explained above, with some protection components (ESD diodes, resistors) for USB paths. Do you have any idea what might cause this? Does the above sequence have any problem? Should I always keep the switch powered?
It sounds like you may have a problem with the sequencing of the power supplies. The switch needs to be powered up before any signals can be passed through it. So to be sure the switch is working correctly you need to have the supply voltages present before any signal. Always keeping the switch powered up is one way to ensure this happens.