tag:blogger.com,1999:blog-20043010435697124302024-03-13T19:45:29.811-07:00tnn's contraptionsTobias Nygrenhttp://www.blogger.com/profile/15496764645803120095noreply@blogger.comBlogger14125tag:blogger.com,1999:blog-2004301043569712430.post-48185313047236172042020-06-13T12:47:00.001-07:002020-06-17T06:02:30.026-07:00Mazda 2 / Demio / CX-3 2016 2017 2018 amplifier and speaker pinout<div>DC3E66DRX or similar. Maybe someone will find this useful.</div><div><br /></div><div>At amp connector (behind glove compartment)<br /></div><div><br /></div><div><table border="1" bordercolor="#888" cellspacing="0" style="border-collapse: collapse; border-color: rgb(136, 136, 136); border-width: 1px;"><tbody><tr><td style="min-width: 60px;"><br /></td><td style="min-width: 60px;"><br /></td><td style="min-width: 60px;"><br /></td><td style="width: 60px;">tab<br /></td><td style="min-width: 60px;">tab<br /></td><td style="width: 60px;">tab<br /></td><td style="width: 60px;">tab<br /></td><td style="width: 60px;">tab<br /></td><td style="width: 60px;"><br /></td><td style="width: 60px;"><br /></td><td style="width: 60px;"><br /></td></tr><tr><td> Blue<br /><br />+12V</td><td>N/C <br /></td><td>mintgreen<br /><br />LF+<br /></td><td>skyblue<br /><br />LF-<br /></td><td>brown<br /><br />LB+ <br /></td><td>lightblue<br /><br />LB- <br /></td><td>N/C <br /></td><td>gray<br /><br />power-on signal<br /></td><td>N/C </td><td style="width: 60px;">N/C </td><td style="width: 60px;"> Black<br /><br />GND</td></tr><tr><td> </td><td> N/C</td><td> red<br /><br />RF+</td><td> white<br /><br />RF-</td><td> green<br /><br />RB+</td><td> yellow<br /><br />RB-</td><td> N/C </td><td> brown<br />???</td><td> N/C</td><td> N/C</td><td> </td></tr></tbody></table></div><div><br /></div><div>At speakers</div><div><br /></div><div><table border="1" bordercolor="#888" cellspacing="0" style="border-collapse: collapse; border-color: rgb(136, 136, 136); border-width: 1px;"><tbody><tr><td style="min-width: 60px;"> Location</td><td style="min-width: 60px;">Color <br /></td><td style="min-width: 60px;">Function <br /></td></tr><tr><td style="min-width: 60px;">Left front door<br /></td><td style="min-width: 60px;">Green</td><td style="min-width: 60px;">Positive +<br /></td></tr><tr><td>Left front door<br /></td><td>Blue</td><td>Negative -<br /></td></tr><tr><td>Left tweeter<br /></td><td>Green</td><td>Positive + <br /></td></tr><tr><td>Left tweeter<br /></td><td>Blue <br /></td><td>Negative -<br /></td></tr><tr><td>Right front door<br /></td><td>Blue</td><td>Positive +<br /></td></tr><tr><td>Right front door<br /></td><td>Green<br /></td><td>Negative -<br /></td></tr><tr><td>Right tweeter<br /></td><td>Blue</td><td>Positive + <br /></td></tr><tr><td>Right tweeter<br /></td><td>Green<br /></td><td>Negative -<br /></td></tr><tr><td>Left back door<br /></td><td>Brown</td><td>Positive +</td></tr><tr><td>Left back door<br /></td><td>Light blue<br /></td><td>Negative - <br /></td></tr><tr><td>Right back door<br /></td><td>Green</td><td>Positive +<br /></td></tr><tr><td>Right back door<br /></td><td>Yellow</td><td>Negative -<br /></td></tr></tbody></table><br /></div>Tobias Nygrenhttp://www.blogger.com/profile/15496764645803120095noreply@blogger.com0tag:blogger.com,1999:blog-2004301043569712430.post-28151211233798148612017-04-22T14:07:00.000-07:002017-04-22T16:04:19.992-07:00Adventures in Time, part 1: Interfacing an Oven Controlled Crystal Oscillator to a Computer Running NetBSDIn this series of blog posts I will adventure into the field of precision timekeeping. Part one will explore how to interface a precision clock source to a computer. In future posts I will attempt to calibrate the clock source with NTP and measure it's performance.<br />
<br />
<h4>
What is a Crystal Oscillator?</h4>
Quartz crystals are electronic components that resonate at some particular frequency. They are used in computers to generate clock frequencies, both directly for the real time clock as well as reference inputs to chips that generate the high frequency clock signals needed for the CPU, memory and I/O buses.<br />
<br />
<h4>
What is an Oven Controlled Crystal Oscillator?</h4>
Like most electronic components, crystals are dependent on temperature. The rated frequency shifts slightly up or down depending on ambient temperature. This is undesirable for precision timekeeping. OCXOs compensate for this by putting the crystal in a temperature regulated heated can ("the oven").<br />
<br />
<h4>
Description of Hardware Used</h4>
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-jtentp9hSPY/WPuvbdTn9tI/AAAAAAAAAM0/z24CwrvFI34ggX411NofcIh6TVhYEK19wCLcB/s1600/DSC_6046_00001.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="185" src="https://1.bp.blogspot.com/-jtentp9hSPY/WPuvbdTn9tI/AAAAAAAAAM0/z24CwrvFI34ggX411NofcIh6TVhYEK19wCLcB/s200/DSC_6046_00001.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Salvaged Trimble 65256 unit</td></tr>
</tbody></table>
I purchased two of these used OCXOs from an Ebay listing a few years ago because I wanted to learn more about precision timekeeping. (But then for some reason I shelved them and forgot about them until now!) They are powered by a +12 V rail and generate a 50<span class="st"> Ω</span> <span class="st">±</span>800 mV sine wave signal at 10 MHz. They contain an internal 2.5 V reference voltage which should be used by external circuitry to generate a calibration voltage.<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://4.bp.blogspot.com/-BW8UAcaZQvc/WPuwTmUGEoI/AAAAAAAAANA/yH06g5_qfMYL35tWzZ2qe62RY2vw7LntQCLcB/s1600/DSC_6047_00002.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="149" src="https://4.bp.blogspot.com/-BW8UAcaZQvc/WPuwTmUGEoI/AAAAAAAAANA/yH06g5_qfMYL35tWzZ2qe62RY2vw7LntQCLcB/s200/DSC_6047_00002.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Modified OCXO</td></tr>
</tbody></table>
The modules arrived without any leads or calibration, so first I had to modify them. I glued a trim pot to the side of the can. Resistors, like crystals, also have temperature coefficients. I figured that since the oven is temperature controlled the resistor should maintain a reasonably constant temperature if glued directly to the lukewarm can. The idea then is that the trim pot can be used as a voltage divider to generate the calibration voltage. For the signal output I used some thin coaxial wire salvaged from a laptop WiFi antenna.<br />
<br />
<h4>
Connecting OCXOs to a Computer</h4>
The kernel timekeeping framework, <a href="http://netbsd.gw.com/cgi-bin/man-cgi?timecounter+9+NetBSD-7.0">timecounter(9)</a>, makes it easy to hook up arbitrary digital counters and use them as a source for time. We could easily build a microcontroller circuit that counts the sine wave signal and feeds the counter serially into a <a href="http://netbsd.gw.com/cgi-bin/man-cgi?gpio+4+NetBSD-7.0">gpio(4)</a> pin. But then we need a microcontroller and also we have to characterize and account for the latency and jitter of reading a GPIO pin.<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://4.bp.blogspot.com/-iQ1Cvk5vxyw/WPuxYoQqb2I/AAAAAAAAANM/MHwgHyEBTu0s0YczCac6uhs-ckY8Yg-hQCLcB/s1600/DSC_6051_00006.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="139" src="https://4.bp.blogspot.com/-iQ1Cvk5vxyw/WPuxYoQqb2I/AAAAAAAAANM/MHwgHyEBTu0s0YczCac6uhs-ckY8Yg-hQCLcB/s200/DSC_6051_00006.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Banana Pi M1 SBC</td></tr>
</tbody></table>
So, instead we will try to replace the computer's existing reference clock. The computer we will use is a <a href="https://en.wikipedia.org/wiki/Banana_Pi#Banana_Pi_M1">Banana Pi M1</a> SBC running <a href="https://wiki.netbsd.org/ports/evbarm/allwinner/">NetBSD/evbarm</a>. The M1 uses an <a href="https://en.wikipedia.org/wiki/Allwinner_A20">Allwinner A20</a> SoC, designed to be used with a single 24 MHz reference clock, which is multiplied and divided to synthesize all the clock signals required by the board. Everything from the CPU to serial UARTs and the HDMI port is referenced to this clock. For example the CPU clock runs at 24 Mhz <b>×</b> 38 = 912 MHz.<br />
<br />
A problem is that our replacement reference clock runs at 10 MHz, not 24 MHz, so time will slow down by a factor of 10/24. The board itself doesn't really care or even know about this, but it becomes an issue when interfacing with the rest of the world. For example the serial UART baud rate will be wrong. Fortunately this can mostly be compensated for in software by reprogramming relevant clock multipliers.<br />
<br />
<h3>
How Clock Signals Are Generated On The M1 Board</h3>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-0zR3tTPVNH4/WPuiqooHR8I/AAAAAAAAAMI/36VxdWn5Jts5F-Ni-mLy4BqKiZtmJA0GQCLcB/s1600/x24pins.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="Location of X24 pins on SoC" border="0" height="175" src="https://1.bp.blogspot.com/-0zR3tTPVNH4/WPuiqooHR8I/AAAAAAAAAMI/36VxdWn5Jts5F-Ni-mLy4BqKiZtmJA0GQCLcB/s200/x24pins.jpg" title="" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Figure 1: Location of <span style="font-family: "courier new" , "courier" , monospace;">X24*</span> pins on SoC</td></tr>
</tbody></table>
The A20 SoC contains an internal PLL circuit. on the SoC there are two
pins <span style="font-family: "courier new" , "courier" , monospace;">X24MI</span> (clock input) and <span style="font-family: "courier new" , "courier" , monospace;">X24MO</span> (clock output), across which the SoC
expects a 24 MHz crystal to be connected (Figure 1).<br />
<br />
On the M1 board the crystals are connected according to Figure 2. The crystal is labeled <span style="font-family: "courier new" , "courier" , monospace;">X1</span> on the board and is easy to locate visually (Figure 3).<br />
<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://4.bp.blogspot.com/-8Um9ZbFXHoc/WPujoFRNtEI/AAAAAAAAAMU/N-Zk8Uj231UbDZvlvA17tZK8wbkN6abyQCLcB/s1600/bpi-m1-crystal-schematic.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="56" src="https://4.bp.blogspot.com/-8Um9ZbFXHoc/WPujoFRNtEI/AAAAAAAAAMU/N-Zk8Uj231UbDZvlvA17tZK8wbkN6abyQCLcB/s320/bpi-m1-crystal-schematic.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Figure 2: M1 Oscillator schematic</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/-tn5zb-ERTh0/WPuy7trkE8I/AAAAAAAAANY/Cr3Sn3YkB6c9OfVqKiRNywu78PxZXuq3QCLcB/s1600/DSC_6051_00006_2.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="185" src="https://2.bp.blogspot.com/-tn5zb-ERTh0/WPuy7trkE8I/AAAAAAAAANY/Cr3Sn3YkB6c9OfVqKiRNywu78PxZXuq3QCLcB/s200/DSC_6051_00006_2.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Figure 3: <span style="font-family: "courier new" , "courier" , monospace;">X1</span> location and pins</td></tr>
</tbody></table>
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://3.bp.blogspot.com/-SbgGqNIiMH0/WPumYoKgUyI/AAAAAAAAAMk/OS7zD5Hj4IE0-OpiS3qpxO2m3y3NA0sYQCLcB/s1600/internal-osc.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="121" src="https://3.bp.blogspot.com/-SbgGqNIiMH0/WPumYoKgUyI/AAAAAAAAAMk/OS7zD5Hj4IE0-OpiS3qpxO2m3y3NA0sYQCLcB/s200/internal-osc.png" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Figure 4: simplified model of internal clock amp</td></tr>
</tbody></table>
<br />
We don't know anything about how the clock amplifier circuit inside the SoC is designed, but a typical clock amplifier circuit looks something like figure 4 and for our purpose this simplified model serves fine. We need to desolder <span style="font-family: "courier new" , "courier" , monospace;">X1</span> and adapt the 10 MHz signal to make it suitable to inject at <span style="font-family: "courier new" , "courier" , monospace;">X24MI</span>. The amplifier circuit will then take care of cleaning up the signal for us.<br />
<h4>
</h4>
<h4>
Oscilloscope Measurements </h4>
Scope snapshots from <span style="font-family: "courier new" , "courier" , monospace;">X24MI</span>, <span style="font-family: "courier new" , "courier" , monospace;">X24MO</span> and the 10 MHz signal for comparison. The amplifier output has some undershoot/overshoot but that's okay because it gets further filtered and cleaned up inside the SoC.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-uIjW4duzaIE/WPu13d91u4I/AAAAAAAAANk/UWVHsgLTAuk98LjK2KL1Sfup22yKXbWQgCLcB/s1600/DSC_6055_00010.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="244" src="https://1.bp.blogspot.com/-uIjW4duzaIE/WPu13d91u4I/AAAAAAAAANk/UWVHsgLTAuk98LjK2KL1Sfup22yKXbWQgCLcB/s320/DSC_6055_00010.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">OSC24 input</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/-N9mY0wtK4cs/WPu13ZcxRcI/AAAAAAAAANo/wSKdxn8BpOQMtf_RhDs0Y-ow0DCR1vL_QCLcB/s1600/DSC_6056_00011.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="248" src="https://2.bp.blogspot.com/-N9mY0wtK4cs/WPu13ZcxRcI/AAAAAAAAANo/wSKdxn8BpOQMtf_RhDs0Y-ow0DCR1vL_QCLcB/s320/DSC_6056_00011.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">OSC24 output</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/-VBP7shR1Q_E/WPu13cVZoqI/AAAAAAAAANs/JmUt0Qf2ElIj92letZoe7ygf4mU6uHM9ACLcB/s1600/DSC_6057_00012.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="249" src="https://2.bp.blogspot.com/-VBP7shR1Q_E/WPu13cVZoqI/AAAAAAAAANs/JmUt0Qf2ElIj92letZoe7ygf4mU6uHM9ACLcB/s320/DSC_6057_00012.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">10 MHz reference clock terminated to 50 <span class="st">Ω</span></td></tr>
</tbody></table>
<h4>
Clock Adapter Circuit</h4>
I made this simple adapter board to connect the clock. The purpose is to shift the signal upwards to be centered around roughly <span style="font-family: "courier new" , "courier" , monospace;">Vcc/2</span> and to terminate it to roughly 50 <span class="st">Ω. The exact values are not hugely important. We just want to make sure we don't feed negative voltage into the amplifier input as that could potentially destroy the SoC.</span><br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://4.bp.blogspot.com/-KPBQWgm4h7c/WPu8ZQ5FgsI/AAAAAAAAAOI/fy-YtaVzMqg2iXwwU51kpHHCh5qLrNKywCLcB/s1600/clock_adapter_schematic.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://4.bp.blogspot.com/-KPBQWgm4h7c/WPu8ZQ5FgsI/AAAAAAAAAOI/fy-YtaVzMqg2iXwwU51kpHHCh5qLrNKywCLcB/s1600/clock_adapter_schematic.jpg" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Clock adapter schematic</td></tr>
</tbody></table>
<span class="st"></span><br />
<span class="st"><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/-q6uN0PI8niI/WPu5fif2kdI/AAAAAAAAAN4/sBNXWreVWOsbpBAPA8-QlcVfzt3dzuOkQCEw/s1600/clock_adapter.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="181" src="https://2.bp.blogspot.com/-q6uN0PI8niI/WPu5fif2kdI/AAAAAAAAAN4/sBNXWreVWOsbpBAPA8-QlcVfzt3dzuOkQCEw/s200/clock_adapter.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Clock Adapter on veroboard. Note that the 24 Mhz crystal has been removed from the board.</td></tr>
</tbody></table>
</span><br />
<span class="st"> <table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/-aqB8joDPIh4/WPu5f63zTfI/AAAAAAAAAN8/TOQLb714Tvk46FDaw-_bD2wGH6L-NLCpQCEw/s1600/clock_adapter2.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="179" src="https://2.bp.blogspot.com/-aqB8joDPIh4/WPu5f63zTfI/AAAAAAAAAN8/TOQLb714Tvk46FDaw-_bD2wGH6L-NLCpQCEw/s320/clock_adapter2.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">System Powered up.</td><td class="tr-caption" style="text-align: center;"><br /></td></tr>
</tbody></table>
</span><br />
<br />
<h4>
Kernel Modifications</h4>
Next we must tell the kernel that we have changed the reference clock from 24 MHz to 10 MHz. In NetBSD this is controlled by <a href="https://nxr.netbsd.org/source/s?refs=AWIN_REF_FREQ&project=src">AWIN_REF_FREQ</a> and we can accomplish what we need by changing a <a href="https://nxr.netbsd.org/xref/src/sys/arch/arm/allwinner/awin_reg.h?r=1.90#36">single line in the source code</a>.<br />
<br />
Here is a diff comparison of dmesg(8) output after changing this constant:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"> -cpu0 at mainbus0 core 0: 912 MHz Cortex-A7 r0p4 (Cortex V7A core)<br /> +cpu0 at mainbus0 core 0: 380 MHz Cortex-A7 r0p4 (Cortex V7A core)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">...</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> -armgtmr0 at armperiph0: ARMv7 Generic 64-bit Timer (24000 kHz)<br /> +armgtmr0 at armperiph0: ARMv7 Generic 64-bit Timer (10000 kHz)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"></span><br />
Unfortunately as a side effect our CPU speed has slowed down quite a bit. But 380 MHz was enough to run an NTP server in the 1990s so it should suffice now. Running slower is also more power efficient. :-)<br />
<br />
<h4>
Conclusion</h4>
Replacing the reference clock on this board was quite easy. It would be interesting to attempt the same operation on an x86 motherboard at some point. But it would probably be much harder to adjust all the clock multipliers on an x86 system.<br />
<br />
In the next post I will attempt to calibrate the clock with NTP.Tobias Nygrenhttp://www.blogger.com/profile/15496764645803120095noreply@blogger.com0tag:blogger.com,1999:blog-2004301043569712430.post-91339806908660523742014-10-30T08:05:00.002-07:002014-10-30T08:05:26.446-07:00How to solve "No certificate file found in the SD card" on AndroidShort blogpost since I just wasted a lot of time trying to import a CA certificate on my Phone. The cert wouldn't be recognized no matter what kind of encoding I used. The error message "No certificate file found in the SD card" is actually very misleading. Solution: You need to store the certificate on the Phone's internal storage, not the SD card.Tobias Nygrenhttp://www.blogger.com/profile/15496764645803120095noreply@blogger.com0tag:blogger.com,1999:blog-2004301043569712430.post-21015017233792764142014-04-09T09:51:00.000-07:002014-04-09T09:51:21.813-07:00How Farnell Element14 ships 5 ICsI don't even have a pick and place machine, what do I do with all these QFP trays?!<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-vGMe7Rs1kf4/U0V568Vjq7I/AAAAAAAAAHw/bZDV92_NjQ8/s1600/DSC_5312.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-vGMe7Rs1kf4/U0V568Vjq7I/AAAAAAAAAHw/bZDV92_NjQ8/s1600/DSC_5312.JPG" height="211" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-WBdrLmtbfMo/U0V57KA6LTI/AAAAAAAAAHo/iH10ycaHEYM/s1600/DSC_5314.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-WBdrLmtbfMo/U0V57KA6LTI/AAAAAAAAAHo/iH10ycaHEYM/s1600/DSC_5314.JPG" height="211" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-P2YayLTIi2o/U0V57DrnYsI/AAAAAAAAAHs/Ee0_3U-Pets/s1600/DSC_5315.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-P2YayLTIi2o/U0V57DrnYsI/AAAAAAAAAHs/Ee0_3U-Pets/s1600/DSC_5315.JPG" height="211" width="320" /></a></div>
<br />
<br />Tobias Nygrenhttp://www.blogger.com/profile/15496764645803120095noreply@blogger.com0tag:blogger.com,1999:blog-2004301043569712430.post-84291219707476941752013-05-19T06:54:00.000-07:002013-05-19T06:55:33.004-07:00Hacking a finicky Sun Blade 1500 workstationSo I wanted to upgrade my trusty old <a href="http://en.wikipedia.org/wiki/Sun_Blade_%28workstation%29">Sun Blade 1500</a> from 2x512MB to 4x2GB RAM. Went on Ebay and picked up 8GB for $25 (4 x Elpida PC2100R-25330-N1, DDR ECC REG memory).<br />
<br />
Memory arrived a few days later but the Sun wasn't having any of it. POST said:<br />
<br />
<span class="st"><span style="font-family: Courier New, Courier, monospace;">ERROR: CPU0 DIMM 0 <em>SPD</em> reports DIMM cycle time is less than <em>133 MHz.</em></span></span><br />
<br />
It turns out that these machines are really picky about memory timings if you have the latest Openboot firmware. Most forum posts found with google suggest downgrading the firmware, but this isn't an option anymore since Oracle have since long pulled all firmwares from their support site.<br />
<br />
Apparently you need CL2 memory with an SPD1.0 ROM which is practially impossible to find these days.<br />
<br />
Hmm. Since there is the workaround of downgrading the Openboot firmware, I guessed the modules would actually be electrically compatible if you could somehow replace the SPD EEPROM. Time to fire up the scope and soldering iron!<br />
<br />
Cue impromptu SPD dumper / flasher tool:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-8PbAHS7KZfI/UZjSDUhtqAI/AAAAAAAAAG4/x8W4QmTPprw/s1600/DSC_5190.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="http://2.bp.blogspot.com/-8PbAHS7KZfI/UZjSDUhtqAI/AAAAAAAAAG4/x8W4QmTPprw/s320/DSC_5190.JPG" width="320" /></a></div>
<br />
<br />
Fortunately Elpida was kind enough not to write-protect the EEPROM so I didn't actually need to desolder it. The EEPROM needs 3.3V but the micro is 5V. A resistor divider with a cap provides the 3.3V rail.<br />
<br />
<br />
Now it was just a matter of dumping the first 64 bytes of the SPD of the working 512MB module:<br />
<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">8008070d0b0148000470750282040401 |......H..pu.....|</span><br />
<span style="font-family: Courier New, Courier, monospace;">0e040c010226c075750000503c502d80 |.....&.uu..P<P-.|</span><br />
<span style="font-family: Courier New, Courier, monospace;">909050500000000000414b3032756400 |..PP.....AK02ud.|</span><br />
<span style="font-family: Courier New, Courier, monospace;">00000000000000000000000000001077 |...............w|</span><br />
<br />
<div>
The new module:</div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">8008070d0c0248000475750282040401 |......H..uu.....|</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">0e040c010226c0a0750000503c502d01 |.....&..u..P<P-.|</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">909050500000000000414b3032750000 |..PP.....AK02u..|</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">000000000000000000000000000000b6 |................|</span></div>
<div>
<br /></div>
</div>
<div>
And patch stuff <a href="https://en.wikipedia.org/wiki/Serial_presence_detect#DDR_SDRAM">related to timing</a> but not to size:</div>
<div>
<br /></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace;">8008070d0c02480004<span style="color: red;"><b>70</b></span>750282040401 |......H..pu.....|</span></div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">0e040c010226c0<b><span style="color: red;">75</span></b>750000503c502d01 |.....&.uu..P<P-.|</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">909050500000000000414b303275<b><span style="color: red;">64</span></b>00 |..PP.....AK02ud.|</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">0000000000000000000000000000<b><span style="color: red;">10fa</span></b> |................|</span></div>
</div>
<div>
<br /></div>
<div>
This adjusts byte 9 (cycle time at highest CAS latency), byte 23 (cycle time at medium CAS latency), byte 46 (reserved value?), byte 62 (SPD revision) and byte 63 (checksum).</div>
<div>
<br /></div>
<div>
Success! Openboot and NetBSD detect both the old and the new memory:</div>
<div>
<br /></div>
<div>
<br />
<span style="font-family: Courier New, Courier, monospace;">spdmem0 at iic0 addr 0x50</span><br />
<span style="font-family: Courier New, Courier, monospace;">spdmem0: DDR SDRAM (registered), data ECC, 512MB, 286MHz (PC-2300)</span><br />
<span style="font-family: Courier New, Courier, monospace;">spdmem0: 13 rows, 11 cols, 1 ranks, 4 banks/chip, 7.0ns cycle time</span><br />
<span style="font-family: Courier New, Courier, monospace;">spdmem0: tAA-tRCD-tRP-tRAS: 1-3-3-7</span><br />
<span style="font-family: Courier New, Courier, monospace;">spdmem0: voltage SSTL 2.5V, refresh time 7.8us (self-refreshing)</span><br />
<span style="font-family: Courier New, Courier, monospace;">spdmem1 at iic0 addr 0x51</span><br />
<span style="font-family: Courier New, Courier, monospace;">spdmem1: DDR SDRAM (registered), data ECC, 512MB, 286MHz (PC-2300)</span><br />
<span style="font-family: Courier New, Courier, monospace;">spdmem1: 13 rows, 11 cols, 1 ranks, 4 banks/chip, 7.0ns cycle time</span><br />
<span style="font-family: Courier New, Courier, monospace;">spdmem1: tAA-tRCD-tRP-tRAS: 1-3-3-7</span><br />
<span style="font-family: Courier New, Courier, monospace;">spdmem1: voltage SSTL 2.5V, refresh time 7.8us (self-refreshing)</span><br />
<span style="font-family: Courier New, Courier, monospace;">spdmem2 at iic0 addr 0x52</span><br />
<span style="font-family: Courier New, Courier, monospace;">spdmem2: DDR SDRAM (registered), data ECC, 2GB, 286MHz (PC-2300)</span><br />
<span style="font-family: Courier New, Courier, monospace;">spdmem2: 13 rows, 12 cols, 2 ranks, 4 banks/chip, 7.0ns cycle time</span><br />
<span style="font-family: Courier New, Courier, monospace;">spdmem2: tAA-tRCD-tRP-tRAS: 1-3-3-7</span><br />
<span style="font-family: Courier New, Courier, monospace;">spdmem2: voltage SSTL 2.5V, refresh time 7.8us (self-refreshing)</span><br />
<span style="font-family: Courier New, Courier, monospace;">spdmem3 at iic0 addr 0x53</span><br />
<span style="font-family: Courier New, Courier, monospace;">spdmem3: DDR SDRAM (registered), data ECC, 2GB, 286MHz (PC-2300)</span><br />
<span style="font-family: Courier New, Courier, monospace;">spdmem3: 13 rows, 12 cols, 2 ranks, 4 banks/chip, 7.0ns cycle time</span><br />
<span style="font-family: Courier New, Courier, monospace;">spdmem3: tAA-tRCD-tRP-tRAS: 1-3-3-7</span><br />
<span style="font-family: Courier New, Courier, monospace;">spdmem3: voltage SSTL 2.5V, refresh time 7.8us (self-refreshing)</span><br />
<div>
<br /></div>
</div>
<br />
Curiously reports it as PC-2300 when it's supposed to be PC-2100 but oh well, it boots and seems to be stable enough for use.Tobias Nygrenhttp://www.blogger.com/profile/15496764645803120095noreply@blogger.com0tag:blogger.com,1999:blog-2004301043569712430.post-45373007493054285892013-02-25T04:38:00.001-08:002013-02-25T04:38:53.903-08:00Worthy successor of the Logitech UltraX flat keyboard?For years I've searched for a worthy replacement of the discontinued Logitech UltraX flat keyboard. I think I finally found something which looks and feels very close. The <a href="http://www.kjell.com/sortiment/dator-kringutrustning/datortillbehor/tangentbord/med-sladd/plexgear-sl-x-p98988">Plexgear SL-X</a>. Plexgear is a low-end OEM brand of the Kjell & Co electronics outlet store here in Sweden, but the keyboards are probably made in China and sold under many different brands. Some pictures for comparison:<br />
<br />
<a href="http://2.bp.blogspot.com/-bRIB626bsgA/UStYBl8nHkI/AAAAAAAAAFg/EQex8AN1kHc/s1600/20130225_131513%255B1%255D.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="150" src="http://2.bp.blogspot.com/-bRIB626bsgA/UStYBl8nHkI/AAAAAAAAAFg/EQex8AN1kHc/s200/20130225_131513%255B1%255D.jpg" width="200" /></a><a href="http://2.bp.blogspot.com/-Xbr0ge48Onc/UStYHpjQl3I/AAAAAAAAAFo/ShSgxrwpr4g/s1600/20130225_131531%255B1%255D.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="150" src="http://2.bp.blogspot.com/-Xbr0ge48Onc/UStYHpjQl3I/AAAAAAAAAFo/ShSgxrwpr4g/s200/20130225_131531%255B1%255D.jpg" width="200" /></a><a href="http://2.bp.blogspot.com/-30rPhyRhLMM/UStYLjondKI/AAAAAAAAAFw/yHG74O-ik7U/s1600/20130225_131538%255B1%255D.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="150" src="http://2.bp.blogspot.com/-30rPhyRhLMM/UStYLjondKI/AAAAAAAAAFw/yHG74O-ik7U/s200/20130225_131538%255B1%255D.jpg" width="200" /></a><a href="http://3.bp.blogspot.com/-m5xRrS1sy9Y/UStYWohNd7I/AAAAAAAAAF4/dGRes1ZL87Q/s1600/20130225_131543%255B1%255D.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="150" src="http://3.bp.blogspot.com/-m5xRrS1sy9Y/UStYWohNd7I/AAAAAAAAAF4/dGRes1ZL87Q/s200/20130225_131543%255B1%255D.jpg" width="200" /></a><a href="http://4.bp.blogspot.com/-FjnkuWVtGSA/UStYbyszlxI/AAAAAAAAAGA/ft-xl8aV8ok/s1600/20130225_131610%255B1%255D.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="150" src="http://4.bp.blogspot.com/-FjnkuWVtGSA/UStYbyszlxI/AAAAAAAAAGA/ft-xl8aV8ok/s200/20130225_131610%255B1%255D.jpg" width="200" /></a><a href="http://4.bp.blogspot.com/-30rPhyRhLMM/UStYLjondKI/AAAAAAAAAFw/yHG74O-ik7U/s1600/20130225_131538%5B1%5D.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"></a>
Tobias Nygrenhttp://www.blogger.com/profile/15496764645803120095noreply@blogger.com0tag:blogger.com,1999:blog-2004301043569712430.post-65899860921760990952012-04-18T11:58:00.001-07:002012-04-18T11:58:26.724-07:00Electroplating experimentsI'm trying to develop a DIY through-hole electroplating process. Initial results are promising. Will write more about it later, but for now only some pictures.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-Z9sqkQz1QQs/T48NuoL3GUI/AAAAAAAAAD8/ZJxT9JLQmH8/s1600/DSC_3578.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="http://2.bp.blogspot.com/-Z9sqkQz1QQs/T48NuoL3GUI/AAAAAAAAAD8/ZJxT9JLQmH8/s320/DSC_3578.JPG" width="179" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Sodium persulfate and some copper pipes dissolved in distilled water. Pretty colour. Gnarly stuff. Don't drink this.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-XCLc4ARtkBs/T48NvVN99pI/AAAAAAAAAEA/Gihf3afYcoE/s1600/DSC_3579.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="179" src="http://4.bp.blogspot.com/-XCLc4ARtkBs/T48NvVN99pI/AAAAAAAAAEA/Gihf3afYcoE/s320/DSC_3579.JPG" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Adding value to a 5 SEK coin.</td></tr>
</tbody></table>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>Tobias Nygrenhttp://www.blogger.com/profile/15496764645803120095noreply@blogger.com0tag:blogger.com,1999:blog-2004301043569712430.post-15960137565933219942012-04-13T14:56:00.000-07:002012-04-13T14:57:54.876-07:00DIY benchtop photolithography systemToday's hack is a benchtop photolithography system for developing printed circuit boards. It's made out of a pringles can. The inside of the pringles can is coated with aluminum which should help reflect UV light.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-AUqS83XKY7g/T4igpMjCinI/AAAAAAAAADk/yzsa1ULiNk4/s1600/DSC_3574_01.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="http://3.bp.blogspot.com/-AUqS83XKY7g/T4igpMjCinI/AAAAAAAAADk/yzsa1ULiNk4/s320/DSC_3574_01.JPG" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-m81Atqtfc7w/T4igp9mG_6I/AAAAAAAAADo/JTthLOX6Qao/s1600/DSC_3575_01.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="http://1.bp.blogspot.com/-m81Atqtfc7w/T4igp9mG_6I/AAAAAAAAADo/JTthLOX6Qao/s320/DSC_3575_01.JPG" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-DBoW2PKiI-0/T4igqWVN7NI/AAAAAAAAAD0/a18ycCaNi_A/s1600/DSC_3576_01.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="http://3.bp.blogspot.com/-DBoW2PKiI-0/T4igqWVN7NI/AAAAAAAAAD0/a18ycCaNi_A/s320/DSC_3576_01.JPG" width="320" /></a></div>
<br />Tobias Nygrenhttp://www.blogger.com/profile/15496764645803120095noreply@blogger.com0tag:blogger.com,1999:blog-2004301043569712430.post-68154336819480580352012-01-15T03:57:00.000-08:002012-01-15T03:59:16.114-08:00Trip computer hardware is almost doneI finished mounting the LCDs on the dashboard (using <a href="http://www.biltema.se/sv/Bilvard/Tatning/Karosseritatning-364829/">Biltema body sealant</a>). It just needs to cure for a while so I can grind down the edges. While waiting for that, I implemented a simple console driver with a backing-store for the LCD and printf-like interface that outputs characters to the LCD and serial port simultaneously.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/--h-LBiO_4Xo/TxK-enp-CoI/AAAAAAAAADQ/CsqtFbwUpe8/s1600/DSC_3541.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="179" src="http://2.bp.blogspot.com/--h-LBiO_4Xo/TxK-enp-CoI/AAAAAAAAADQ/CsqtFbwUpe8/s320/DSC_3541.JPG" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Modified Aygo center dashboard</td></tr>
</tbody></table>
I also finished the OBD-ii interface. I restored the 200<span class="st">Ω resistor on the active pulldown and added a 10k</span><span class="st">Ω</span><span class="st"> pullup to Vbat. It seems to work fine so I'll keep it that way.</span><br />
<span class="st"> </span> <br />
Since I draw power from an unswitched battery pin I need to avoid draining the battery when the car isn't running. For this I implemented a power management feature that probes for the ECU every 16 seconds via a watchdog timer and puts the AVR into standby mode when it detects the ignition is turned off. The nice thing about that is that I don't have to implement any flash memory persistence for medium-term statistics.<br />
<br />
Power consumption is around 8mA in standby mode and 40mA while running with full LED backlight. With 8mA standby current the car should be able to sit for at least two months without discharging.<br />
<br />
<br />Tobias Nygrenhttp://www.blogger.com/profile/15496764645803120095noreply@blogger.com1tag:blogger.com,1999:blog-2004301043569712430.post-15989688016171231222012-01-13T12:43:00.000-08:002012-01-13T12:43:00.513-08:00Circuit testing and tweaksToday I tried my home-grown OBD-ii interface in the car. At first it didn't work. I figured I probably had to boost the signals so I went back to the lab and made a solder bridge across the 200<span class="st">Ω resistor to maximize the strength of the active pull-down and added a 1k</span><span class="st">Ω resistor between the K line and Vbat for a stronger pull-up.</span><br />
<br />
<br />
Now, when I send the byte 0x33 to the car at 5 baud it responds with three bytes 0x55 0x08 0x08 at 10k4 baud. This is the ISO9141 initialization sequence which means the circuit works!<br />
<br />
I will probably try to weaken the pull-up/pull-down later but other than that the hardware implementation is pretty much done. Next is software.<br />
<br />
<br />
<br />Tobias Nygrenhttp://www.blogger.com/profile/15496764645803120095noreply@blogger.com0tag:blogger.com,1999:blog-2004301043569712430.post-3385174572087728142012-01-08T13:57:00.000-08:002012-01-09T13:15:43.455-08:00OBD to TTL transceiver circuit doneWell, I finished the transceiver circuit design and implementation. I added an extra transistor to avoid the transmitted data looping back to the rx port. It has only been tested with a multimeter so far, but it seems to do the right thing. The real test comes after I've implemented some initalization logic in the AVR. I'm still not sure if I need to add any external pull-up to the K line; will try first without and see how that goes.<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-OZk11fJxIyE/TwoSSKhyAvI/AAAAAAAAADI/CP_4HCTPqtM/s1600/obd-ii-ttl.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="150" src="http://4.bp.blogspot.com/-OZk11fJxIyE/TwoSSKhyAvI/AAAAAAAAADI/CP_4HCTPqtM/s200/obd-ii-ttl.png" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">schematic</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-vzXg2m_rT-g/TwoQn1G2YEI/AAAAAAAAADA/GPGoczUjGS0/s1600/DSC_3538_01.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="148" src="http://2.bp.blogspot.com/-vzXg2m_rT-g/TwoQn1G2YEI/AAAAAAAAADA/GPGoczUjGS0/s200/DSC_3538_01.JPG" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">stripboard</td></tr>
</tbody></table>
<br />
Edit: Note that real TTL serial idles high, but this implementation idles low. I'll invert the signals in the AVR code to save some components.<br />
<div class="separator" style="clear: both; text-align: center;">
</div>Tobias Nygrenhttp://www.blogger.com/profile/15496764645803120095noreply@blogger.com0tag:blogger.com,1999:blog-2004301043569712430.post-82097043021442140302012-01-07T16:22:00.000-08:002012-01-07T16:39:01.928-08:00ISO9141-2 K-line signallingBased on information from various sources on the Internet, I've pieced together that the ISO9141-2 K-line interface transmits data frames over a single-wire, half-duplex, 10.4k baud serial protocol similar to RS232. The idle state is supposedly maintained by a 510Ω
pull-up resistor to Vbat and the active/dominant state is implemented by an open collector driver. Sounds pretty straightforward to build a microcontroller interface for that.<br />
<br />
One thing I couldn't figure out was if I'm supposed to provide the idle pullup or if the ECU provides it for me. I've seen some schematics on the Internet that include the pullup and others that don't. It feels kind of dangerous to install an open collector driver on a port where I don't know the properties of the pullup.<br />
<br />
In order to figure that out, I devised a simple test: I installed a 460Ω resistor to ground on the K line and measured the voltage across it.<br />
<br />
With the ignition turned on (but engine off) I measured 12.01V on Vbat, 10.39V on the K line when left floating and 231mV across my Rtest when installed. This leads to my conclusion that there is a weak (~20kΩ) pull-up in place and that it should be safe for me to put a small series resistor on my open collector line driver to protect against shorting.<br />
<br />
Simplified, I think the line driver in the ECU looks something like this:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-y5WYflIB5NI/TwjkM2LF23I/AAAAAAAAAC4/bzP5sNgJOwI/s1600/ecudriver.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="267" src="http://2.bp.blogspot.com/-y5WYflIB5NI/TwjkM2LF23I/AAAAAAAAAC4/bzP5sNgJOwI/s320/ecudriver.png" width="320" /></a></div>Tobias Nygrenhttp://www.blogger.com/profile/15496764645803120095noreply@blogger.com0tag:blogger.com,1999:blog-2004301043569712430.post-9456659589342247462012-01-07T07:06:00.000-08:002012-01-07T07:31:55.320-08:00Current project: trip computerRecently I've become increasingly annoyed by the shortcomings of the dashboard in my car (a Toyoya Aygo). Some of the annoyances are impreciseness of the fuel gauge, lack of coolant temperature display and the fact that I no longer have a real time clock. (The clock is integrated in the factory mounted car stereo which I've replaced with an aftermarket stereo)<br />
<br />
I've looked for solutions and found the <a href="http://www.scangauge.net/">ScanGauge II trip computer</a> quite interesting. But considering it's priced at €150 and is basically an <a href="http://en.wikipedia.org/wiki/Obdii#OBD-II">OBDii</a> interface with a microcontroller and an LCD display I decided I can probably build something better and cheaper myself.<br />
<br />
A while ago I found the excellent swedish "electronics hacker store" <a href="http://www.electrokit.com/">electrokit</a> and have been thinking about a suitable project to revive some of the things I learned while studying at <a href="http://www.isy.liu.se/">ISY</a>. So I ordered some AVR microcontrollers, LCD displays, voltage regulators and fired up the soldering station for the first time in a while.<br />
<a href="http://www.electrokit.com/"><br /></a><br />
Here is a picture of the current project status:<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-i0ibTU9L2m8/TwhghOmNRUI/AAAAAAAAACw/D5O0ibCfUeE/s1600/DSC_3519.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="212" src="http://2.bp.blogspot.com/-i0ibTU9L2m8/TwhghOmNRUI/AAAAAAAAACw/D5O0ibCfUeE/s320/DSC_3519.JPG" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Work in progress trip computer</td></tr>
</tbody></table>
To the left is a stripboard with a TO220 package voltage regulator to convert the 12V car supply to the TTL levels I need for my trip computer circuit. I also put a one amp glass fuse on there for electrical safety so the car doesn't catch fire in case I screw up the soldering.<br />
<br />
On top is the AVR microcontroller. It's a surface mounted package which comes presoldered on a breakout board under the <a href="http://www.arduino.cc/">Arduino</a> brand name. It also comes with a pre-installed boot loader for rapid prototyping, which is nice.<br />
<br />
The flat cables are dual <a href="http://en.wikipedia.org/wiki/Hitachi_HD44780_LCD_controller">HD44780</a>-compatible LCD display outputs wired up to the AVR. Embedded in the hot-melt glue are also two NPN transistors and resistors for driving the LCD backlights with <a href="http://en.wikipedia.org/wiki/Pulse-width_modulation">PWM</a>.<br />
<br />
Not pictured is the TTL conversion circuitry for the car diagnostics port. I will probably finish that part tonight.<br />
<br />Tobias Nygrenhttp://www.blogger.com/profile/15496764645803120095noreply@blogger.com0tag:blogger.com,1999:blog-2004301043569712430.post-40450149454283497322012-01-07T06:10:00.000-08:002012-01-07T06:34:53.077-08:00First postI think it's time to create a place where I can ramble freely about computing, electronics, mad scientistry and society in general.Tobias Nygrenhttp://www.blogger.com/profile/15496764645803120095noreply@blogger.com0