When you are connecting two devices via USB, where each device has implemented the USB DRP (Dual Role Port), how is it decided, for this connection, which device will be the Host and which will be the Peripheral?
The mechanism works by signaling through the CC lines. Both sides will have a USB-C controller which will have a default function defined (host or peripheral). When connection occurs the two controllers will alternate the CC lines trying to pretend as host, then as device, and so forth.
If two DRP devices are connected and they are both configured to be a master, they will both try to pretend as host, then as device and the way they end up is going to be random depending on timing of the plug-in moment vs internal controller timing.
Thank you! I knew about the alternation on the CC lines but I didn’t know you can configure a default role. That explains a lot.
When you connect two devices but configured the same way, is there a way you can influence which one will end up configured as which during the connection?
There are USB-C controllers which support mode change via internal registers but I wouldn’t say that means you can influence which one will end up configured as which during the initial connection. That part remains valid as described in my first reply. But I would say that after the initial negotiation you can change the role if your controller supports the feature.
I would suggest you read the datasheet and eval board description for something like the STUSB1600 or any other similar controller. It will give you great insight into how these things work.
Thank you very much!