USB RNDIS + USB VCP on STM32L462
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-21 05:49 AM
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).
Solved! Go to Solution.
- Labels:
-
STM32CubeMX
-
USB
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-22 12:54 PM - edited ‎2023-11-22 12:58 PM
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).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-21 11:11 AM
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).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-22 12:25 AM
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
Thanks
Imen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-22 02:29 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-22 09:54 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-22 12:54 PM - edited ‎2023-11-22 12:58 PM
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).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-29 07:13 AM - edited ‎2023-11-29 07:13 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-29 07:52 AM
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-29 12:27 PM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-30 03:10 AM
I used USBView and changed Device Descriptor values to:
...and then I see in device manager:
So for now I successfully attached this STM32 USB device.