Thursday, 12 July 2012

Raspberry Pi - How to connect Novatech Nano USB Wifi

Raspberry Pi - How to connect Novatech Nano USB Wifi

Pre-requsites

  •     Raspberry Pi ( doh )
  •     working lan connection
  •     internet access to get and update packages
  •     Base RPI Debian image
Novatech has a nano usb wifi dongle Model No.  NWU275v2 that I thought would be perfect for for Raspberry Pi due to is small ( nano! ) size and low power consumption.  Obviously, I checked the “Verified hardware”(1) section on the RPI website and it wasn’t listed - damn.

So god knows if its going to work - let’s find out.

Hunting down the drivers


After hunting down the “User manual”(2) I found via a screen shot of a windows driver that it (apparently) uses a rtl8139 chipset and Debian supports that by default via the “realtek-firmware” package.  Result! But no...

On plugging in the device and booting up the RPI it locked on the  “Calling CRDA to update world regulatory domain” ( seems to be about a 3 min wait ) but then continues the boot up. But it doesn’t work.

So, I tried running

> lsusb 
and the terminal hangs on the under the hood modprobe call - nice - not!

So, after killing the process I tried a different route via

> lsmod
rtl8192cu
rtl8192_common
rtlwifi
etc


and this told me that actually its a rtl8192c chipset not as per the manual - typical!

and

> dmesg
log proves that it is a realtek

usb 1-1-3: New USB device found, idVendor=0bda, idProduct=8176
...
usb 1-1-3: Product: 802.11n WLAN Adapter
usb 1-1-3: Manufacturer: Realtek

But


> sudo ifconfig wlan0 up
gives

wlan0: ERROR while getting interface flags: No such device
meaning driver has failed - damn.

Drivers don't work so get some new ones


After hunting around we find out that the realtek drivers in this Debian are out of date(3) so the way to fix this is as follows:

> sudo nano /etc/modprobe.d/blacklist.conf
and add a line to the file so:


blacklist rtl8192cu
Then, get a compiled version of the driver for ARM6 based processors from (4):

> wget http://www.electrictea.co.uk/rpi/8192cu.tar.gz
> tar xf 8192cu.tar.gz
> sudo install -p -m 644 8192cu.ko /lib/modules/3.1.9+/kernel/drivers/net/wireless/
> sudo depmod -a
Now reboot to for the settings to take effect:
> sudo shutdown -r now

wait for the magic...

Now, to confirm the new kernel driver has worked:

> lsmod - shows 8192cu working
> lsusb - also shows working and more importantly doesn’t fail and lock up anymore
> sudo ifconfig wlan0 up - to initialise the driver
> sudo iwlist wlan0 scanning - to check that the device can scan for local networks

now I get a list of local available networks - joy!

Working adapter - now to configure the connection

So, now working  need to config to auto-magically reconnect to my locked down wifi each time it starts up, hence:

> sudo iwconfig wlan0 essid <YOUR_SSID>
> sudo apt-get install dhcpcd - install a DHCP client daemon
> sudo dhcpcd wlan0
Now you can configure your interfaces file:

> sudo nano /etc/networks/interfaces
and add the following lines to auto start your wlan at startup as per (5):

auto wlan0
iface wlan0 inet dhcp
( for unsecured use )

wireless-essid <YOUR_SSID>
( fine for unsecured network but yours should be - if not WHY NOT!! )

wpa-ssid <YOUR_SSID>
wpa-psk <YOUR_KEY/PASSPHRASE>
> sudo ifup wlan0 - to bounce your configuration and now you should see a connection and an IP address

Success! We are connected wirelessly!

Hope this helps other people with the similar problems.

Additional - How to setup SSH access


Setting up an SSH daemon, RSA keys and connection is not as obvious as it could be so here goes...

> sudo bash
> ssh-keygen -t rsa
> <enter> <enter>
This will then save the required file and passphrase on you Raspberry Pi.

You’ll then be asked where you wish to save it, don’t type anything, just hit return

Do the same for the passphrase too, just hit enter.

A pattern will come up on the screen to confirm that a new key was successfully generated.
Your public RSA has now been created and we can activate the SSH.

To do this type this command to both enable SSH and configure to boot by default:

> sudo mv /boot/boot_enable_ssh.rc /boot/boot.rc
Now shutdown and reboot to check its all worked.

