cancel
Showing results for 
Search instead for 
Did you mean: 

USB RNDIS + USB VCP on STM32L462

dnj
Associate III

dnj_0-1700574311825.png

Hi, I would like to enable RNDIS + VCP on this MCU. Is there an option to do that?

I do not know how to enable only RNDIS for this MCU too (I do not see this on drop down with Class for FS IP).

1 ACCEPTED SOLUTION

Accepted Solutions
Pavel A.
Evangelist III

Each of CDC and RNDIS functions needs two IN and one OUT endpoints. Total two bulk pairs IN & OUT + two single IN interrupt endpoints.  Actually, almost any number of virtual devices can be implemented with 3 EPs, but not as a standard USB multifunction device. A custom host driver will be needed, which is not a trivial task (not a rocket science either).

View solution in original post

9 REPLIES 9
Bob S
Principal

Try the X-CUBE-AZRTOS-L4 package,  Under USB/USBX it has CDC ECM and RNDIS options.  I haven't yet used AZRTOS but a co-worker has and he get CDC ECM (a different Ethernet-over-USB protocol) up and running in a NUCLEO board in a day.  Otherwise, you will likely have to manually port RNDIS from another STM32 family (I don't recall which ones ST has RNDIS support, if any).

Imen.D
ST Employee

Hello @dnj,

The RNDIS class is provided with STM32CubeL4 MCU package. You can find it under:

 \STM32Cube_FW_L4_Vx.x.x\Middlewares\ST\STM32_USB_Device_Library\Class\CDC_RNDIS\

You can start from CDC project, then modify it to the RNDIS structures und modules. 

Please refer to the wiki page: Introduction to USB with STM32 - stm32mcu: 5.3.2.6 CDC Remote Network Driver Interface Specification (RNDIS) Sublass.

 

Imen

 

 

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
dnj
Associate III

So, I have to do it manually as you mentioned and @Bob S too.

Then I have another question. Is it possible to run both (VCP and RNDIS) CDC? By run both I mean both are active at same time.

Bob S
Principal

The L462 USB supports 8 end points.  2 of those are used for the EP0 control channel (1 IN and 1 OUT), you have no choice).  VCP requires 2 IN and 1 OUT endpoints.  Since the STM32 USB endpoints MUST be used in pairs (1 IN and the corresponding OUT), the unused OUT endpoint cannot be used for any other purpose.  That leaves 1 IN and 1 OUT endpoint.  I don't know how many endpoints RNDIS uses.  If it only needs 1 IN and 1 OUT then it will be possible to have VCP and RNDIS.  You can look at the RNDIS example @Imen.D referred to so see how many endpoints it needs.  You will need to figure out how to change the descriptors to support 2 devices.

Pavel A.
Evangelist III

Each of CDC and RNDIS functions needs two IN and one OUT endpoints. Total two bulk pairs IN & OUT + two single IN interrupt endpoints.  Actually, almost any number of virtual devices can be implemented with 3 EPs, but not as a standard USB multifunction device. A custom host driver will be needed, which is not a trivial task (not a rocket science either).

dnj
Associate III

Thanks for answers. I wish I could more answers as solution.

 

Now, I want to enable just RNDIS and I think I ported it somehow with examples you have mentioned above.

How to properly install RNDIS.inf driver for Windows 10?

Whenever I install manually driver for device that appears in device manager I see that this driver is not compatible with x64 system version... anybody has properly working RNDIS driver?


@Bob S wrote:

Since the STM32 USB endpoints MUST be used in pairs (1 IN and the corresponding OUT), the unused OUT endpoint cannot be used for any other purpose.


Huh? What do you mean by that? From my experience there is no such constraint. You may use any endpoint for any function. I implemented CDC + printer with 2 endpoint pairs and few other composite devices.

 

Bob S
Principal

In my experience, if I use EP2 IN for CDC #1, I cannot use EP2 OUT for a CDC #2.  So a CDC/VCOM uses, say, EP1 IN, EP1 OUT, EP2 IN.  This leaves EP2 OUT as unusable.

Note that in the STM32 code you can absolutely create descriptors that use EP2 OUT in a 2nd CDC (along with EP3 IN and EP3 OUT).  However, in my tests, Windows10 would not recognize or work with the 2nd CDC port.

Now I readily admit that I may have missed something, or mis-configured something in my tests.  This was several years ago and I don't think I went further than "rats it didn't work, on to something else".  Or maybe this is CDC specific (and/or Windows specific), since you have gotten CDC+Printer working.  And chance you can share the USB descriptors that worked for you?

dnj
Associate III

I used USBView and changed Device Descriptor values to:

dnj_0-1701342480525.png

...and then I see in device manager:

dnj_1-1701342517354.png

 

So for now I successfully attached this STM32 USB device.