I bought an USB WIFI dongle, on ebay, to use with the Raspberry Pi. I thought the chip was a Ralink chip which is supported, but it turned out it was a MediaTek MT7601.

Bus 001 Device 005: ID 148f:7601 Ralink Technology, Corp.

All this is for Raspian and I have gathered all the steps needed here.

Driver

The driver is available at their web side download page here. Find the one called "MT7601U USB". I have the file mirrored here.

These instructions to work for building the driver.

Become root.

sudo -s

Download latest updates.

apt-get update
apt-get upgrade
rpi-update

Download linux kernel source, this is needed to compile the driver module.

cd /usr/src
git clone https://github.com/raspberrypi/linux.git
sudo ln -s /usr/src/linux /lib/modules/`uname -r`/build
cd linux

Compile the kernel with the current kernel config from the running system.

make mrproper
zcat /proc/config.gz > .config
cp .config .config.org
make modules_prepare

Download the module symbols of the current kernel, to avoid having to recompile the kernel.

wget https://raw.github.com/raspberrypi/firmware/master/extra/Module.symvers

Get the MT7601 USB driver into your home directory. Then, lets uncompress the file.

cd ~ 
tar -xvjpf DPO_MT7601U_LinuxSTA_3.0.0.4_20130913.tar.bz2 
cd DPO*

The default driver is really noisy and spits out a lot of debug information. This behaviour can be stopped by changing a line in os/linux/rt_linux.c from:

ULONG RTDebugLevel = RT_DEBUG_TRACE;

to:

ULONG RTDebugLevel = 0; // RT_DEBUG_TRACE;

Finally build the driver and install it.

make
make install

Raspbian configuration

Configure the ra0 interface for DHCP and make it start at boot. Edit /etc/network/interfaces to look like:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

auto ra0
allow-hotplug ra0
iface ra0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Then add your WIFI name and key to /etc/wpa_supplicant/wpa_supplicant.conf.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="YOURWIFINAME"
        key_mgmt=WPA-PSK
        psk="YOURPASSWORD"
}

The wireless network is then brought up by:

ifup ra0

or a reboot.

I was given a Medion MD86517 NAS without a drive for free. I wanted to put a 2.5" disk in it, and use it as a web-server. The NAS runs Linux, and the sources are here.

A large part of the installation was done on a regular Gentoo x86/x64 PC, using a SATA to USB converter. Start with a clean drive with no partitions, connected to the host computer (Not the NAS).

During the install, I have aimed to have all files needed for a new intall, located on the NAS drive itself, in the hopes that it will make a reinstall, easier. You can of course remove these files from /usr/src, if you do not want this.

Much of this stuff needs root permissions, and all the NAS side stuff is done through a serial connection. If something is unclear, read The Gentoo handbook, this is in esence the same procedure, except I boot into the system instead of chrooting.

A lot of thanks and credit to the people in this thread, without whom I would never have gotten on the right track.

Partitioning

To boot from the SATA disk, a special partition layout is needed. The ox820 reads the start of the drive, to check if it is bootable. A script has been written to put the right data in the first part of the hard disk. Download disk creation files created by WarheadsSE, extract the files somewhere, and enter that directory. Edit the disk_create script to change the target drive in the variable disk.

Creating the partitions

Prepare the disk using WarheadsSE's tool.

./disk_create

Fire up fdisk to partition the disk.

fdisk -c=dos /dev/sdb
  • Create a small partition for U-Boot, stage1, and the kernel. WarheadsSE recommends a 10M partition. This partition must start at sector 2048.

  • Create a second partition for the root file system, leave a little space left for a swap partition.

  • Create a third partition for swap space. Set it as swap type.

Format the second and third partition, I use ext4 as the root file system.

mkfs.ext4 /dev/sdb2
mkswap /dev/sdb3

Last, mount the second partition to /mnt/gentoo, your partition may have another designation than /dev/sdb.

cd /mnt
mkdir gentoo
mount /dev/sdb2 /mnt/gentoo

Root file system

Download a stage 3 Gentoo for ARM5, and extract it to /mnt/gentoo. Though the processor is ARM6 compatible, I could not get it to boot beyond the kernel using and ARM6 stage 3.

tar -xvjpf stage3-armv5tel-20140115.tar.bz2 -C /mnt/gentoo

Set the baud rate in /mnt/gentoo/etc/inittab to 115200. Change:

#s0:12345:respawn:/sbin/agetty -L 9600 ttyS0 vt100

to:

s0:12345:respawn:/sbin/agetty -L 115200 ttyS0 vt100

Copy resolv.conf from your host /etc directory, to have DNS working.

cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf

Create a link from net.lo to net.eth0 to enable the network at first boot.

cd /mnt/gentoo/etc/init.d
ln -sf net.lo net.eth0

