2020-11-28 08:21 PM
Hello Everyone,
I am working on a project in which i have to use both roles of USB_FS. I want to interface mass storage device for which i need host with MSC and i also want to send some data to PC over VCP for which I need device with VCP.I searched a lot but not found any example of USB_FS switch roles dynamically. So can you tell me how to do this or share some examples if have.
One more question can I do both of these tasks using USB host only? Can I connect to PC using USB host CDC class?
Thanks
Solved! Go to Solution.
2020-12-02 12:23 AM
I don't know and I don't care, I don't use Cube and I don't use OTG.
The OTG hardware "support" is barely more than just an interrupt upon the ID pin. The switchover has to be performed in software in the same way as described above.
There is an older USB library available on st.com for the F2/F4, based on the already deprecated SPL, which supported OTG, but it's written in a way very different from Cube.
JW
2020-11-29 02:02 AM
Which STM32?
> Can I connect to PC using USB host CDC class?
No.
You have to stop the software stack in one mode, switch mode, then start the whole stack of the other mode. I don't use Cube, but there probably will be related xxxDeinit() and xxxInit() functions for this. If there are separate ISRs for the two modes, simply write a simple switcher to the real ISR to call the appropriate one of them.
JW
2020-12-01 07:46 PM
Thanks @Community member for your suggestion.
I am using ST32F746ZG MCU. One thing comes to my mind if stm32f7 supports the OTG function then why there is no example in cube package of F7?
Harwinder
2020-12-02 12:23 AM
I don't know and I don't care, I don't use Cube and I don't use OTG.
The OTG hardware "support" is barely more than just an interrupt upon the ID pin. The switchover has to be performed in software in the same way as described above.
There is an older USB library available on st.com for the F2/F4, based on the already deprecated SPL, which supported OTG, but it's written in a way very different from Cube.
JW