2016-04-06 3:43 AM
Hello everybody!
I want a little advice on the best way to code (on a STM32F4) an USB HOST ''ONLY'' with a standard type A connector.The picture of the STM32 > USB CONNECTOR cabling is attached:https://my.st.com//public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Attachments/65016/USB_HOST.jpg
I already coded in the past an USB SLAVE (with a midi USB connector), using the library STM32_USB_OTG_DriverNow I want to start a new project and create an USB HOST, to host and communicate with my USB SLAVE circuit.So my questions are:1)Is the system on the picture attached is correct?
2) To configure the USB host driver, I need to use the USB OTG HS CONFIGURATION instead of the USB OTG FS CONFIGURATION ?Thanks a lot, have a good day! null2016-04-06 6:23 AM
Hello,
About USB host configuration: The USB device library can be configured to run in either HS or FS mode, as the library can handle the USB OTG HS and USB OTG FS core: - If the USB OTG FS core can only work in Full Speed mode, the USB OTG HS can work in High or Full Speed mode.To select the appropriate USB Core to work with, you must add the following macro defines within the compiler preprocessor: - ''USE_USB_HS'' and ''USE_USB_FS'' when using USB Dual Core ModeI suggest that you refer to the USB HOST application provided within STM324xG-EVAL as an implementation example:STM32Cube_FW_F4_V1.11.0\Projects\STM324xG_EVAL\Applications\USB_Host\DualCore_StandaloneYou can refer also to the following documents:http://www.st.com/st-web-ui/static/active/en/resource/technical/document/user_manual/DM00105256.pdf
: STM32Cube USB host library Hope this help you.-ForumSTM32-2016-04-06 7:58 AM
Seeing as you are connecting it to the FS pins, it would seem a bit irrational to believe the HS would be used?
Why don't you look at the USB MSC HOST example, using PA9/PA11/PA12 on the STM32F4-DISCO, as a starting point?\STM32F4-Discovery_FW_V1.1.0\Project\FW_upgrade2016-04-06 10:10 AM
Hi,
I don't want to use the STM32F4_DISCO because this board use an USB on-the-go. If I understand, this communication can be HOST and/or SLAVE. For my purpose, I only want a minimalist host communication.Moreover, the circuit is too advanced for me, as it uses the ID pin and the STMPS2141STR power switch.I really want to make the simplest circuit possible.Do you think my circuit is OK? For example, I don't know if I have to use the VBUS PA9 pin.Thanks!2016-04-06 11:27 PM
Hi,
I think it looks ok. Didn't know that pull down was needed though. You can have the power external of course, but the VDDUSB pin should be connected somewhere, preferably to VDD (if I recall correctly).Regards,Rygelxvi2016-04-07 7:36 AM
Hi,
1) On every schematic I find, there is pull down on D- and D+2) What do you call VDDUSB ? The VUSB of the USB connector must be linked to the +5V power supply of my board, because the host board has to supply the USB slave device.I have some troubles to find on the internet some examples of circuits using USB host only, with my type of schematic... I hope it's possible.2016-04-07 8:58 AM
VDDUSB is a pin on some of the STM32 families (L) where the core is powered with voltages too low for the USB pin drivers to meet specifications.
If in doubt prototype your ideas/circuits onto a NUCLEO board.I could swear OLIMEX and GHI have boards with USB Host connectors, along with a bunch of eBay players.2016-04-07 9:43 AM
Thanks, I will test my circuit on the STM32F4DISCOVERY available pins because I have only this board. I just wanted to know if my circuit seems right.
Another question before I begin to test this system: if I want to activate only the HOST mode and not the SLAVE mode, I need to configure my USB like below in the file usb_conf.h ?/****************** USB OTG FS PHY CONFIGURATION *******************************/
#ifndef USE_USB_OTG_FS//#define USE_USB_OTG_FS
#endif#ifdef USE_USB_OTG_FS//#define USB_OTG_FS_CORE
#endif/****************** USB OTG HS PHY CONFIGURATION *******************************/
#ifndef USE_USB_OTG_HS #define USE_USB_OTG_HS#endif#ifndef USE_ULPI_PHY #define USE_ULPI_PHY#endif#ifndef USE_EMBEDDED_PHY//#define USE_EMBEDDED_PHY
#endif#ifdef USE_USB_OTG_HS #define USB_OTG_HS_CORE#endifAnd to init the USB at startup:USBD_Init(&USB_OTG_dev,
USB_OTG_HS_CORE_ID
, &USR_desc, &MIDI_cb, &USR_cb);2016-04-11 12:12 AM
Hi.
If you want to use your board as USB HOST, you need to use the host library and not the device library.So your function will beUSBH_Init()
and not
USBD_Init().
You really should start with a example or application provides by ST.