<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Yet Another Waste of Space &#187; Electronics</title>
	<atom:link href="http://mike.opennix.com/category/electronics/feed/" rel="self" type="application/rss+xml" />
	<link>http://mike.opennix.com</link>
	<description>Computers, politics, movies.  Just like every other blog.</description>
	<lastBuildDate>Fri, 06 Jul 2012 13:25:21 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Getting a Needham&#8217;s Electronics EMP-20 Device Programmer Working in Linux</title>
		<link>http://mike.opennix.com/2010/05/getting-a-needhams-electronics-emp-20-device-programmer-working-in-linux/</link>
		<comments>http://mike.opennix.com/2010/05/getting-a-needhams-electronics-emp-20-device-programmer-working-in-linux/#comments</comments>
		<pubDate>Fri, 07 May 2010 19:45:14 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://mike.opennix.com/?p=248</guid>
		<description><![CDATA[Once upon a time Needham&#8217;s Electronics was a U.S. company that made a range of affordable and popular device programmers. Sometime in the past few years they seem to have gone out of business. I don&#8217;t know what happened, but it&#8217;s a shame they no longer exist. Their website is now offline (although the domain [...]]]></description>
				<content:encoded><![CDATA[<p>Once upon a time Needham&#8217;s Electronics was a U.S. company that made a range of affordable and popular device programmers.  Sometime in the past few years they seem to have gone out of business.  I don&#8217;t know what happened, but it&#8217;s a shame they no longer exist.  Their website is now offline (although the domain is currently registered by someone I believe to be an ex-employee).</p>
<p>I own one of their programmers, the EMP-20.  The EMP-20 works with a large number of devices from many manufacturers.  Support for devices is through family modules which plug in to a 30-pin SIMM slot on the programmer.  Different groups of devices are supported by different family modules.  These modules are easily swapped out when needed.  Information on the Needham&#8217;s Electronics programmers is getting harder to find as time goes by.  A good place to start is this <a href="http://www.eod.gvsu.edu/egr326/DeviceProgrammer">GVSU.edu</a> page that has software downloads and some archived pages from the old Needham&#8217;s website.</p>
<p>There are a few downsides to the EMP-20 (besides the obvious one of the parent company no longer existing).  First and foremost is that the software for this device is DOS-only.  Second, it connects to a computer through a parallel port.  Both of these combined make using the EMP-20 difficult even for Windows users (for any Windows OS from NT on up a separate driver is required in addition to the interface software).  Using the device in Linux has proven to be problematic for me.  Rather than rehash the approaches that failed, I will instead discuss what worked.  With any luck others may find this information useful.</p>
<p>The <a href="http://www.dosemu.org/">DOSEMU</a> program offers direct hardware access to parallel ports on the host computer.  This is needed to get the EMP-20 software to correctly communicate with programmer.  For Slackware Linux users I offer a <a href="http://slackware.opennix.com/?slackversion=13.0&#038;name=dosemu">binary package</a> of DOSEMU.  Users of other distributions will either need to install it through the package manager or compile it from source.</p>
<p>After installing DOSEMU a few configuration changes need to be made.  In order for the EMP-20 software to correctly run the kernel tunable &#8220;mmap_min_addr&#8221; needs to be set to 0 (zero).   To temporarily make the change one could do the following, as root:</p>
<blockquote><p>echo 0 > /proc/sys/vm/mmap_min_addr</p></blockquote>
<p>How to make this change permanent is probably distribution specific.  One way to do it would be to add the following to /etc/sysctl.conf:</p>
<blockquote><p>vm.mmap_min_addr = 0</p></blockquote>
<p>There are potential security implications to such a change, so investigate the issue before blindly following my advice.</p>
<p>Next, DOSEMU needs to be configured to actually provide the direct hardware access needed.  Information about the parallel port to be used will be need to be acquired from Linux.  To find the memory address range of /dev/lp0, for example, one could do the following:</p>
<blockquote><p>$ grep parport0 /proc/ioports<br />
0378-037a : parport0</p></blockquote>
<p>That output is specific to my laptop.  It is likely the same for most people, but be sure before continuing.  With this information in hand, we can make changes to /etc/dosemu.conf (or wherever the user&#8217;s distribution puts this configuration file).  Find the section of the file where the $_ports definitions are located.  Add or change the following line to match what was found when looking at the contents of /proc/ioports:</p>
<blockquote><p>$_ports = $_ports, &#8221; device /dev/lp0 range 0&#215;378 0x37a&#8221;</p></blockquote>
<p>That line adds the port configuration to any previously existing ports and causes DOSEMU to open /dev/lp0 so access for other applications is blocked while it is in use.  Again, change the values to match specific hardware.</p>
<p>These next lines may not be necessary, but they should keep DOSEMU from doing any sort of printer emulation, which is something that is definitely not wanted in this case:</p>
<blockquote><p>$_lpt0 = &#8220;&#8221;<br />
$_lpt1 = &#8220;&#8221;<br />
$_lpt2 = &#8220;&#8221;<br />
$_lpt3 = &#8220;&#8221;</p></blockquote>
<p>The above changes need to take place in the system-wide dosemu.conf file rather than a user specific .dosemurc.  The reason for this is making changes to ports is a privileged configuration unavailable to normal users for security purposes.</p>
<p>Now that DOSEMU has been configured to access the parallel ports, permission has to be given to users so that they may gain the direct hardware access required.  One way to do this is to use &#8220;sudo&#8221; in conjunction with DOSEMU&#8217;s &#8216;-s&#8217; command line switch (refer to the DOSEMU docs for more information and other ways to provide the needed access).  Use the &#8220;visudo&#8221; command to add lines like the following for each user who should have this privileged access:</p>
<blockquote><p>username  ALL=(root) /usr/bin/dosemu.bin</p></blockquote>
<p>Replace &#8220;username&#8221; with the user&#8217;s name and &#8220;/usr/bin/dosemu.bin&#8221; with the full path to the dosemu.bin binary on your system.  Note that &#8220;dosemu&#8221; is a wrapper script and should not be used in your sudo configuration; &#8220;dosemu.bin&#8221; is the actual binary.</p>
<p>Now any user added above can do the following to launch the EMP-20 software:</p>
<blockquote><p>dosemu -s /path/to/EMP20.EXE</p></blockquote>
<p>The &#8216;-s&#8217; switch attempts to run dosemu with direct hardware access.  If the programmer is plugged in and turned on, and all the above steps were done correctly, the EMP-20 interface software will be running and ready to program your devices.</p>
<p>Hopefully someone will find this information useful.  I know I&#8217;m happy to be able to once again use my device programmer.</p>
<p><strong>UPDATE</strong> &#8211; As of the update to sudo-1.7.4 in Slackware 13.1, running &#8216;dosemu -s&#8217; will no longer work unless another modification is made to the /etc/sudoers file.  Run &#8216;visudo&#8217; as root and add the following line:</p>
<blockquote><p>Defaults env_keep += &#8220;HOME&#8221;</p></blockquote>
<p>Without this, dosemu will attempt to create some files and directories in root&#8217;s home directory.  That will fail, causing dosemu to exit.  The above appears to address this problem for me.</p>
]]></content:encoded>
			<wfw:commentRss>http://mike.opennix.com/2010/05/getting-a-needhams-electronics-emp-20-device-programmer-working-in-linux/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>
