2025-09-22 6:16 AM - last edited on 2025-09-23 9:54 AM by mƎALLEm
Title edited to name the device being hosted.
Hello ,
I am currently trying to configure STM32F407 board as USB host. The code for it is given below. I am not receiving anything from the USB device(bus powered). I have a doubt that it might be related to the hardware of it(VBUS). The rest of the code is generated by the IDE itself so there is no doubt related to it. I have configured it as USB host only mode. I am new to embedded systems so any kind of help would be appreciated. Is there anything wrong with the code or any links to help me configure the USB host.
I would be glad to clarify any queries related to the above.
2025-09-25 2:00 AM
The console window does not open and hence am not able to see the errors.
2025-09-25 2:27 AM - edited 2025-09-25 2:28 AM
Not even when you do a build?
Even when there's nothing to build (everything is up-to-date), you should at least see something like this:
More generally, something like this (from the User Manual):
via: https://www.st.com/en/development-tools/stm32cubeide.html#documentation
If you're not seeing that, then that's a separate issue - start a new thread for that.
2025-09-25 2:30 AM
arm-none-eabi-gcc -o "USB_FTDI.elf" @"objects.list" -mcpu=cortex-m4 -T"F:\STM32CubeIDE_1.19.0\USB_FTDI\STM32F407ZGTX_FLASH.ld" --specs=nosys.specs -Wl,-Map="USB_FTDI.map" -Wl,--gc-sections -static --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
F:/STM32CubeIDE_1.19.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: ./USB_HOST/App/usb_host.o:(.bss.hUsbHostFS+0x0): multiple definition of `hUsbHostFS'; ./Core/Src/main.o:(.bss.hUsbHostFS+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:68: USB_FTDI.elf] Error 1
"make -j12 all" terminated with exit code 2. Build might be incomplete.
this is the error in the console window , as expected. I need help including some definitions of my driver
in the usbh_host.c file which is part of middleware(not to be edited i guess).
2025-09-25 2:39 AM - edited 2025-09-25 2:40 AM
So the error is:
/USB_HOST/App/usb_host.o:(.bss.hUsbHostFS+0x0): multiple definition of `hUsbHostFS'; ./Core/Src/main.o:(.bss.hUsbHostFS+0x0): first defined here
It tells you that you have multiple definitions of the symbol hUsbHostFS, and they are in the files usb_host.o and main.o
So you need to remove one of those definitions.
usb_host.o is the object file from compiling the usb_host.c source file;
main.o is the object file from compiling the main.c source file.
2025-09-25 3:42 AM
Now its showing some issue with build even though i removed the duplicate file. I guess the build was incomplete or something because every time am trying to run or debug , a new tab gets opened in editor showing this error.
2025-09-25 4:27 AM
@SohamC wrote:Now its showing some issue with build
What issues? Your screenshot does not show any build issues.
@SohamC wrote:even though i removed the duplicate file..
Were the files actually duplicates?
The error said nothing about duplicate files - just about one definition within those files.
It was just that definition that you needed to correct.
2025-09-25 6:29 AM
2025-09-25 6:36 AM
So is this after you fixed the duplicate definition issue?
And you now get no errors or warnings when building?
Where did the usb_ftdi.c file come from?
Why do you want to host a USB--to-UART adaptor anyhow?
Wouldn't it be simpler to just use a UART direct?
2025-09-25 6:42 AM
@Andrew Neil wrote:In particular, what STM32F407 board are you using
(emphasis added)
@SohamC wrote:STM32F407ZGT6
That's just a chip part number - it doesn't tell what board you are using it on.
2025-09-25 11:00 AM
Its the connector that is USB. So we cant use it directly. Development board is Euse M4 demo. with the chip specified. The chip is of less concern now , because the focus is to write firmware for usb host , the chipset can be any stm chip