Wednesday, June 24, 2015

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]
Exec=x11vnc -display :0 -rfbauth /home/pi/.vnc/passwd -shared -rfbversion 3.3 -forever -bg

Sunday, June 21, 2015

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.

Wednesday, September 10, 2014

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.

Wednesday, June 26, 2013

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://
$ 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.

Sunday, June 23, 2013

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.

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.

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