2024-09-17 10:59 PM
Hello everyone,
I’m working on a project with the STM32H503 microcontroller and need to implement USB Type-C connection detection using FreeRTOS. Specifically,
I have come across several examples that utilize Azure RTOS ThreadX environment with nucleo STM32H503 , but I have some question in my mind ,I'm using RTOS already with my application now I want to add USB support also so azure RTOS stack will not work with my FreeRTOS, but I’m looking for guidance on how to implement this using FreeRTOS.
Any insights or examples would be greatly appreciated!
Thank you!
2024-09-17 11:32 PM
Ive had a similar problem.
Solved it by using an external USB-C PHY (TUSB320), configured it with the strapping pins to default to UPF for the USB-Bootloader. Then reconfigured it through I2C during runtime for whatever i needed.
The PHY had an output pin that went low if a register was changed (ie if the USB connection state was changed).
I simply set a RTOS flag from the interrupt that notified the rest of the system that the USB-state had been changed.
Then the appropriate task could fetch the register content from the PHY to figure out what type of device was attached (DFP/UFP) and proceed from there.
Not sure if its the best approach but it has worked well for me!
2024-09-18 03:01 AM
Hey ,
thankyou for reply ,
just for the curiosity why they directly jumped into direct auzre RTOS ?
2024-09-18 08:23 AM
Hi @himani
Maybe an alternative for you could be to use a STM32H562 or 563 or 573 (instead of STM32H503).
STM32H56x/57x embeds a UCPD peripheral able to manage USB Type-C/USB Power Delivery connections.
You could also find in STM32Cube H5 package available on st.com or Github, some applications running on STM32H573 Nucleo boards, illustrating use of this feature, either in a USB TypeC only context (no USB Power Delivery) or with support of USB Power Deliver protocol over USB Type C connections.
USB Data + USB Type-C only applications : here.
USB Power Delivery applications : here
Regards
2024-09-18 10:01 AM
Hello
As only TypeC is required here, we can propose stusb1600 as TypeC controller.
It can be connected to stm32H7 thru I2C.
STUSB1600 can be 'DRP'.
If specific role is needed, I can propose some other parts.
Best regards,
2024-09-19 02:13 AM
Hello Himani,
To implement USB Type-C connection detection using FreeRTOS with a STM32H5, you need :
A basic USB-C PHY is not enough because missing ESD / Over Voltage Protection on CC lines.
ST proposition value is to integrate all needed parts.
They are two cases for USB-C Power Delivery with STM32:
Best regards,
Mathieu