2019-10-18 06:13 AM
Hey guys,
I would like to use the TUSB320 USB-C controller with I2C to detect my STM32F4 as a device. Does anyone of you have implemented it already and would share the code? Right now I am not sure where to start.
Does the implementation go before MX_USB_DEVICE_Init();? Is there anything in the HAL USB library that needs to be adapted?
Thanks guys!
2019-10-18 07:52 AM
> I would like to use the TUSB320 USB-C controller with I2C to detect my STM32F4 as a device.
Elaborate. Draw a block schematics, how do you have TUSB320 connected to STM32F4. Explain the expected funcitonality.
JW
2019-10-19 02:38 AM
Thanks for your reply @Community member !
Thats the way it is connected. SDA and SCL goes to I2C3 of the STMF401RE. The expected functionality is that when I plug the USB-C connector in the USB-C interface of my computer that it gets detected automatically through CC1 and CC2. It shall run as a device with all "default settings", I dont need anything special since I just want to use it for communication. The STM32F4 is powered through VBUS and I already tested it with the use of an USB-C to USB-A connector. Everything works, but when I plug it into the USB-C port of my computer nothing happens. How do I have to set up the TUSB320 so that my computer recognize the STM32? Like you see I am pretty new to USB-C communication.
2019-10-19 04:39 AM
USB does not communicate through CC1/CC2 but through DP/DM. Do you have them connected to the USB-C connector (both sides)?
JW
2019-10-19 04:59 AM
@Community member
I know that it communicates through DP/DM, but CC1/CC2 is used to set up the connection (tell the host(my computer) that the STM32 is acting like a device...stuff like that), isnt it?
What and when does the TUSB320 needs to transmit that my computers usb-c port will recognize the STM32 as a usb-c device?
I am using the STM32 as a USB CDC device, and its working when I connect it with my computer over a USB-C to USB-A adapter and plug the A side into my computer but it does not get recognized when I plug it into my USB-C port (without any adapter in between).
Attached is my usb-c connector.
2019-10-19 05:00 AM
Pin A6 is DP and A7 is DM.
2019-10-19 09:53 AM
I am not looking into the standard now, but basically a device does not need to communicate through CC1/CC2 for the basic functionality; all it needs is to connect a certain value pulldown (5.1kOhm IIRC). The TUSB320 probably already has that in place by default, check in its DS.
Note, that there are several types of USB-C cables around, both by standard and by folks usually ignoring the standard, and I know of "charge-only" cables which don't have any of the data wires inside.
JW
2019-10-19 01:31 PM
"a device does not need to communicate through CC1/CC2 for the basic functionality;"
Yeah, I was thinking the same that's why I wondered that it doesnt get recognized by the computer. However, I will check it again next week and might come back to you.
Again, thanks a lot!