Featured

PhiSch.org Personal Home Page

This is my personal home page, hosting information about some of the hobby projects that I work(ed) on in my spare time. The links in the menu will take you to the individual projects. Enjoy your stay!

Please note: The content on this site is quite old as it has been many years since I worked on the projects. Nevertheless, I have recently migrated the site to WordPress and would like to keep the content online since I’m still getting queries on some of the projects every now and then.

Linux VNC and Mac OS X Screen Sharing

I’ve found that in order to get x11vnc to work with the Mac OS X built-in VNC client (“Screen Sharing Application”), there options are required when starting the VNC server:

$ x11vnc -display :0 -rfbauth /home/pi/.vnc/passwd -shared -rfbversion 3.3 -forever -bg

The -shared option is key here. Judging by the log on the VNC server, I think Mac OS X will attempt multiple connections.

For what it’s worth, here’s also how to auto-start the VNC server when the user logs into the LXDE desktop. Copy and paste this to ~/.config/autostart/x11vnc.desktop:

[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=VNC
Comment=
Exec=x11vnc -display :0 -rfbauth /home/pi/.vnc/passwd -shared -rfbversion 3.3 -forever -bg
StartupNotify=false
Terminal=false
Hidden=false

Working around KiCAD Printing Issues

I’m having issues printing from KiCAD, specifically Pcbnew, on Ubuntu 15.04. I’ve seen similar things on earlier versions, and also found this bug report. Even though the bug report is closed and I’m using the right wx version, the problem persists for me. So I’ve searched for a workaround.

Luckily, “plotting” from KiCAD works which makes it generate a PostScript file for each layer.

However, I need the “Edge Cuts” layer and the bottom copper layer printed on a single page. The reason is that I’m printing my layouts on transparent film, and I’m using alignment marks on the edge cuts layer to help me tape two prints on top of each other. This increases the opaqueness of my print to a point where it’s usable for me.

So here’s the steps it takes to get my PCB layout to a decent print:

  1. “Plot” the required layers from Pcbnew, leaving a bunch of PostScript files on disk.
  2. Convert the PostScript files to PDF:
    $ for ps in *.ps ; do ps2pdf $ps ; done
    
  3. Use pdftk to generate a single PDF from the relevant layers like this:
    $ pdftk layout-B_Cu.pdf background layout-Edge_Cuts.pdf output layout.pdf
    

Update: There’s an option to include the “Edge Cuts” layer when plotting. Simply uncheck the “Exclude PCB edge layer from other layers” option as highlighted in the screenshot below.

Ubuntu 14.04, ThinkPad W520 and multiple Monitors

Here’s a quick reminder of the commands that I use to switch between a single monitor setup (internal laptop screen) and two external, DVI-attached monitors on my ThinkPad W520 running Ubuntu 14.04 (x86_64).

In order to switch to single-screen setup:

phs@W520:~$ disper -s -d DP-2 -r auto
phs@W520:~$ disper -s -d LVDS-1 -r auto

Switching to the two external monitors:

phs@W520:~$ disper -s -d DP-2 -r auto
phs@W520:~$ disper -e -d DP-2,DP-3 -r auto

All of this uses the stock, Ubuntu-provided driver. Didn’t have much success with the nVidia drivers (from the repositories) on this laptop.

Xilinx USB Cable on Ubuntu

Here’s what I did to install the "Xilinx Platform Cable USB II" on Ubuntu.

First, install the following two packages:

$ sudo aptitude install fxload libusb-dev

Then, download and compile the USB driver for the cable:

$ git clone git://git.zerfleddert.de/usb-driver
$ cd usb-driver
$ make
$ make lib32
$ ./setup_pcusb /opt/Xilinx/14.5/ISE_DS/ISE

If everything worked, you should see the status LED on the programmer light up after it’s plugged in.

Programming Avnet Spartan 3A FPGA Eval Board with Linux

I own a small FPGA Board by Avnet with a Spartan 3A FPGA on it. The board is nice, but unfortunately, the flash chips on the board aren’t on the JTAG chain. Instead, there is a small PSoC microcontroller that lets you programm the flashes via UART. There is a Windows tool to perform that programming which is shipped with the board. Here’s what I did to program the SPI configuration flash on Linux.

Via the FPGALibre site, I found a link to a tool called ASTriAEKiPro, which allows me to write to the FPGA SPI Configuration flash via UART and the PSoC microcontroller.

Compiling the tool is as simple as running this command:

$ make

To erase the SPI configuration flash, I used this command:

$ ./astriaekipro -p /dev/ttyACM0 -e
Avnet Spartan 3A Eval Kit Programmer v1.2.1
Copyright (c) 2009 Salvador E. Tropea 
Copyright (c) 2009 Instituto Nacional de Tecnolog�a Industrial
Embedded BPI server provided by Avnet Inc. http://www.em.avnet.com/

Erasing the memory, be patient (>1 minute) ...

To write a configuration to the SPI flash:

$ ./astriaekipro -p /dev/ttyACM0 -w 
  -b ~/sandbox/avnet_lpc/projects/13.3/avnet_lpc/avnet_i2c.bit 
Avnet Spartan 3A Eval Kit Programmer v1.2.1
Copyright (c) 2009 Salvador E. Tropea 
Copyright (c) 2009 Instituto Nacional de Tecnolog�a Industrial
Embedded BPI server provided by Avnet Inc. http://www.em.avnet.com/

Writing 235820 bytes to the serial flash, offset 0x0000000
Erasing: sector   3 (100.00 %)
Bytes written:   235820 (100.00 %)
All written!

Edit Samsung TV Channel List on Linux

Samsung TVs suck when it comes to sorting the channel list. The work-around is to transfer the channel list to a PC and edit/sort it there. To edit the channel list on Linux, I found a tool called "SamyGO ChanEdit" quite useful. Downloadable via this link.

The tool requires SWT which is installed in /usr/lib/java on my system. To start the tool, used the following command:

java -classpath .:/usr/lib/java/swt-gtk-3.8.2.jar:SamyGO-ChanEdit-v54cd.jar gui.Main

Grails, an In-Memory HSQL Database and Squirrel

Starting the HQSL Database

java -cp c:grails-1.2.0libhsqldb-1.8.0.10.jar org.hsqldb.Server -database.0 mem:devDB -dbname.0 devDB

Accessing the DB

java -cp c:grails-1.2.0libhsqldb-1.8.0.10.jar org.hsqldb.util.DatabaseManager

Grails database connection information, in DataSource.groovy

dbCreate = "create-drop"
url = "jdbc:hsqldb:hsql://localhost:9001/devDB"
username = "sa"
password = ""

Squirrel wouldn’t start until I correctly quote the CLASSPATH environment variable.