USB Mesh Node PDF Print E-mail
Written by Jim Kinter, K5KTF   

Wouldnt it be nice to have more storage space on these mesh nodes?

Or maybe to connect a peripheral to do something with?

Along comes the wonders of USB interconnect!


The Broadcom chips HAVE a USB host built in, just waiting to be used !

Linksys/Cisco just didnt bring them out in the older models.


BUT I DID  Wink


HSMM-MESH node with dual USB ports

First things first, I take NO responsibility for any actions you may take on your own equipment. This article is to show what I did. What you do, well, is your own responsibility. Needless to say, once you crack that seal on the bottom of the router, warranty is null and void.


This surgery was performed on a WRT54G V.2. This particular model seemed to be the easiest for a first attempt. Other versions may not be so easy, or may be totally different. YMMV. I found everything I needed to know via Mr. Google. He can help you just as well as I, so go bug him Smile


Now, On to the show.....


After cracking the case open and finding http://www.dd-wrt.com/phpBB2/viewtopic.php?t=64931 , he explained that there are 4 resistors that would need to be changed from 4.7Kohm to 15Kohm to comply with USB specs. They are I think 0603 size (I replaced with 0402 sized and stretched the solder to the pads).


Once you have changed the 4, tack on 4 wires (I used ribbon cable for neatness) to the side of the resistor closest to the Broadcom chip (the other side of the resistor is ground). I brought the ribbon cable up to a 4-pin header so that I can disconnect and remove the front face if needed. I tacked the wires down on the board with some cyano-acrylic and accelerator, so I wouldnt accidentally pull parts/pads.

WRT54G V2 resistors and wires


Onto the pins of the header, I tacked on a 22ohm resistor that USB spec calls for, for ESD protection (supposed to be a diode as well, but I didnt go that far). I then tacked the 4 conductors to the 22ohm'rs.

22Ohm resistors on header


I then brought the conductors from the 4-pin female connector up to the dual-USB connector I mounted in the face of the node. The 2 center pins of each connector are your data lines. the 2 outer pins are +5VDC input and GND. http://pinouts.ru/Slots/USB_pinout.shtml

USB connector


Now, I had a dilemma..... Do I used my last 12->5VDC converter I have here (slated for Mesh webcam use), or just bring up a 5VDC supply from a wall-wart?

I went with the wall-wart. Thats the cable you see entering the side of the node face. Whatever route you take, it should be rated 1/2amp 5VDC or better.


Oh, one major gotcha: Make sure you tie the GND from the USB connector & 5VDC supply GND to the board ground somewhere--I soldered it into one of the GPIO/JTAG via's. If you dont, it just wont work (been there done that).


So, now that the hardware is all done, time to start loading packages. *wringing hands in anticipation*


Its really best if your node has internet access. Makes things go smoother. Either way, you need these packages, preferably in this order:

kmod-usb-core  (main USB driver/pkg)
kmod-usb-ohci   (depends on chip, and this one is ohci)
kmod-usb-storage         (for USB storage)
kmod-fs-ext2    (for EXT2 filesystem)
kmod-usb-serial (for serial usage)
kmod-usb-serial-pl2303  (for the Prolific serial to USB adapter)
swap-utils      (for swapfile stuff)

Once those are loaded, you can plug in a variety of USB stuff and then SSH into your node and do a dmesg.

You should get something similar (in GREEN):

=================================================

usb.c: registered new driver usbdevfs
usb.c: registered new driver hub

