2016-07-22 10:23 AM
Does CubeMX supports the above?
I tried and CubeMX failed on USB selection with error, ''USB device not available. Active only when USB OTG FS IP is configure in Device mode''. There was a/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Nucleo-F103RB%20%20%2b%20USB&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=658
dated 2014. The hardware portion is still valid, right? When I download the lib 4.0.0 as the post, it advises that I should use CubeMX for new design. Is it very difficult to mix CubeMX generated HAL code with the 4.0.0 library? #usb-device-library-stm32f103rbt6 #usb-cubemx-hsi-hse-frequency2016-07-22 11:17 AM
You are not supposed to mix CubeMX/HAL code with the older SPL based code. They are not designed to work together, so you'll have to decide which you want to utilize.
The hardware to get USB connectivity should remain constant, you can review the NUCLEO board ST-LINK portion to see how that F103 is wired up.CubeMX should supposedly create code for a VCP/CDC type USB device.2016-07-22 03:02 PM
Hi,
toolcan help you to generate your necessary initialization code and develop the basic configuration for your project. In CubeMx 'Pinout' tab, you should enable the USB_OTG_FS peripheral as Device Only. Then, in the 'Configuration' tab, enable Midlleware USB_Device with (CDC Virtual Port Com). Make sure to have the STM32 Virtual COM Port Driver on your PC, downloadable from ST web .It should then drive the VCP through ST-Link. If your board is connected to the USB, a virtual com port is created and it appears in the windows device manager under ''Ports (COM & LPT)''. For more details about STM32CubeMx, refer to :''STM32CubeMx User Manual'' I highly recommend you to review page and ''STM32Cube USB device library'' (/content/ccc/resource/technical/document/user_manual/cf/38/e5/b5/dd/1d/4c/09/DM00108pdf/files/DM00108pdf/jcr:content/translations/en.DM00108pdf
) You can also, start from USB example under the/content/my_st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef1.license=1469202656html
firmware package, you find the needed include parts for your project. Maybe you can refer to this CDC application provided within the STM32CubeF1: STM32Cube_FW_F1_V1.4.0\Projects\STM3210C_EVAL\Applications\USB_Device\CDC_Standalone This application shows how to use the USB device application based on the Device Communication Class (CDC)and can help you as an implementation example. Regards2016-07-31 09:49 AM
Hi forumstm32,
Many thanks for your reply. After switching to HSE, CubeMX generates USB code. I believe HSI frequency tolerance is not enough for USB. John