> sudo shutdown -r now
At this point SSH is now ready to be used.  To test first find out your current IP address using:


ifconfig -a
find IP address usually 192.16.1.X or 192.168.2.X

Connect with your favourite ssh client ( putty on windows )

And off you go!

References ( Correct as of 20120710 )

  1. http://elinux.org/index.php?title=RPi_VerifiedPeripherals
  2. http://www.addon-tech.com/new/system/uploads/USB_User%20Manual.pdf
  3. http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=5590&p=74678&hilit=realtek+rtl8192#p74678
  4. http://www.electrictea.co.uk/rpi/8192cu.tar.gz
  5. http://wiki.debian.org/WiFi/HowToUse
This is, in the first instance, just for me to track my work on trying to do some PSP-dev work.

I heard that this super-clever dude called fanjita had cracked various levels of the firmware for the PSP but was still waiting to crack 2.6. Which I upgraded too mainly because I went through the whole x-box modding thing and wanted pure soft-mods for a change rather than getting out the soldering iron! Soldering iron near my beloved PSP.... **NEVER**!!!

So, when fanjita cracked the 2.6 vai the GTA gamesave exploit, I got very interested.

I found and downloaded the latest version from ww.fanjita.org (at time of writing 0.95) got got some homebrew working! Excellent!

*Then* I found about PSPSDK... So I downloaded the PSPSDK-1.0+beta 2 from www.ps2dev.org, then cygwin and the PSPtoolchain allow compiling of PSP source on a PC but targeting the compiler for creating PSP compatible binaries in the form of EBOOT.PBP.

Phew. Still alive. Just.

Did a HelloWorld and..... IT WORKED!

WOW.

Note to self: include links to PSPToolChain to get the latest easily.

Right, now to try some graphics and generate a fractal, just a Mandelbrot, but i love em.

Thursday, 5 May 2011

usb stick sized computer for £15 anyone??

Now this is more like it - lightweight computers that are throwaway but cheap enough to give away:

Provisional specification:

700MHz ARM11
128MB of SDRAM
OpenGL ES 2.0
1080p30 H.264 high-profile decode
Composite and HDMI video output
USB 2.0
SD/MMC/SDIO memory card slot
General-purpose I/O
Open software (Ubuntu, Iceweasel, KOffice, Python)

hdmi output and usb input

http://www.raspberrypi.org/

usb stick sized computer for £15 anyone??

Now this is more like it - lightweight computers that are throwaway but cheap enough to give away:

Provisional specification:

700MHz ARM11
128MB of SDRAM
OpenGL ES 2.0
1080p30 H.264 high-profile decode
Composite and HDMI video output
USB 2.0
SD/MMC/SDIO memory card slot
General-purpose I/O
Open software (Ubuntu, Iceweasel, KOffice, Python)

hdmi output and usb input

http://www.raspberrypi.org/

usb stick sized computer for £15 anyone??

Now this is more like it - lightweight computers that are throwaway but cheap enough to give away:

Provisional specification:

700MHz ARM11
128MB of SDRAM
OpenGL ES 2.0
1080p30 H.264 high-profile decode
Composite and HDMI video output
USB 2.0
SD/MMC/SDIO memory card slot
General-purpose I/O
Open software (Ubuntu, Iceweasel, KOffice, Python)

hdmi output and usb input

http://www.raspberrypi.org/

usb stick sized computer for £15 anyone??

Now this is more like it - lightweight computers that are throwaway but cheap enough to give away:

Provisional specification:

700MHz ARM11
128MB of SDRAM
OpenGL ES 2.0
1080p30 H.264 high-profile decode
Composite and HDMI video output
USB 2.0
SD/MMC/SDIO memory card slot
General-purpose I/O
Open software (Ubuntu, Iceweasel, KOffice, Python)

hdmi output and usb input

http://www.raspberrypi.org/

usb stick sized computer for £15 anyone??

Now this is more like it - lightweight computers that are throwaway but cheap enough to give away:

Provisional specification:

700MHz ARM11
128MB of SDRAM
OpenGL ES 2.0
1080p30 H.264 high-profile decode
Composite and HDMI video output
USB 2.0
SD/MMC/SDIO memory card slot
General-purpose I/O
Open software (Ubuntu, Iceweasel, KOffice, Python)

hdmi output and usb input

http://www.raspberrypi.org/