Belcarra USBLAN Network over USB

Demonstration for Microchip PIC32

1.     Overview

The Microchip PIC32 allows for implementation of a Full Speed USB Device.

Implementing a Networking over USB solution allows a PIC32 based design to connect to a Microsoft Windows system and use TCP/IP network connections using the Belcarra Windows USBLAN Class driver.

Microchip makes available a TCP/IP stack and a demonstration application that implements a Web Server. In their demo the Web Server can be accessed via the Ethernet.

Belcarra has created a Networking over USB driver (USBLAN Function Driver) for Microchip that allows the TCP/IP stack to use USB to connect to a Windows system. A demonstration kit is available to demonstrate this capability.

The demonstration kit is adapted from Microchip’s Ethernet demo which implements a web server demo. The Belcarra kit uses the v2.9a version of USB from Microchip and has been implemented with the most recent production version, v5.42, of the Microchip TCPIP stack. Belcarra can also on request make available a version of this demo using the Microchip version v6 Beta TCPIP stack.

Belcarra’s implementation of Networking over USB for the Microchip PIC32 is a very low cost networking solution for PIC32 projects, eliminating the need to add an Ethernet chip while using less Flash and RAM resources.

2.   Networking over USB

There are several standard protocols that can be used to implement Networking over USB:

There are several proprietary or de facto protocols as well:

The Belcarra Windows USBLAN driver will automatically recognize and use any of the above protocols. In practice they are not equally suitable for use in a reduced resources system such as the PIC32 Microcontroller[1].

For this demonstration Belcarra has implemented the Itsy protocol:

EEM would be a reasonable alternative as there are a few small benefits and the additional complexity is less than NCM or RNDIS.

ECM would also work. It requires that the underlying USB support libraries implement the SET INTERFACE device request. ECM has the advantage of being supported on the Macintosh by OS X.

 

All of the protocols can be implemented but there is little additional value and the cost is a substantial increase in code complexity and size (flash memory) and data storage (RAM).

Overview of Network:

3.   Limitations

The application running on the PIC32 will be limited to accessing services running on the Windows System to which it is connected. Applications running on the connected Windows System will be able to only access services available on the PIC32 system.  The PIC32 applications will not be able to access the Internet via the Windows system. This can be circumvented  if a network bridge or routing is setup using the standard Windows networking tools. Alternately a proxy server on the Windows system can be used to support the PIC32 system for accessing services on the Internet.

Secondly, the demonstration Belcarra USBLAN for Windows driver implements a built-in DHCP server. By default these will set up the network link as follows:

DHCP parameters are set in the Windows Registry; information on setting them to other values is available from Belcarra’s USBLAN for Windows OEM support manual .

The licensed version of the Belcarra USBLAN for Windows driver has a large number of other configuration options. These are typically available via the registry and can be pre-set in the INF file during installation. Belcarra typically provides the complete installation kit with customized INF file and signed drivers and these can be made available to end users via Windows Update. If you have specific requirements contact Belcarra for a test kit with your configuration.

Thirdly, Networking in TCP/IP v5.42 is limited to a single network interface, whether it is Ethernet or USB.  Therefore two separate hex files: ethernet.hex uses the Ethernet interface (as in the Microchip Demo Application), and microchip-usblan.hex uses the USB subsystem instead. The v6 Beta TCPIP stack allows multiple network interfaces, and so will permit a single demonstration hex project. However, a single interface conserves code space and the v6 stack is still designated as Beta by Microchip.

Finally, the Belcarra USBLAN for Windows evaluation kit that is freely available from Windows Update (or downloadable from here) is limited to one hour of use. After one hour you will need to unplug and re-plug to restore the connection. Licensed versions of the Belcarra Windows USBLAN driver do not have this limitation.  Please contact Belcarra if you require an unlocked evaluation driver for testing.

4.     Demonstration Kit

There are three hex project files (download zip files):

All three projects can be loaded into the PIC32 Starter Kit board using the instructions below.

4.1.        Requirements

4.2.        Setup

N.B. If you cannot arrange for Internet access to Windows Update contact Belcarra for a copy of the Belcarra USBLAN for Windows Evaluation driver kit.

4.3.      Installation

4.4.        Hex File Import

The hex file must be imported into MPLAB X.

 

In the import hex section, the three circled areas need to be selected and set correctly.

 

Enter the location and click [Next]:

 

Review the project settings and click [Finish].

 

To actually run the demo:

 

If the above configuration is not done correctly the debug tool will report that the device cannot be found.

You can use this screen to set the correct debug tool

5.     Accessing the USBLAN for Microchip PIC32 Demo

In a web browser enter the address: http://169.254.1.2

6.     Other Microchip PIC32 Demos

The Microchip network demo has various other services you can test with:

  1. ping 169.254.1.2 - ICMP
  2. telnet 169.254.1.2 - simple command processor
  3. telnet 169.254.1.2 9760 - echo ascii in UPPERCASE
  4. telnet 169.254.1.2 9762 – tcp performance test

7.     Related Networking over USB Documentation

 

 Revision Summary

 

Date

Revision History

Revision Class

 

Comments

October 2/13

1.0

 

Published.


Copyright ©2005-2013 Belcarra Technologies (2005) Corp.    

www.belcarra.com    info@belcarra.com


[1] NCM and RNDIS have complex data framing requirements. RNDIS requires emulation of a network interface for the host and support for state machine emulation via device requests to set and access the state of the emulated interface. RNDIS makes periodic statistical requests across the link that competes with useful payload.