Simultaneous USB Host and Device

Blog Post created by fillon.nicolas Employee on Feb 23, 2017



I would like to share with you an interesting code.


About the code for simultaneous USB Host and Device.


This is the first version of the code targeting a F446.


But this code gives you the idea what needs to be done.


It shows that there is not issue to run both USB Host and Device at the same time on a STM32F4.


I will send you separately the IAR project supporting MSC Host example and HID Device example running at the same time. the example is functional and tested on the STM32F446E_Eval board. I have tested it as follow:


-          Cube version: STM32Cube_FW_F4_v1.14.0

-          MCU: STM32F446ZET6

-          Board: MB1162 B-01 (eval board)

-          IAR embedded workbench 7.80

-          Port HS: MSC Host

-          Port FS: HID Device


How to use:

  1.        Please unzip the zip file under “./STM32Cube_FW_F4_V1.14.0\Projects\STM32446E_EVAL\Applications\USB_Host”

                                Or under                                        “./STM32Cube_FW_F4_V1.14.0\Projects\STM32446E_EVAL\Applications\USB_Device”


  1.        Compile and Run the code
  2.         Plug the FS port to your PC, it will enumerate as a HID mouse, pointer should be moving when enumeration done
  3.         Plug an USB Flash Disk to the HS port to run the MSC Host example