Edit /mnt/gentoo/etc/fstab to set the devices for the root and swap file system. The file should contain something like this:

#/dev/BOOT              /boot           ext2            noauto,noatime  1 2
/dev/sda2               /               ext4            noatime         0 1
/dev/sda3               none            swap            sw              0 0
#/dev/cdrom             /mnt/cdrom      auto            noauto,ro       0 0
#/dev/fd0               /mnt/floppy     auto            noauto          0 0

Copy passwd and shadow from the running system to have your logins and passwords when you boot the NAS.

cp /etc/passwd /mnt/gentoo/etc/passwd
cp /etc/shadow /mnt/gentoo/etc/shadow
cp /etc/group /mnt/gentoo/etc/group

Select mirrors for portage.

mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf
mirrorselect -i -r -o >> /mnt/gentoo/etc/portage/make.conf

Set the timezone.

echo "Europe/Copenhagen" > /mnt/gentoo/etc/timezone

Set the hostanme.

nano -w /mnt/gentoo/etc/conf.d/hostname
nano -w /mnt/gentoo/etc/hosts

Set the keymap (just in case).

nano -w /mnt/gentoo/etc/conf.d/keymaps

Last edit and change UTC to local if needed.

nano -w /etc/conf.d/hwclock

Kernel

You will need an ARM cross-compiler, Gentoo's crossdev comes in handy.

crossdev -t armv5tel-softfloat-linux-gnueabi

Clone linux-oxnas into /mnt/gentoo/usr/src.

cd /mnt/gentoo/usr/src
git clone https://github.com/kref/linux-oxnas
ln -sf linux-oxnas linux

cd linux-oxnas
make ARCH=arm ox820_defconfig CROSS_COMPILE=armv5tel-softfloat-linux-gnueabi-
make ARCH=arm menuconfig CROSS_COMPILE=armv5tel-softfloat-linux-gnueabi-

Boot options --->
[*] Use appended device tree blob to zImage (EXPERIMENTAL)
[*] Supplement the appended DTB with traditional ATAG information
disable PCI support if you device does not have one

Remember to compile in support for the root file system type, if you did like me this means enabling the ext4 file system.

File system  --->
<*> The Extended 4 (ext 4) filesystem

Compile and create kernel image.

make ARCH=arm zImage ox820-pogoplug-pro.dtb CROSS_COMPILE=armv5tel-softfloat-linux-gnueabi-

cat arch/arm/boot/zImage arch/arm/boot/dts/ox820-pogoplug-pro.dtb > arch/arm/boot/zImage.fdt

scripts/mkuboot.sh -A arm -O linux -C none -T kernel -a 0x60008000 -e 0x60008000 -n 'Linux-3.11.1+' -d arch/arm/boot/zImage.fdt arch/arm/boot/uImage

Final disk creation

Copy WarheadsSE's disk creation files (contents of onax-sata-boot.tar.gz) to the /mnt/gentoo/usr/src.

