cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 - USBX RNDIS - USBD_RNDIS_EPINCMD_ADDR

Dams
Associate III

Hello, 

I'm using STM32CubeIDE 2.0.0 + STM32CubeMX 6.16.1 + FW_H7 V1.12.1

I have a problem with USBX RNDIS.
The generated code on file ux_device_descriptor.h  at line 308 is:

#define USBD_RNDIS_EPINCMD_ADDR 0x81U

In the exemple code of STM32H735-DK find on stm32-usbx-exemple repo I have this

#define USBD_RNDIS_EPINCMD_ADDR 0x82U

The USB device is well recognized be my computer (windows 11) only if the value is 0x82U.

My questions:

 - why it doesn't work with 0x81
 - is there is a tips to modify this value on Cube ? Actually I add an error at the end of the file if value is 0x81..

 

Thanks for help !

 

1 ACCEPTED SOLUTION

Accepted Solutions
FBL
ST Employee

Hi @Dams 

With the configuration below, the code is generated correctly. In particular, the IN endpoint address and the IN endpoint command address are assigned the additional values 0x81 and 0x82, respectively, since bit 7 indicates the direction (0 for OUT, 1 for IN).

FBL_0-1770369206345.png

 

FBL_1-1770369230595.png

I hope it's clear.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.




Best regards,
FBL

View solution in original post

6 REPLIES 6
FBL
ST Employee

Hi @Dams 

This behavior is related to the role of this endpoint. The USBD_RNDIS_EPINCMD_ADDR is the command IN endpoint, and its direction and index.

If USBD_RNDIS_EPINCMD_ADDR is set to 0x81U, it conflicts with the data IN endpoint configuration, and the device is not correctly handled by the host. That’s why it only works correctly when USBD_RNDIS_EPINCMD_ADDR is set to 0x82U, as in the reference example. 

 

/* EP_IN, EP_OUT, CMD_EP */
#define USBD_RNDIS_EPIN_ADDR                          0x81U
#define USBD_RNDIS_EPOUT_ADDR                         0x01U
#define USBD_RNDIS_EPINCMD_ADDR                       0x82U

Here you can find the configuration of FIFOs in this example. To learn more you can refer to this helper How to configure USB FIFO over USB OTG controller and Practical use cases to manage FIFO in USB OTG

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.




Best regards,
FBL
Dams
Associate III

Hi @FBL 

 

Thanks for feedback. According to your answer, I think the generated code from Cube is not correct. In the file "ux_device_descriptor.h" the value of USBD_RNDIS_EPINCMD_ADDR shall be set to 0x82U intead of 0x81U.

Have you same value on your configuration ? 

Best regards, 

FBL
ST Employee

Hi @Dams 

I'm only referring to the example provided here. I didn't generate code using CubeMX. Would you attach IOC file to check code generated?  

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.




Best regards,
FBL
Dams
Associate III

Hi @FBL 

Please find my Cube on this reply.

regards,

FBL
ST Employee

Hi @Dams 

With the configuration below, the code is generated correctly. In particular, the IN endpoint address and the IN endpoint command address are assigned the additional values 0x81 and 0x82, respectively, since bit 7 indicates the direction (0 for OUT, 1 for IN).

FBL_0-1770369206345.png

 

FBL_1-1770369230595.png

I hope it's clear.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.




Best regards,
FBL
Dams
Associate III

Hi @FBL ,

 

Thanks for the solution:

 

Dams_0-1770369781048.png

Have a nice day.

 

Regards,