eth0.1: add 01:00:5e:00:00:01 mcast address to master interface
PCI: Setting latency timer of device 00:01.0 to 64
wl0: Broadcom BCM4320 802.11 Wireless Controller 4.80.53.0
IPv4 over IPv4 tunneling driver
CSLIP: code copyright 1989 Regents of the University of California
PPP generic driver version 2.4.2
PCI: Setting latency timer of device 00:04.0 to 64
usb-ohci.c: USB OHCI at membase 0xb8004000, IRQ 2
usb-ohci.c: usb-00:04.0, PCI device 14e4:4716
usb.c: new USB bus registered, assigned bus number 1
hub.c: USB hub found
hub.c: 2 ports detected
usb.c: registered new driver serial
usbserial.c: USB Serial support registered for Generic
usbserial.c: USB Serial Driver core v1.4
hub.c: new USB device 00:04.0-1, assigned address 2
usb.c: USB device not accepting new address=2 (error=-145)
hub.c: new USB device 00:04.0-1, assigned address 3
usb.c: USB device not accepting new address=3 (error=-145)
SCSI subsystem driver Revision: 1.00
Initializing USB Mass Storage driver...
usb.c: registered new driver usb-storage
USB Mass Storage support registered.
hub.c: new USB device 00:04.0-2, assigned address 4
hub.c: USB hub found
hub.c: 4 ports detected
usbserial.c: USB Serial support registered for PL-2303
pl2303.c: Prolific PL2303 USB to serial adaptor driver v0.10.1
hub.c: new USB device 00:04.0-2.1, assigned address 5
scsi0 : SCSI emulation for USB Mass Storage devices
Vendor: SanDisk   Model: Cruzer Micro      Rev: 0.1
Type:   Direct-Access                      ANSI SCSI revision: 02
Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0
SCSI device sda: 501759 512-byte hdwr sectors (257 MB)
sda: Write Protect is off
Partition check:
/dev/scsi/host0/bus0/target0/lun0: p1 p2
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 5
eth0.1: no IPv6 routers present
eth0.0: no IPv6 routers present
eth0: no IPv6 routers present
hub.c: new USB device 00:04.0-2.4, assigned address 6
usbserial.c: PL-2303 converter detected
usbserial.c: PL-2303 converter now attached to ttyUSB0 (or usb/tts/0 for devfs)
wl0: no IPv6 routers present
usb.c: USB disconnect on device 00:04.0-2 address 4
usb.c: USB disconnect on device 00:04.0-2.1 address 5
usb.c: USB disconnect on device 00:04.0-2.4 address 6
usbserial.c: PL-2303 converter now disconnected from ttyUSB0
hub.c: new USB device 00:04.0-2, assigned address 7
hub.c: USB hub found
hub.c: 4 ports detected
hub.c: new USB device 00:04.0-2.1, assigned address 8
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 8
hub.c: new USB device 00:04.0-2.4, assigned address 9
usbserial.c: PL-2303 converter detected
usbserial.c: PL-2303 converter now attached to ttyUSB0 (or usb/tts/0 for devfs)
=================================================

For this dmesg output, I had plugged in:


A 4GB USB thumbdrive direct into port2, a Belkin 4-port USB hub into port1, into which I had plugged a SanDisk 256MB thumbdrive and a Prolific USB to serial converter. So thats why all the dmesg stuff is happening because of.

WRT54G V.2 with goodies plugged in


I will be testing a myriad of other USB devices to see what works and what doesnt. Maybe next will be an older USB webcam. Then I could have MANY mesh cams running around, and not have to shell out for IP cams.


For the USB thumbdrives, I plugged each one into my Linux server to partition and format, since the mesh node didnt have the commands loaded yet (space restrictions... yuk)

For the 256MB (used a cheap one first in case I blew it up), I part'd a 100MB as 'Linux Swap' and the rest as EXT2. For the 4GB, it was 1GB swap and the rest EXT2.

Added 2 lines to Status Page


Once I plugged each one into the node, I had to do a 'mkswap /dev/scsi/host0/bus0/target0/lun0/part1' and then 'swapon /dev/scsi/host0/bus0/target0/lun0/part1'. Then I did the same thing for the 4GB stick, but to /dev/scsi/host1/bus0/target0/lun0/part1.

That turned on memory swap !

root@K5KTF-102:~# cat /proc/meminfo
total:    used:    free:  shared: buffers:  cached:
Mem:  14647296 14159872   487424        0  1744896  3751936
Swap: 1126780928        0 1126780928
MemTotal:        14304 kB
MemFree:           476 kB
MemShared:           0 kB
Buffers:          1704 kB
Cached:           3664 kB
SwapCached:          0 kB
Active:           3000 kB
Inactive:         2408 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:        14304 kB
LowFree:           476 kB
SwapTotal:     1100372 kB
SwapFree:      1100372 kB


Also what I plan on doing is figuring out ( https://forum.openwrt.org/viewtopic.php?pid=107664 ) how to move the OS over to the USB stick to get rid of the space limitations of the onboard flash. That article says to find /etc/config/fstab, but uh...not there, so more work deciphering the HSMM-MESH filesystem Laughing



If you try and succeed, feel free to comment, and/or if you have ideas of what to use the USB for, I would love to hear it.


73 !

Jim

K5KTF




Last Updated on Monday, 22 April 2013 21:59
 
SPONSORED AD: