‎2019-03-12 03:54 AM
I'm trying to understand how I can use a USB Type-C connector together with the STM32MP1 USB OTG peripheral.
So obviously I want to use the port in dual role configuration. I want to use the STUSB1600 for that because it takes care of the power source/sink control for me. But I do wonder how should I connect the OTG_ID pin (if at all) in the STM32MP1, should it be to the ATTACH pin of the STUSB1600? The eval and DK only use the micro connectors for OTG.
I have found AN4775 and figure 9 (attached) explains how to use Type-C with OTG, but I'm not sure if that applies with the STUSB1600 because it takes care of the CC pins for me.
So if someone could please help with figuring out dual role with Type-C connector, please.
Solved! Go to Solution.
‎2019-03-18 03:20 AM
STUSB1600 Linux driver is being written. For the moment, it is really basic and allows to configure STUSB1600 (power role, power operation mode). And Type-C connector is forced to Peripheral role on DK, Host role use cases can be done with Type-A connectors.
Interrupt support is under development: STUSB1600 raises an interrupt on attach/detach and knows the current role. With 4.19 Linux kernel, it can use extcon to send attach/detach events with current role. USB role switch class with notifier could be used with next Linux kernel version.
OTG driver has to register to these notifications to switch role (as if it was receiving a pin ID change interrupt).
All these developments are in progress.
‎2019-03-12 07:46 AM
‎2019-03-14 03:48 AM
By USB standard, OTG protocols are not supported over USB Type-C connector, so STM32MP1 ID pin is useless and VBUS pin management is handled by STUSB1600.
Type-C DRD (Dual Role Data) could be stated as the OTG equivalence when using Type-C connector. See usb.org or wikipedia for some general information.
Please have a look to STM32MP157C-DK2 board schematics (page 6) for an example of connection of STM32MP1 OTG IP with STUSB1600 supporting DRD/DRP (although power sink is open in that example as we supply the board 5V from another connector).
‎2019-03-14 04:59 AM
I see, I was wondering how does the kernel know which role the peripheral should be used in if there is no ID pin but I think I understand now, I looked at the documentation for the chip in the kernel https://github.com/STMicroelectronics/linux/blob/v4.19-stm32mp/Documentation/devicetree/bindings/usb/st%2Ctypec-stusb.txt and the driver will read the current role from the chip over I2C and adjust based on that, making the ID redundant.
Do I understand correctly?
‎2019-03-14 05:43 AM
I have not a good view of related SW aspects, but from HW perspective, the CC lines levels are used to determine if the connected USB peripheral is an host (source) or a device (sink) or else (e.g. charger).
To support DRP in automated way (i.e. allowing to connect an host or a device), I assume that the STUSB1600 should toggle regularly (e.g. few times per seconds) to present itself (on CC lines) as host or device (don't know if the sequence is managed inside STUSB1600 or by SW controls) until CC lines level change is detected.
Then as you see, the role is read by the SW over I2C, and the driver will setup the OTG IP to the right mode to start enumeration.
‎2019-03-18 03:20 AM
STUSB1600 Linux driver is being written. For the moment, it is really basic and allows to configure STUSB1600 (power role, power operation mode). And Type-C connector is forced to Peripheral role on DK, Host role use cases can be done with Type-A connectors.
Interrupt support is under development: STUSB1600 raises an interrupt on attach/detach and knows the current role. With 4.19 Linux kernel, it can use extcon to send attach/detach events with current role. USB role switch class with notifier could be used with next Linux kernel version.
OTG driver has to register to these notifications to switch role (as if it was receiving a pin ID change interrupt).
All these developments are in progress.
‎2019-04-23 03:02 PM
The USB OTG is being replaced by USB Type-C Dual-Role capability.
Pull-up resistor on CC pin --> The application is Power Source & Data Host (DFP).
Pull-down resistor on CC pin --> The application is Power Sink & Data Device (UFP).
‎2019-04-23 03:16 PM
‎2019-04-23 03:17 PM