If your DigiSpark is no longer getting programmed from the Arduino IDE, when plugging it in, you might have to re-program the Micronucleus bootloader. You can do this using the Raspberry Pi if you do not have an AVR programmer.

Preperation

Install the AVRDUDE programmer on the Raspberry Pi:

apt-get install avrdude

Copy the default AVRDUDE configuration file to your home directory.

cp /etc/avrdude.conf ~/avrdude_gpio.conf
nano ~/avrdude_gpio.conf

Add this to the end of the file to make AVRDUDE use the Raspberry Pi GPIO port as programming port.

# Raspberry PI GPIO configuration for avrdude.
# Change the lines below to the GPIO pins connected to the AVR.
programmer
  id    = "rpi";
  desc  = "Use the Linux sysfs interface to bitbang GPIO lines";
  type  = "linuxgpio";
  reset = 12;
  sck   = 24;
  mosi  = 23;
  miso  = 18;
;

Next, download the Micronucleus bootloader file called micronucleus-1.06.hex.

wget https://github.com/micronucleus/micronucleus/raw/80419704f68bf0783c5de63a6a4b9d89b45235c7/firmware/releases/micronucleus-1.06.hex

Connect the DigiSpark to the Raspberry Pi using the table below.

AVR pin name DigiSpark pin name RPI pin name RPI pin number
ICSP VCC 5V 5V 2
ICSP GND GND Ground/GND 6
ICSP RESET P5 GPIO #12 32
ICSP SCK P2 GPIO #24 18
ICSP MOSI P0 GPIO #23 16
ICSP MISO P1 GPIO #18 12

When the DigiSpark is connected run this command from your home directory to program the AVR with the bootloader.

sudo avrdude -p attiny85 -C avrdude_gpio.conf -c rpi -U flash:w:micronucleus-1.06.hex:i -U lfuse:w:0xF1:m -U hfuse:w:0x5F:m

AVRDUDE should respond something like this:

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e930b
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "micronucleus-1.06.hex"
avrdude: writing flash (8162 bytes):

Writing | ################################################## | 100% 1.28s

avrdude: 8162 bytes of flash written
avrdude: verifying flash memory against micronucleus-1.06.hex:
avrdude: load data flash data from input file micronucleus-1.06.hex:
avrdude: input file micronucleus-1.06.hex contains 8162 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 1.09s

avrdude: verifying ...
avrdude: 8162 bytes of flash verified
avrdude: reading input file "0xF1"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xF1:
avrdude: load data lfuse data from input file 0xF1:
avrdude: input file 0xF1 contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: reading input file "0x5F"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0x5F:
avrdude: load data hfuse data from input file 0x5F:
avrdude: input file 0x5F contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified

avrdude: safemode: Fuses OK (E:FE, H:5F, L:F1)

avrdude done.  Thank you.

After which the Arduino IDE should be able to program it again.

I needed a second screen for my netbook, as the screen real estate was not large enough for working with QT creator comfortably. I did not want (and did not have) a 5 meter VGA cable crossing the living room, but I wanted to use my TV as the second monitor.

I grabbed my Raspberry Pi B, a 2GB SD-card i had in the spares, and set out to configure the Raspberry Pi to mirror the screen on the TV from the network.

I tried using a protocol of X, called XDMX, that is designed to do what I wanted. I used much time, and had inconsistent results. I am sure that the problems where all of the wetware kind, but the documentation seems really sparse, and that does not help.

The solution for now, is less elegant. I installed a basic LXDE environment on the Raspberry Pi. Shared the keyboard and mouse using Synergy, and run the X applications on the netbook, through a ssh tunnel from the Raspberry Pi.

First things first, an OS (Raspberry Pi).

The standard Raspbian image will not fit on the 2GB card I had, but The minimal Raspbian unattended netinstaller comes to the rescue.

Simply download the installer image, write it to the SD-card, and boot the Pi, with it. Instructions for doing this can be found in the README. ua-netinst will start installing a Raspbian system, from the Internet, this takes a while.

I then lost my whits and asked the Pi to install a full lxde environment, it took ages! After starting from scratch, I added myself as a user, and installed X and a minimal LXDE environment.

adduser username

apt-get install keyboard-configuration  
apt-get install xserver-xorg
apt-get install lxde-core
apt-get install xinit

and Synergy

apt-get install synergy

Synergy (control node).

Synergy acting as a server, needs a configuration file in /etc/synergy.conf to setup the layout.

I have the Raspberry Pi (connected to the TV) with the host name pi, and the netbook called ace2 (the alias section). The TV is left of the netbook.

section: screens
        pi:
        netbook:
end

section: links
        pi:
                left = netbook
        netbook:
                right = pi
end

section: aliases
    netbook:
        ace2
end

Start the Synergy server.

synergys

Final step (Raspberry Pi).

I needed to run QT creator on the TV, but you can run any X application. Complex things like video and fancy GUIS, are slow. Probably due to missing hardware acceleration and network speed.

I start the Synergy client, after which the netbook mouse and keyboard works on the Pi as well.

synergy (IP address of the controlling computer)

Then I ssh into the the netbook with X tunneling and compression, and start the program that I want to use. I now have the program (qtcreator) running on the TV, but can use the netbook keyboard and mouse to control it.

ssh -CX (IP address of the controlling computer)
qtcreator

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

2015 August update

There are now a couple of alternative drivers, and an in kernel one, from 4.2 on.

Kernel version URL
from 3.0 https://github.com/porjo/mt7601
Between 3.19 and 4.2 https://github.com/kuba-moo/mt7601u
From 4.2 Included in kernel as mt7601u

Old MediaTek driver

The driver is available at MediaTek's download page here (there is an error on that page, select 71610U for linux. Link. Find the one called "MT7601U USB". I have the file mirrored here.

These instructions 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

Prepare 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.

Generated on 2017-10-10 09:11:09.761970