cancel
Showing results for 
Search instead for 
Did you mean: 

Help with integrating tinyusb in STM32CubeIDE

LLope.31
Associate III

Hello,

I have problems with building the cdc_msc example on STM32CubeIDE. My board is STM32F411 blackpill.

I have followed the instructions in https://github.com/hathach/tinyusb/discussions/633 but get errors when building.

Below I will link my entire project and also a screenshot of the errors in STM32CubeIDE.

I would appreciate a lot if someone could help me with this. thanks

LLope31_0-1695717951238.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

I managed to get it to compile and it seems to be working as a mass storage device as expected. Although the fix was sketchy:

#define CFG_TUSB_MCU OPT_MCU_STM32F4
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
#define BOARD_DEVICE_RHPORT_NUM 0
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_FULL_SPEED)
#define CFG_TUSB_RHPORT1_MODE 0

I added this last line to solve for the high speed case... was this really the only way to solve it, and there is a problem with the library?

View solution in original post

5 REPLIES 5
Bob S
Principal

The very first (top) error line tells you the problem.  Apparently the code is written to use the high speed (HS) USB port but you have the full speed (FS) port enabled/defined (in CubeMX?).  Either change your CubeMX config or change that #define to use the FS port.

Piranha
Chief II

Look at the code for the first error and go back through those definitions... For full-speed mode, instead of CFG_TUSB_RHPORT1_MODE one must define CFG_TUSB_RHPORT0_MODE.

LLope.31
Associate III

LLope31_0-1695761930365.png

I tried that already and got this

I managed to get it to compile and it seems to be working as a mass storage device as expected. Although the fix was sketchy:

#define CFG_TUSB_MCU OPT_MCU_STM32F4
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
#define BOARD_DEVICE_RHPORT_NUM 0
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_FULL_SPEED)
#define CFG_TUSB_RHPORT1_MODE 0

I added this last line to solve for the high speed case... was this really the only way to solve it, and there is a problem with the library?

Again - look at the code and analyse why it is trying to use that CFG_TUSB_RHPORT1_MODE define. Most likely something else is still wrong.