← index #4857Issue #212
Related · high · value 0.640
QUERY · ISSUE

STM32 USE_HOST_MODE

openby IAmCoderopened 2019-06-18updated 2025-10-04
port-stm32needs-info

If I define USE_HOST_MODE to compile in the code for experimental USB OTG support here:
https://github.com/micropython/micropython/blob/master/ports/stm32/usb.c#L815, I get a host of compile errors. First is that the includes seem to have been moved to sub-directories, which I can fix like this:

#include "usbhost/Core/Inc/usbh_core.h"
#include "usbhost/Core/Src/usbh_core.c"
//#include "usbh_usr.h"
#include "usbhost/Class/HID/Inc/usbh_hid_core.h"
#include "usbhost/Class/HID/Inc/usbh_hid_keybd.h"
#include "usbhost/Class/HID/Inc/usbh_hid_mouse.h"
#include "usbhost/Core/Src/usbh_hcs.c"

Then there are a lot of missing references that I tried adding from the downloads from ST.com stm32_f105-07_f2_f4_usb-host-device_lib (STSW-STM32046 https://www.st.com/en/embedded-software/stsw-stm32046.html) and STM32Cube_FW_H7_V1.4.0 (STM32CubeH7) under /usbhost/Class/HID/, /usbhost/Class/OTG/ and /usbhost/Core/, but that causes many conflicts with the files under /usbdev/.

Could someone who managed to get the experimental USB OTG support going with a mouse or keyboard point me in the right direction?

CANDIDATE · ISSUE

USB host mode

closedby dpgeorgeopened 2014-01-23updated 2019-09-16

Does anyone have any experience getting USB host mode working on the STM32F4 series? I've tried to no avail to get it working on the pyboard.

I'm forcing it to be in pure host mode, pretty much copying from the STM USB HID host example, but it does not work. Seems that it doesn't even register when a USB device is plugged in (it does not generate an interrupt).

Any thoughts?

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied