Connect the USB browser device

… visits
Parent Previous Next

For your first test, use the built-in page and one simple value. Browser mode needs more RAM than HID or CDC, so check that your selected PIC and settings fit.

Network tab with subnet 7, device number 1, a single legacy value, browser input slots disabled, and the built-in page selected.

Start with the built-in browser page and a simple value. With subnet 7, open http://192.168.7.1/ after the USB network connection is ready. Browser mode uses foreground polling. Use this picture to find the controls; generate your own code and memory settings. Do not copy the pictured allocation figures.

  1. Select the exact PIC and its working clock configuration in the Device tool. Select USB browser (RNDIS), which generates USB_MODE = 3.
  2. Check the memory estimate. Browser mode needs an eligible PIC18 J53/J94 device with a 3328-byte ordinary-RAM region, or a supported PIC24/dsPIC with at least a 4096-byte shared unpaged-RAM budget. The tool checks the selected device. Your application, compiler temporaries and chosen value capacities still need to fit; the minimum eligibility does not guarantee every configuration fits.
  3. Use Polling, TX 64 bytes, RX 64 bytes, and control/EP0 16 bytes. Browser mode requires single USB buffers, ping-pong disabled and remote wake disabled. Do not add a USB ISR to this mode.
  4. Set the Network options below, copy Integration, and keep its device-specific clock, register and fuse setup.
  5. Compile, program and connect the PIC. Allow the operating system to configure its USB network adapter. Start with the built-in page before designing another page.

Network option

What to enter and what it changes

Private subnet — USB_NET_SUBNET

A number from 1 to 254. With 7, the PIC is 192.168.7.1 and the PC receives 192.168.7.2, with mask 255.255.255.0. Choose a subnet unused by the PC's other connections.

Unique device number — USB_NET_MAC_ID

A nonzero number from 1 to 4294967295. It creates locally administered MAC addresses for the USB network. Give different physical units different numbers and unique USB serial strings.

Browser page title — USB_NET_TITLE

1–48 plain ASCII characters for the built-in page. Avoid HTML markup such as <, > and &. Imported HTML supplies its own title.

Value capacity — USB_NET_MAX_VALUES

0 for one unsigned USB_NetValue, or any capacity from 1 through 16 for named values. Capacity reserves RAM.

Values per response — USB_NET_INITIAL_COUNT

In named mode, how many leading values /status initially includes: 0 through the selected capacity.

Value 1 name, etc. — USB_NET_NAME_1, etc.

JSON field names. Use 1–16 ASCII letters, digits or underscores; start with a letter or underscore. Names must be unique and are case-sensitive. Tool value 1 corresponds to API index 0.

Browser input slots — USB_NET_RX_VALUES

0 disables writes; any number from 1 through 16 reserves that many independent input mailboxes.

Page layout, Firmware pages, Allowed page origin

Choose where the page lives and which pages are available; see Choose where the page lives for these settings.

Total custom response bytes

A calculated size, including HTTP headers, for the active firmware pages. Check the final compiler flash report too.

Open http://192.168.7.1/ for the default built-in page. Changing the subnet changes the address; it does not register an Internet domain name. The page title, USB product string, MAC address, Windows connection name such as Ethernet 2, and Windows network description are different things. Setting the page title does not rename the Windows adapter or remove Unidentified network.

See also

Created with the Personal Edition of HelpNDoc: Elevate Your Documentation Process with HelpNDoc's Advanced Features