2025-09-01 12:49 PM
Hi,
I have downloaded and installed STM32CubeIDE version 1.18.1, and created a new project for the STM32F042C6T6 chip. For this chip, the latest available firmware pack is STMCube MCU Package for STM32F0 series version 1.11.5.
When I install this firmware pack and open it from the STM32Cube / Repository directory, I can see that in the middleware folder I have the STM32 USB middleware library version 2.5.3. This is apparent from the Relese Notes file present in the directory.
In GitHub, the latest available version for the STM32 USB middleware library is much newer, version 2.11.4 which contains all the nice things I need such as support for USB composite devices. I have already reviewed the post https://community.st.com/t5/stm32-mcus/how-to-implement-a-usb-device-composite-in-stm32h5/ta-p/708078 found from this forum but this link only deals with STM32H5 which is a completely different MCU from my meager F0.
My main question then is, how can I use the latest STM32 USB middleware library together with the STM32CubeIDE and benefit e.g. from the Composite builder support?
Or is my only choice to generate a sample USB implementation e.g. for Custom HID using the older version present in the firmware package, then replace the core and class files with the files from the newer middleware package, and "port" the code that STM32Cube generated for me to the standards and practises used by the new version?
This second approach is a bit problematic because the PMA memory of the STM32 USB implementation is not very thoroughly documented. Sure, there is the chip's reference manual, and there's UM1734 but then you'd just "have to know" that there's also this post https://community.st.com/t5/stm32-mcus/how-to-select-suitable-endpoints-for-your-stm32-usb-application/ta-p/719823 which gives you the "reason" why STM32CubeIDE chose the otherwise arbitrary-looking 0x18 and 0x58 for the PMA addresses of endpoint 0. Nothing for example in the UM1734 hints about maximum package sizes of various endpoint types, or what kind of parameters to use with HAL_PCDEx_PMAConfig call...