cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure USB Host and RTOS?

Not applicable

I noticed that STM32CubeIDE 1.4 does not work in the same way as IDE 1.0 with RTOS and USB Host. In IDE 1.0 it is possible to get messages from Degug but in IDE 1.4 not even the messages are displayed.

When the uC is started with the pendrive already connected, these messages are generated in IDE 1.0:

Power On
USB Device Attached
PID: 4200h
VID: 13feh
Address (#1) assigned.
Manufacturer :
Product : USB DISK 2.0
Serial Number : 7F004191A203B205
Enumeration done.
This device has only 1 configuration.
Default configuration set.
Switching to Interface (#0)
Class    : 8h
SubClass : 6h
Protocol : 50h
MSC class started.
USB Device disconnected
USB Device Attached
USB Device disconnected
USB Device Attached
USB Device disconnected
USB Device Attached
PID: 4200h
VID: 13feh
Address (#1) assigned.
Manufacturer :
Product : USB DISK 2.0
Serial Number : 7F004191A203B205
Enumeration done.
This device has only 1 configuration.
Default configuration set.
Switching to Interface (#0)
Class    : 8h
SubClass : 6h
Protocol : 50h
MSC class started.

But there is a problem after the recognition of the MSC class. In addition, there is a problem with the recycling of routines, it can be observed that after disconnecting the pendrive several times, it was possible to recognize the device again.

Without RTOS these messages are obtained:

Power On
 
USB Device Attached
PID: 4200h
VID: 13feh
Address (#1) assigned.
Manufacturer :
Product : USB DISK 2.0
Serial Number : 7F004191A203B205
Enumeration done.
This device has only 1 configuration.
Default configuration set.
Switching to Interface (#0)
Class    : 8h
SubClass : 6h
Protocol : 50h
MSC class started.
Number of supported LUN: 2
LUN #0:
Inquiry Vendor  :
Inquiry Product : USB DISK 2.0
Inquiry Version : PMAP
MSC Device ready
MSC Device capacity : 3449028096 Bytes
Block number : 15124991
Block Size   : 512
LUN #1:
Inquiry Vendor  :
Inquiry Product : USB DISK 2.0
Inquiry Version : PMAP
Sense Key  : 5
Additional Sense Code : 25
Additional Sense Code Qualifier: 20
USB Device disconnected
USB Device Attached
PID: 4200h
VID: 13feh
Address (#1) assigned.
Manufacturer :
Product : USB DISK 2.0
Serial Number : 7F004191A203B205
Enumeration done.
This device has only 1 configuration.
Default configuration set.
Switching to Interface (#0)
Class    : 8h
SubClass : 6h
Protocol : 50h
MSC class started.
Number of supported LUN: 2
LUN #0:
Inquiry Vendor  :
Inquiry Product : USB DISK 2.0
Inquiry Version : PMAP
MSC Device ready
MSC Device capacity : 3449028096 Bytes
Block number : 15124991
Block Size   : 512
LUN #1:
Inquiry Vendor  :
Inquiry Product : USB DISK 2.0
Inquiry Version : PMAP
Sense Key  : 5
Additional Sense Code : 25
Additional Sense Code Qualifier: 20

In IDE 1.4 and without RTOS these messages are obtained:

Power On
USB Device Connected
USB Device Reset Completed
PID: 4200h
VID: 13feh
Address (#1) assigned.
Manufacturer :
Product : USB DISK 2.0
Serial Number : 7F004191A203B205
Enumeration done.
This device has only 1 configuration.
Default configuration set.
Switching to Interface (#0)
Class    : 8h
SubClass : 6h
Protocol : 50h
MSC class started.
Number of supported LUN: 1
LUN #0:
Inquiry Vendor  :
Inquiry Product : USB DISK 2.0
Inquiry Version : PMAP
MSC Device ready
MSC Device capacity : 3449028096 Bytes
Block number : 15124991
Block Size   : 512
USB Device disconnected
USB Device Connected
USB Device Reset Completed
PID: 4200h
VID: 13feh
Address (#1) assigned.
Manufacturer :
Product : USB DISK 2.0
Serial Number : 7F004191A203B205
Enumeration done.
This device has only 1 configuration.
Default configuration set.
Switching to Interface (#0)
Class    : 8h
SubClass : 6h
Protocol : 50h
MSC class started.
Number of supported LUN: 1
LUN #0:
Inquiry Vendor  :
Inquiry Product : USB DISK 2.0
Inquiry Version : PMAP
MSC Device ready
MSC Device capacity : 3449028096 Bytes
Block number : 15124991
Block Size   : 512

When RTOS is activated, the USBH_Process_OS subroutine of the usbh_core.c file does not execute anything, the condition (event.status == osEventMessage) cannot be true.

(usbh_core.c:)

static void USBH_Process_OS(void const *argument)
{
  osEvent event;
 
  for (;;)
  {
    event = osMessageGet(((USBH_HandleTypeDef *)argument)->os_event, osWaitForever);
    if (event.status == osEventMessage)
    {
      USBH_Process((USBH_HandleTypeDef *)argument);
    }
  }
}
#else

When RTOS is activated, in IDE 1.4, is it normal for Debug messages to stop being generated?

4 REPLIES 4
Pavel A.
Evangelist III

CubeIDE is just editor and compiler.

But new releases of Cube/CubeIDE use new source templates and HAL libraries (and other components such as FreeRTOS).

At least you need to compare the complete source code.

ST examples are not generated with Cube, so they cannot do regression tests. So this falls on the users.

-- pa

Not applicable

I understand, but I think the least that is expected is that STM32CubeIDE should generate code that has the same behavior, with or without the use of RTOS.

Nikita91
Lead II

Hal is not designed to be RTOS compatible.

Therefore, ST is unlikely to be concerned about the compatibility of evolutions of the HAL with an RTOS, as it does not care about the compatibility of the HAL with the provided examples .

Pavel A.
Evangelist III

This is expected... but not here yet. (Like vaccine for the dаmnеd virus and some other things).

Will this destroy your project or you have plan B? It's your choice.

-- pa