Thursday, February 2, 2017

Export gEDA PCB layout to DXF (on Windows)

I'm now running gEDA PCB on Windows and there is an easier way to convert the layout to DXF than the procedure described in my (much!) earlier post.

1. Export the layout from PCB to Postscript with all layers in one file (i.e. "multiple files" NOT checked).
2. Open the .ps file with GSView. Make a note of the page numbers for the outline and top assembly.
3. Select "File" "Extract..." and select the outline and top assembly layers and save those layers to a separate file (e.g. pcb.assembly.ps).
4. Convert the .ps file to DXF with pstoedit (http://www.pstoedit.net) using "pstoedit -f dxf pcb.assembly.ps pcb.dxf".

Note that my version of GSView seems to display the layer/page names incorrectly in the "Select Pages" dialog when extracting (that's why I said to note the pages numbers in step 2 above).

Also, if you have components on both sides of the board it is more useful to export each side as a separate DXF file, because there is no height information and the top and bottom assemblies do not line up correctly (they are rotated 180 degrees from each other in my file).

Sunday, September 16, 2012

Lilliput UM-80/C/T USB display with a Winmate I931 running Debian Linux

After quite a lot of experimentation and even more Googling, I have managed to get a Winmate I931 (Intel Atom based) PC board running Debian Linux with a Lilliput UM-80/C/T USB display as the only display device connected to the board.

Some of the problems I had to overcome along the way:
  • I didn't really want to have to compile and install drivers. Fortunately Debian "wheezy" has the drivers, so I upgraded to that.
  • The I931 uses the integrated graphics controller in the Intel US15W XL chipset. Sometimes this comes up as /dev/fb0 and the USB display comes up as /dev/fb1, but sometimes they come up the other way round, so I had to use udev to create a symbolic link the the correct /dev/fb* for the USB display.
Note that when the board boots you will not see any of the console output unless you have a monitor connected to the VGA connector.

Here's what I did to configure the system:

Install X and a window manager (I'm using fluxbox):
apt-get install xorg
apt-get install fluxbox




/etc/X11/xorg.conf seems to be deprecated and is replaced by files in /usr/share/X11/xorg.conf.d/
Create an X config file, in /usr/share/X11/xorg.conf.d/, as per http://plugable.com/2011/12/23/usb-graphics-and-linux/, but make the "fbdev" setting "/dev/fbdl":

/usr/share/X11/xorg.conf.d/60-displaylink.conf
Section "Device"
  Identifier "uga"
  driver "fbdev"
  Option "fbdev" "/dev/fbdl"
  Option "ShadowFB" "off"
EndSection

Section "Monitor"
  Identifier "monitor"
EndSection

Section "Screen"
  Identifier "screen"
  Device "uga"
  Monitor "monitor"
EndSection

Section "ServerLayout"
  Identifier "default"
  Screen 0 "screen" 0 0
EndSection


Configure udev to create a symbolic link to the DisplayLink framebuffer device by creating the following file:
/etc/udev/rules.d/80-displaylink.rules
# Match DisplayLink USB display
KERNEL=="fb[0-9]*", SUBSYSTEMS=="graphics", ATTR{name}=="udlfb", SYMLINK+="fbdl"


With the USB display plugged in the display should go green. That will prove that the udlfb driver is running. You should also see that you have the devices /dev/fb0, /dev/fb1 and /dev/fbdl. The first two will be the framebuffer devices for the integrated graphics and the USB display, the last is the symbolic link to the USB display device.

Then  run 'startx' and you should get fluxbox running on the USB display.
The main monitor can still be used for the console multi-screens (ctrl-alt-F2 etc).
The USB display comes up as tty7 on a standard install.


Thursday, January 20, 2011

USB over-current errors with Linux on Intel DG945GCLF motherboard

I am running Debian Linux (5.0 Lenny) on an Intel DG945GCLF motherboard (this motherboard uses an Atom processor).
For some time now it has been continuously logging the following errors to syslog:
[ 15.454952] hub 5-0:1.0: over-current change on port 5
[ 15.558479] hub 5-0:1.0: over-current change on port 6
[ 15.664655] hub 3-0:1.0: over-current change on port 1
[ 15.768627] hub 3-0:1.0: over-current change on port 2
[ 15.935055] hub 5-0:1.0: over-current change on port 5
[ 16.038614] hub 5-0:1.0: over-current change on port 6
[ 16.142621] hub 5-0:1.0: over-current change on port 5
[ 16.253517] hub 5-0:1.0: over-current change on port 6
[ 16.357561] hub 3-0:1.0: over-current change on port 1

These errors keep the disk pretty busy and slow the system down.
My first thought was that there was a hardware problem, but I still get the errors when there are no USB devices plugged in.
After much googling and frustration I found a suggestion on the net to upgrade the BIOS and that finally fixed the problem.

Upgrading the BIOS on an Intel motherboard is very easy if you have a CD drive to boot off.
Go to the Intel downloads centre http://downloadcenter.intel.com/default.aspx
Select "Desktop Boards", "Intel 945 Express Chipset Family Boards", "Intel Desktop Board DG945GCLF" then select "BIOS" for the download type. Find the BIOS update that ahs a status of "Latest" and click on that update. Then find the ISO file and download that (as of 21st Jan 2011 the file is "LF0278P.ISO").
Burn the ISO file to a CD and then boot the DG945GCLF motherboard from that CD and follow the instructions.

Instructions on running the BIOS upgrade are here:
http://www.intel.com/support/motherboards/desktop/sb/CS-023359.htm

Wednesday, January 6, 2010

Install eclipse-cdt on Debian

I first tried the obvious approach of "apt-get install eclipse-cdt", that installed a whole lot of packages, but the version of eclipse that I ended up with wouldn't run properly so I tried installing it using the download from www.eclipse.org. That version seems to need Sun's Java 6 runtime, so you also need to install that.
Here is how I got eclipse-cdt going in Debian:
(Note: Much of this needs to be done as root...)

1. Install Sun java 6.
- Edit /etc/apt/sources.list and add 'non-free' to the end of each line, e.g.
deb http://ftp.nz.debian.org/debian lenny main non-free
- apt-get update
- apt-get install sun-java6-jre
- update-java-alternatives -s java-6-sun

2. Download eclipse from http://www.eclipse.org/downloads/ (Eclipse IDE for C/C++ Developers)

3. Install eclipse (thanks to http://flurdy.com/docs/eclipse/install.html )

- Copy the eclipse tar.gz file to /opt
e.g. cp eclipse-cpp-galileo-SR1-linux-gtk.tar.gz /opt/
- Untar it
cd /opt
tar xzvf eclipse-cpp-galileo-SR1-linux-gtk.tar.gz
- Set up permissions
chown -R root:root eclipse
chmod -R +r eclipse
chmod +x `find eclipse -type d`
-
Create an eclipse executable in your path
touch /usr/bin/eclipse
chmod 755 /usr/bin/eclipse
nano /usr/bin/eclipse
Type this into /usr/bin/eclipse -
#!/bin/sh
export ECLIPSE_HOME="/opt/eclipse"
$ECLIPSE_HOME/eclipse $*

4. Run eclipse.
Change to your work directory and run
eclipse -clean

Thursday, December 3, 2009

Run Debian Linux in VMware with no desktop

I use Linux a lot and used to run my main Linux machine on an ancient 500MHz Pentium, but I now use VMware on my Windows XP machine. I mostly run the gEDA tools an eclipse on Linux and I find it a nuisance switching between VMware and Windows so I run Xming (good free Xserver for Windows) and start an xterm with the Windows PC as the X display, then run everything from there. That way all my Linux windows are still just normal windows and I can mouse between them easily.
It seemed pointless having the Gnome desktop when I never use it, and I am already logged on to my PC so I have set it up to automatically log me on and start up an xterm.

Note: Some of the commands below need to be run as root.

1. First get rid of nome and gdm.
su
apt-get remove gdm
- reboot
su
apt-get autoremove
exit

2. Set up X to run an xterm automatically.
Create the file ~/.xsession and add the following line to it:
exec xterm -display 10.1.1.3:.0.0
where 10.1.1.3 is the IP address of your Windows PC that you run VMware from.
Note: You can run any GUI program from here, most will take an argument of --display.

3. Set up your login to run X-windows automatically and shutdown linux when you exit.
Edit ~/.bashrc and add the following to the end (see http://it.dennyhalim.com/2008/10/linux-automatic-login-startx-and.html):
if [ $(tty) == "/dev/tty1" ]; then
 startx
 /sbin/halt
fi
4. Set up halt so that anyone can run it.
su chmod +s /sbin/halt

5. Configure your Linux startup to automatically log you on:
suapt-get install mingetty
Edit /etc/inittab, remove the /sbin/getty line for tty1 and add in its place:

exec /sbin/mingetty --autologin replacewithyourusername tty1

Now when you start Linux it will automatically log you on and an xterm will pop up on your Windows desktop.

(Note: I am now using VirtualBox with the guest additions which works
nicely on Windows 7. It won't grab the mouse and you can even cut and
paste between Windows and Linux.)

Monday, November 9, 2009

Upgrade subversion to 1.6 in Debian 5 (lenny)

The default subversion package for Debian is svn 1.5 and that doesn't have the feature that allows an externals property to reference a single file (can only reference a directory) so I needed to upgrade to 1.6. Here's how you do it:

Log on as root (su)
Add this line to your /etc/apt/sources.list.
deb http://www.backports.org/debian lenny-backports main contrib non-free

Run the following commands:

apt-get update
aptitude -t lenny-backports install subversion


Wednesday, November 4, 2009

How to Build the FTDI USB Serial Driver for Linux (Debian)

(Note: Some of this information is copied - I can't take credit for it all)

To use the FTDI FT4232 (Quad USB to serial adapter) you need the latest FTDI driver and this hasn't made it's way into the Linux kernel yet.
The instructions on the FTDI website on how to build it don't work, so you must copy the driver source into a kernel source tree and build it there.

(Note: To install the pre-built driver module get the file ftdi_sio.ko and install it as described in the last section here "Install the driver:").

Download ftdi_sio.tar.gz from the FTDI web site and copy it to /usr/src/
cd /usr/src
tar xzvf ftdi_sio.tar.gz

Get the Linux kernel source (install the version to suit your kernel, type "uname -r" if not sure):
apt-get install linux-source-2.6.26
cd /usr/src
bunzip2

Copy your systems configuration to the kernel source tree:
cd /usr/src/linux-source-2.6.26
cp /boot/config-2.6.26-2-686 .config

Copy in the latest FTDI driver source:
cp /usr/src/ftdi_sio/ftdi_sio.c /usr/src/linux-source-2.6.26/drivers/usb/serial/
cp /usr/src/ftdi_sio/ftdi_sio.h /usr/src/linux-source-2.6.26/drivers/usb/serial/

Edit the driver (won't compile with 2.6.26 kernel without this change) and comment out
lines 655, 656 and 657:

.id_table = id_table_combined,
// .num_interrupt_in = 0,
// .num_bulk_in = 1,
// .num_bulk_out = 1,
.num_ports = 1,

Start building the kernel, let it run for a while and then cancel it
(you don't need to build the whole kernel):

cd /usr/src/linux-source-2.6.26
make

Now build the FTDI driver module - easiest way is to build all the modules in that directory:

cd /usr/src/linux-source-2.6.26
make -M=drivers/usb/serial

Install the driver:

cd /usr/src/linux-source-2.6.26/drivers/usb/serial
cp ftdi_sio.ko /lib/modules/2.6.26-2-686/kernel/drivers/usb/serial/
rmmod ftdi_sio
modprobe ftdi_sio

Edit /etc/modules and add "ftdi_sio" as the last line (to make sure that ftdi_sio is loaded on startup).

Connect the FT4232 and check that you now have /dev/ttyUSB0 to /dev/ttyUSB3.
If you don't type 'dmesg' to look at the log to see what happened.
Use 'lsusb' to see detected USB devices.
(Note: With the old FTDI driver the FT4232 will connect and be recognised as a FT4232,
but the virtual serial ports won't appear).