<?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>ElectricRock Blog &#187; at89s52</title>
	<atom:link href="http://www.electricrock.co.nz/blog/tag/at89s52/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.electricrock.co.nz/blog</link>
	<description>Electronic Ramblings</description>
	<lastBuildDate>Tue, 10 Aug 2010 03:37:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Control 16 Firmware Replacement</title>
		<link>http://www.electricrock.co.nz/blog/2009/10/control-16-firmware-replacement/</link>
		<comments>http://www.electricrock.co.nz/blog/2009/10/control-16-firmware-replacement/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 01:26:56 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[at89s52]]></category>
		<category><![CDATA[Control 16]]></category>
		<category><![CDATA[Hardware]]></category>

		<guid isPermaLink="false">http://www.electricrock.co.nz/blog/?p=64</guid>
		<description><![CDATA[As I have mentioned in my previous posts about the Ensoniq Control 16, it is a DAW control surface designed to interface to proprietary DAW software via a proprietary PCI card.  As I have the C16, but not the PCI card, I have been working on reverse engineering the interface so that I can build [...]]]></description>
			<content:encoded><![CDATA[<p>As I have mentioned in my previous posts about the <a href="http://www.electricrock.co.nz/blog/tag/control-16/">Ensoniq Control 16</a>, it is a DAW control surface designed to interface to proprietary DAW software via a proprietary PCI card.  As I have the C16, but not the PCI card, I have been working on reverse engineering the interface so that I can build a USB adaptor for it and use it with my PC.</p>
<p>I have previously written about how I built an RS-232 adaptor for the Control 16, but this alone did not allow me to communicate with the Control 16 as I did not know its communication protocol. As I did not have the PCI card to act as a master and provide something for the C16 to communicate with, I was not able to sniff the communications and reverse engineer them. My solution instead was to replace the firmware running on the C16&#8217;s microcontroller with one that I custom wrote, and which used my own communication protocol.</p>
<p><span id="more-64"></span></p>
<h3>Control 16 Architecture</h3>
<p>The Control 16 is based around an Atmel AT89C52 microcontoller.  I replaced this with an AT89S52 for development as I could then use its in-circuit serial programming feature.  Using a multimeter I traced some of the connections between the microcontroller and other ICs on the board, and inferred the rest.  The result was that I was able to map out a block diagram of the mainboard, as shown below.</p>
<div id="attachment_65" class="wp-caption alignnone" style="width: 560px"><a href="http://www.electricrock.co.nz/blog/wp-content/uploads/2009/10/c16-blockdiagram.png"><img class="size-large wp-image-65" title="C16 Block Diagram" src="http://www.electricrock.co.nz/blog/wp-content/uploads/2009/10/c16-blockdiagram-1024x791.png" alt="Control 16 Architecture Block Diagram" width="550" height="423" /></a><p class="wp-caption-text">Control 16 Architecture Block Diagram</p></div>
<p>I&#8217;m not going to go into a lengthy explanation of the architecture unless there is someone out there who it&#8217;s useful to, so if that is you then post a comment and let me know.</p>
<h3>Firmware Replacement</h3>
<p>I developed the firmware replacement using the <a href="http://sdcc.sourceforge.net/">SDCC</a> toolchain.  I have released the code under the GPL v3 license in case it may be of use to anyone. It can be downloaded here: <a href="http://www.electricrock.co.nz/blog/wp-content/uploads/2009/10/c16firmware.zip">C16Firmware</a>. <i>Please not that there is a bug in the current version of the firmware code.  I will update it at some point, if you need it sooner let me know.</i></p>
<p>This firmware detects events from the sliders, buttons, jog wheel, and rotary encoders (though these have issues) and transmits their values via the serial port. It is also allows the values of the LEDs to be set via commands received on the serial port. So all-in-all it is almost fully functional.  The communication protocol is a fairly simple text-based protocol.</p>
<p>Now that the firmware is completed, the next stage in my C16 project is to develop software that runs on the host PC and converts between the simple text based protocol of the C16, and some other midi control protocol that can be used by DAW software.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.electricrock.co.nz/blog/2009/10/control-16-firmware-replacement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using a Xilinx DLC5 Parallel Cable to program an AT89S52</title>
		<link>http://www.electricrock.co.nz/blog/2009/09/using-a-xilinx-dlc5-parallel-cable-to-program-an-at89s52/</link>
		<comments>http://www.electricrock.co.nz/blog/2009/09/using-a-xilinx-dlc5-parallel-cable-to-program-an-at89s52/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 22:31:01 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[at89s52]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.electricrock.co.nz/blog/?p=56</guid>
		<description><![CDATA[While working on my control 16 project I realised I would need to replace the firware of the onboard microcontroller, an AT89C52.  Unfortunately, the AT89C52 is a mission to program (as it is parallel programmable only) so I have replaced it with an AT89S52, which supports in-circuit serial programming.  What I still lacked was an [...]]]></description>
			<content:encoded><![CDATA[<p>While working on my control 16 project I realised I would need to replace the firware of the onboard microcontroller, an AT89C52.  Unfortunately, the AT89C52 is a mission to program (as it is parallel programmable only) so I have replaced it with an AT89S52, which supports in-circuit serial programming.  What I still lacked was an ISP programmer; however, instead of building one I made use of an old Xilinx DLC5 parallel port JTAG cable (<a href="http://www.xilinx.com/itp/xilinx4/data/docs/pac/appendixb.html">schematic</a>).  This was fairly straight forward under Ubuntu 9.04, using <a href="http://www.nongnu.org/uisp/">UISP</a> AVR and AT89S programming software.  The following instructions assume the target is self powered and has an oscillator/crystal connected if required. NB these instructions are written from memory, so if you find a mistake please post a comment.</p>
<p><span id="more-56"></span></p>
<h3>Setup</h3>
<ol>
<li>Add yourself to the lp group so that you can access the parallel port without needing to be superuser (you will need to log out and back in again after this command):<br />
<span style="color: #0000ff;"><em>sudo usermod -a -G lp &lt;username&gt;<br />
</em></span></li>
<li>Install uisp:<br />
<span style="color: #0000ff;"><em>sudo aptitude install uisp</em></span></li>
<li>Connect the JTAG cable to your target device as follows:<br />
<table border="0">
<tbody>
<tr>
<td><strong>JTAG</strong></td>
<td><strong>Target</strong></td>
</tr>
<tr>
<td>Vcc</td>
<td>Vcc</td>
</tr>
<tr>
<td>GND</td>
<td>GND</td>
</tr>
<tr>
<td>TDI</td>
<td>MOSI</td>
</tr>
<tr>
<td>TDO</td>
<td>MISO</td>
</tr>
<tr>
<td>TCK</td>
<td>SCK</td>
</tr>
<tr>
<td>TMS</td>
<td>RST</td>
</tr>
</tbody>
</table>
</li>
</ol>
<h3>Some useful UISP commands</h3>
<p>These are given for AT89S52, but for other AVR series it should work if you just drop the <em>-d89</em> flag and use the appropriate part number.  The main thing to note here is that the <em>dprog</em> flag is set to <em>xil</em> to indicate we are using a DLC5 for programming.</p>
<table border="0">
<tbody>
<tr>
<td>Erase</td>
<td><span style="color: #0000ff;"><em>uisp -d89 -dprog=xil -dpart=at89s52 &#8211;erase</em></span></td>
</tr>
<tr>
<td>Program</td>
<td><em><span style="color: #0000ff;">uisp -d89 -dprog=xil -dpart=at89s52  &#8211;upload if=[input filename (in intel hex or motorolla srec format)]</span></em></td>
</tr>
<tr>
<td>Read back</td>
<td><em><span style="color: #0000ff;">uisp -d89 -dprog=xil -dpart=at89s52 &#8211;download of=[output filename (in srec format)]</span></em></td>
</tr>
</tbody>
</table>
<p>If you have issues try adding <em>-v=3</em> or <em>-v=4</em> for more verbose output from UISP.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.electricrock.co.nz/blog/2009/09/using-a-xilinx-dlc5-parallel-cable-to-program-an-at89s52/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