mkdir /mnt/gentoo/usr/src/disk_create
cp -Rv (Where you unpacked the files)/* /mnt/gentoo/usr/src/disk_create

Integrate the new kernel into WarheadsSE's tool.

cd /mnt/gentoo/usr/src/disk_create
cp /mnt/gentoo/usr/src/linux-oxnas/arch/arm/boot/uImage uImages/gentoo
rm uImage
ln -sf uImages/gentoo uImage
./disk_create

Preparing for first boot

Unmount and sync the disk.

cd /
umount /mnt/gentoo
sync

Remove the drive from the host computer and physically install it in the NAS.

First Boot

Set the clock. MMDDhhmmCCYY is month, date, hour, minute, century, year

date MMDDhhmmCCYY

Get the portage tree.

emerge --sync

Set the Profile.

eselect profile list

I selected default/linux/arm/13.0/armv5te.

eselect profile set 18

Configure the locales, first put the locales you want supported in locale.gen.

nano -w /etc/locale.gen

Generate the locales and select the system-wide one.

locale-gen
eselect locale list
eselect locale set *locale nr.*
env-update && source /etc/profile

Add the network interface to the startup.

rc-update add net.eth0 default

Update and install some needed stuff.

emerge -uDNv world ntp cronie syslog-ng openssh logrotate dhcpcd

Add it to the startup.

rc-update add syslog-ng default
rc-update add cronie default
rc-update add sshd default
rc-update add ntp-client default
rc-update add swclock boot
rc-update del hwclock boot

The end

You now have a basic Gentoo system running, from here you can install a web server, a DLNA server, or whatever you want.

A friend of mine had an iPhone 3 that was getting really flaky, it was still running IOS 3.1.2 as she was afraid to update, things could go wrong, she could lose all her texts. What she wanted was essentially a PDF with her messages.

I went searching and found some tools ranging in price from $5 to $20, but I was stubborn and cheap, and wanted another solution. There are some free services where you upload a file from an iTunes backup to some web application and it'll extract the texts for you. Neither I, nor my friend wanted all her texts uploaded to a service on the net.

From there I found out the file, that the web app uses, is actually an SQL database file. If you ask iTunes to make an unencrypted backup to your local drive, most of the backup files are actually in easily understandable formats like SQL and jpeg. The location of these files are:

  • Windows XP: \Documents and Settings\USERNAME\Application Data\Apple Computer\MobileSyncBackup\
  • Windows Vista, 7 or 8: \Users\USERNAME\AppData\Roaming\Apple Computer\MobileSync\Backup\
  • MacOS X: \~/Library/Application Support/MobileSync/Backup/

It turns out the file named 3d0d7e5fb2ce288813306e4d4636395e047a3d28.mddata is in fact an SQL database file with all text messages in the backup. After eyeballing the file with SQLite Database Browser, exporting it to a CSV file, importing it in LibreOffice Calc, I found it hard to manage the more than 30,000 messages that way.

In the end I made a python script that saves the messages to text files, each having the address (phone nr.) of the person you were conversing with. I am unsure how it handles MMS messages, I know that the multimedia content is lost, and I think the text is lost aswell, but I don't know. The result is here:

GitHub link

When using the Enrf24 library with Enegia these are the connections for the NRF24L01 module.


NRF24L01 MSP430 Stellaris
GND GND GND
VCC VCC VCC
CE P2.0 PE1
CSN P2.1 PE2
SCK P1.5 PD0
MOSI P1.7 PD3
MISO P1.6 PD2
IRQ P2.2 PE3

As I have mentioned, I am building a MIDI controller using the PIC18F4550. The controller has a MIDI in port, and acts as a MIDI to USB converter as well.

Features:

  • 10 potentiometers (knobs)
  • MIDI in
  • USB MIDI interface

Missing hardware:

  • Drill and mount the front panel
  • Create and mount the PCB
  • Mount the guts in the case

Missing firmware:

  • Active sense handling
  • MIDI channel selection

As always more details, source code, schematic, and PCB will follow.

I am in the process of building a MIDI USB device, using a PIC18F4550. I have trimmed the Microchip USB framework MIDI example, and is using this code as my base. It is a blessing to not have to code the entire USB stack with descriptors, from scratch, but it is a pain using someone elses code, and learning to use this framework as a sort of black box.

The goal is a combined MIDI to USB converter and knob box.

MIDI

MIDI is an interface for sending musical notations and messages through a wire. I will only brush up on the protocol of MIDI in this text.

A MIDI message consists of a status byte and up to 2 data bytes, the protocol is serial, and runs at 31250 baud. A table with all messages can be found here. On thing that was not obvious to me was that only the bytes needed are send, no zeroes. As an example an "active sense" message only sends the status byte. This may seem obvious, but starting from the USB side of this stuff made it seem otherwise.

Another thing that I wasted a fair amount of time discovering, is "running status". When you sent the same voice or mode command multiply times you can omit the status byte from all but the first message.  An example, you want to sent "note on" on channel 1, key number 60, and a velocity of 128, when a key is pressed. Then "note on" on channel 1, key number 60, and a velocity of 0, when a key is depressed. For the second package you only send the data, e.g. key number 60, velocity 0, the receiver assumes the status and channel are the same as the first message.

USB MIDI

MIDI packages on the USB cable are 4-byte fixed length packages, unused bytes are zeroed. The first byte is the cable number (16 virtual cables) and the Code Index Number, which acts sort of the same as the first 4 bits of a MIDI status. The following 3 bytes are an ordinary midi message. The standard is here.

MIDI to USB MIDI

For a long time, a note on page 17 of the USB MIDI standard eluded me. I thought that since the  Code Index Number almost mirrors the ordinary status of a MIDI message, I would have to parse and classify every message coming from the MIDI port. It turns out that you can send each byte received along without out classifying it, and set the Code Index Number to 0xF. Using this Code Index Number every byte received on the MIDI port is simply packaged in a 4 byte package, first 4 bits, the cable number, then 0xF, then the byte from the MIDI port, and in the end padded with 2 zero bytes.

I have some PIC18F4550s lying around, and I want to play with the USB features of this chip, therefore I made this breakout board. It contains enough components to get the PICMicro running, and nothing more, all the pins are routed to pin-headers to use with an experimenter board.

Features:

  • ICSP connector (In-Circuit Serial Programming, AKA PicKit 2 & 3)
  • USB-B Connector
  • 20Mhz clock crystal


Eagle files:  PIC18F4550 USB ICSP breakout board

Generated on 2014-07-03 14:24:15.009382