2013-06-27 11:14 AM
Has anyone seen any code to do Ethernet Over USB from an STM32?
I'm looking for something similar to how the BeagleBone boards work. When you plug their USB into Windows (and have the right drivers) they show up as a fake Ethernet IP (along the lines of CDC for comm ports). Bill #usb #ethernet #cdc #ecm2013-06-27 06:51 PM
> When you plug their USB into Windows (and have the right drivers) they show up as a fake Ethernet IP (along the lines of CDC for comm ports).
Which one are you talking about, RNDIS or SLIP? Over RNDIS gadget driver, the BeagleBone works as a USB-Ethernet dongle (adaptor). With SLIP protocol over a virtual COM port, the BeagleBone runs server/client. Tsuneo2013-06-28 07:07 AM
I don't even know enough to answer that question.
Does one of those work on on the Windows side without creating custom USB drivers? -Bill2013-06-28 10:39 AM
Ah, you are referring this behavior, described on BeagleBone ''getting started'' page
http://beagleboard.org/static/beaglebone/latest/README.htm Step #2: Install drivers Install the drivers for your operating system to give you network-over-USB access to your BeagleBone. Additional drivers give you serial access to your board. I have a BeagleBone board, but sorry, I skipped this page ;) On the schematic, BeagleBone has two USB devices under on-board hub.USB PC ---- USB2412 (2-port hub) -- AM3359 USB0
Connector -- FT2232
The Getting Started page links to RNDIS and FTDI VCP PC drivers.
''network-over-USB access'' seems to be supplied over RNDIS.
As RNDIS is just a protocol which carries Ethernet frames over USB, virtual network (without Ethernet hardware) should connect to a web server on the BeagleBone firmware.
+-----------(virtual network)-----------+
| |
USB RNDIS ------+- Ethernet <==(physical)==> Ethernet --+-- Web server
device PHY network PHY
And then, you have to implement these components,
1) USB RNDIS device
2) web server, which directly connects to RNDIS, skipping hardware layer
1) RNDIS device
There are a couple of commercial RNDIS device stack for STM32, like SAFERTOS, Thesycon, WinDriver. But I can't find free RNDIS implementation. As RNDIS is an extension of CDC, you may make it, starting with the ST's CDC (-ACM) example. I believe it takes a couple of days or so, if you would know USB device class implementation well. But if it were the first time to touch to the USB stack, 2-3 weeks ;) If you have patience, I'll help you.
MS-RNDIS -- RNDIS spec on MSDN
http://msdn.microsoft.com/en-us/library/ee5249aspx
2) web server
AN3384 demonstrates a web (HTTP) server using LwIP and FreeRTOS
http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/DM00026pdf
You may rewrite the HAL (Hardware Abstraction Layer) of LwIP, so that it directly connects to RNDIS, instead of an Ethernet PHY.
> Does one of those work on on the Windows side without creating custom USB drivers?
Windows has in-box RNDIS driver. But you have to provide an INF file, like CDC (-ACM).
You may apply BeagleBone one.
Tsuneo
2013-06-28 01:48 PM
Tsuneo,
Thank you for that info. I appreciate it very much. I do have experience with USB code on Freescale Coldfilre and Microchip PIC32MX, but not so much yet with the STM32. I'll do some research based on your info and I'll be back with questions. Bill2014-12-02 02:08 AM
Hi Tsuneo and others
I`ve modify ST CDC USB Class and know I have a working CDC-ECM. It was quite simple :) But I have problems with Windows INF file. Can you help me with that? USB act as Composite Device (CDC, HID and MSC) and under Linux it works like a harm. No drivers required. Under Windows, for CDC-ACM I have modified original INF file providaed by ST (only VID/PID has changed and &MI_00 added as interface hint for enumeration). From know, every time you plug my device into USB ethernet card is detected and IP is gather from DHCP server from the device. As the TCP/IP stack lwIP is used with FreeRTOS as scheduler. Almost done, only INF is needed :\ Thank in advance for any help. Chris2015-01-02 03:24 AM
Hi Chris
When you mean CDC-ECM do you mean RNDIS for Windows use as if you have one working I would appreciate it if you could share it! I have attached the INF file from LUFA, you would of course need to alter a few things. Thanks Andy. ________________ Attachments : LUFA_RNDIS.inf : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I13o&d=%2Fa%2F0X0000000bkL%2Fu5ZRLs3jnMG5RwWINq9Nx4rP928R2nwtdkinG9hpC2U&asPdf=false2015-01-02 10:18 AM
Since WinXP, MS-OS descriptors work for RNDIS, which assigns RNDIS PC driver to your device without any INF file.
http://msdn.microsoft.com/en-us/windows/hardware/gg463179.aspx If you would modify your firmware a little, so that it provide MS-OS descriptor, your RNDIS device could do without any INF file ;) Tsuneo2015-02-13 12:14 AM
I've seen free ethernet over usb library here:
http://www.youtube.com/watch?v=W_o0lPivqsA https://github.com/fetisov/lrndis http://habrahabr.ru/post/248097/