Wednesday, May 28, 2014

Making ModelSim ALTERA STARTER EDITION vsim 10.1d work on Ubuntu 14.04

[WARNING: Some people are reporting that following the steps for them does not fix the problem. I am working on trying to find out what the issue is.]

Trying to get a version of ModelSim running on a very modern version of Linux often presents challenges. Luckily I had lots of helpful information on the internet (major sources linked below) to get it going. This article mostly adapts the work done by the Arch Linux crew.

Problem number one: The free version of ModelSim Altera Edition is 32 bit only while the normal Linux PC will be 64 bit.

On Linux this requires us to install the 32 bit versions of the libraries that it depends on. Luckily this is fully supported on a modern Linux like Ubuntu 14.

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install gcc-multilib g++-multilib \
lib32z1 lib32stdc++6 lib32gcc1 \
expat:i386 fontconfig:i386 libfreetype6:i386 libexpat1:i386 libc6:i386 libgtk-3-0:i386 \
libcanberra0:i386 libpng12-0:i386 libice6:i386 libsm6:i386 libncurses5:i386 zlib1g:i386 \
libx11-6:i386 libxau6:i386 libxdmcp6:i386 libxext6:i386 libxft2:i386 libxrender1:i386 \
libxt6:i386 libxtst6:i386

Problem number two: If you have the following error when running vsim:

** Fatal: Read failure in vlm process (0,0)
Segmentation fault (core dumped)
 
Then you probably need to build a new version of freetype, a font setting library and modify ModelSim to use it. For an unknown reason ModelSim has an issue with modern versions shipping in Arch and Ubuntu 14.04. First download the source code of freetype 2.4.12:

http://download.savannah.gnu.org/releases/freetype/freetype-2.4.12.tar.bz2

Now install the build dependencies needed for libfreetype6, extract the source (using tar) and configure and build libfreetype:
sudo apt-get build-dep -a i386 libfreetype6
tar -xjvf freetype-2.4.12.tar.bz2
cd freetype-2.4.12
./configure --build=i686-pc-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"
make -j8
The finished libraries are now available inside the "objs/.libs" directory. As they are necessary to run ModelSim we need to copy them into the install directory so they don't get lost and then modify ModelSim's vsim script to use the new libraries instead of the system wide versions. Change directory to the directory where you installed ModelSim, /opt/altera/13.1/modelsim_ase/, on my system. Note you may need to edit the directory paths to match those used on your system.
sudo mkdir lib32
sudo cp ~/Downloads/freetype-2.4.12/objs/.libs/libfreetype.so* ./lib32
Now we need to edit the vsim launch script to ensure the new freetype libraries are used:
sudo vim bin/vsim
Search for the following line:
dir=`dirname $arg0`
and underneath add the following new line:
export LD_LIBRARY_PATH=${dir}/lib32
 
Test by running vsim and hopefully you will be greeted by the ModelSim GUI.

[Tested on fresh install of Ubuntu 14.04]

Sources:
  1. https://wiki.archlinux.org/index.php/Altera_Design_Software
  2. http://stackoverflow.com/questions/3261909/build-32bit-on-64-bit-linux-using-a-configure-script 
  3. https://wiki.debian.org/Multiarch/CrossDependencies

Saturday, May 10, 2014

Making my Lenovo MCE RC-6 IR Receiver immune to interference by my TV backlight

Sadly due the newer technologies employed in CFL bulbs (which incidentally is the technology behind my TV) emit a lot of IR interference on the frequency ranges used by the older IR controls. Vishay publishes a summary which goes into more technical detail here: http://www.vishay.com/docs/80072/disturan.pdf.

My MCE receiver is an RC-6 system by SMK RXX6000-40 branded Lenovo, if you want to buy one of your own then please checkout eBay.


HP Remote with USB Receiver RC-6 [Taken from eBay auction linked here]

However despite being aesthetically excellent the receiver suffers from interference from the TV backlight which makes it unusable if the room light isn't bright, wholly unsuitable for certain movies.

This is a pretty common problem for the older IR systems however newer IR receiver modules have been enhanced with better filtering systems.

 Opening the receiver is easy, a single screw hidden in the center of the label and the top and bottom come apart to reveal a single PCB.


The IR module is the black module standing up on the lefthand edge of the PCB (the "front" of the PCB is the south west side). Careful scrutiny of the top of the module reveals it is a Vishay Siliconix TSOP34838, a 38kHz filtered IR module.
Consulting the datasheet from Vishay, http://www.vishay.com/docs/82489/tsop322.pdf, we can see that there is another, pin compatible module, with an enhanced filtering system (Vishay's Active Gain Control 4 or AGC4) to exclude the interference the TSOP34438 is vulnerable to.

I have the new module on order and when it arrives I'll post the results.




My current home media center build: Mythmaster

Apologies - working for two long under various agreements that mean I can't discuss my work means I haven't posted anything in too long.

Hardware

Bought from eBay from Tamsolutions (there may be more available as they seem to have shipments regularly as of May 10th 2014). The computer is quite noisy so it is based down in the basement and connected to the TV by an HDMI extender and a USB extension cable.

Case: AIC RSC-4ED2 with 6x SATA-II 3.0 Gbps four position backplane (TW-000-51675-AR).

Motherboard: SuperMicro H8DME-2 nVidia MCP 55 Pro.
 - Modified one of the PCIe 8x sockets to accept a x16 GFX card by opening the end of the socket.

GFX Card: GeForce GT 240. [Chosen as it can do the most complete deinterlace on 1080i video]
 - Modified with a flywire to connect the PRSNT#1 pin (1A) to PRSNT#2 (48B) so the motherboard detects the card in the modified PCIe 8x socket.

CPU: Two Quad Core Opteron 2389s. [An eBay purchase to replace the single Dual Core 2212 HE. Don't forget the extra CPU cooler]

Memory: 24 Gigabytes of PC-5300P. [Increased by another eBay purchase]

3x SATA Controller Cards: AOC-SAT2-MV8

Drives:
2x HP ST3250824AS 250GB SATA HDDs in Linux Software RAID 1. Note please don't waste time trying to enable SATA-II or NCQ on the HP versions of this disk. They are SATA-I and don't advertise NCQ.

6x 2TB Seagate or Western Digital HDDs managed by ZFS.

TV: 47" VIZIO E470VA

HDMI Extender: No real name HDMI over dual CAT5e or CAT6 cables from Amazon.

USB Long Cable: An active USB 2.0 cable from Amazon.

ATSC Receiver: HDHR4-2US Silicondust HDHomeRun Dual Tuner.

Remote control: Lenovo RC-6 receiver by SMK RXX6000-40.

Software

OS: Linux Ubuntu 14.04 LTS.
 - nVidia drivers from Ubuntu 319.
 - Pulseaudio removed to enable sound in XBMC standalone
 - User autologin running XBMC standalone.
 - Modified the udev rules to enable the IR remote (MCE USB by SMK) device ids, read this thread for details.

Disk Management: ZFS on Linux, GIT head (as the current 0.6.2 release is old and the new version is about to be released. To work on Kernel 3.14 the latest GIT version is necessary).

Frontend: XBMC 13.0 Gotham.

Backend: Mythtv 0.27 managing the Silicondust HD HomeRun and scheduling recordings.

Laird Tpcm 7250 is as good as Honeywell PTM7950 as thermal paste / interface for PC

[This is not very scientific, however it is notable. At 7.5W/m-K vs the installed SYY-157 at 15.7 W/m-K it performed better in real world lo...