<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Embedded Freaks.. &#187; embedded-tips</title>
	<atom:link href="http://embeddedfreak.wordpress.com/category/embedded-tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://embeddedfreak.wordpress.com</link>
	<description>Daily embedded life tips and trick</description>
	<lastBuildDate>Sat, 14 Nov 2009 00:47:09 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='embeddedfreak.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/9f1113cc5558fcab720e54b7e5a379eb?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Embedded Freaks.. &#187; embedded-tips</title>
		<link>http://embeddedfreak.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://embeddedfreak.wordpress.com/osd.xml" title="Embedded Freaks.." />
		<item>
		<title>Tracing I2C Communication Direction</title>
		<link>http://embeddedfreak.wordpress.com/2009/11/14/tracing-i2c-communication-direction/</link>
		<comments>http://embeddedfreak.wordpress.com/2009/11/14/tracing-i2c-communication-direction/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 00:13:06 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[embedded-tips]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=487</guid>
		<description><![CDATA[Sometimes, the most difficult part when dealing with I2C is to differentiate the communication direction: which signal is sent to which device. Hence, this simple trick should be useful.

Things to notice is that:

It only works for two devices debugging
The hump that is caused by the resistor should not exceed the threshold of maximum VInput (ie [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=487&subd=embeddedfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Sometimes, the most difficult part when dealing with I2C is to differentiate the communication direction: which signal is sent to which device. Hence, this simple trick should be useful.</p>
<p><span id="more-487"></span></p>
<div id="attachment_488" class="wp-caption aligncenter" style="width: 441px"><img class="size-full wp-image-488" title="I2C_Debug_1" src="http://embeddedfreak.files.wordpress.com/2009/11/i2c_debug_1.png?w=431&#038;h=425" alt="I2C_Debug_1" width="431" height="425" /><p class="wp-caption-text">I2C Debugging Trick</p></div>
<p>Things to notice is that:</p>
<ul>
<li>It only works for two devices debugging</li>
<li>The hump that is caused by the resistor should not exceed the threshold of maximum VInput (ie not exceeding 0.3V for CMOS device or 0.7V for TTL device)</li>
</ul>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/487/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/487/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/487/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/487/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/487/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/487/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/487/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/487/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/487/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/487/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=487&subd=embeddedfreak&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2009/11/14/tracing-i2c-communication-direction/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>

		<media:content url="http://embeddedfreak.files.wordpress.com/2009/11/i2c_debug_1.png" medium="image">
			<media:title type="html">I2C_Debug_1</media:title>
		</media:content>
	</item>
		<item>
		<title>Simple rectifier for MCU PSU</title>
		<link>http://embeddedfreak.wordpress.com/2009/07/10/simple-rectifier-for-mcu-psu/</link>
		<comments>http://embeddedfreak.wordpress.com/2009/07/10/simple-rectifier-for-mcu-psu/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 15:55:08 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[embedded-tips]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=436</guid>
		<description><![CDATA[A friend of mine told me about simple rectifier configuration that&#8217;s usually deployed in white goods (iron, washing machine, vacuum cleaner, etc). You can view the explanation here and here. It&#8217;s very interesting to know that you actually don&#8217;t need a big transformer or even switching PSU to supply your MCU from AC source.
Here&#8217;s my [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=436&subd=embeddedfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>A friend of mine told me about simple rectifier configuration that&#8217;s usually deployed in white goods (iron, washing machine, vacuum cleaner, etc). You can view the explanation <a title="AN954, Transformerless Power Supplies: Resistive and Capacitive" href="http://ww1.microchip.com/downloads/en/AppNotes/00954A.pdf">here</a> and <a title="Transformerless Power Supply, TB008" href="http://ww1.microchip.com/downloads/en/AppNotes/91008b.pdf">here</a>. It&#8217;s very interesting to know that you actually don&#8217;t need a big transformer or even switching PSU to supply your MCU from AC source.</p>
<p>Here&#8217;s my schematic for my own board:</p>
<p><span id="more-436"></span><img class="aligncenter size-large wp-image-437" title="SimpleRectifier" src="http://embeddedfreak.files.wordpress.com/2009/07/simplerectifier.png?w=641&#038;h=188" alt="SimpleRectifier" width="641" height="188" />It will generate 5.1VDC at 21.12mA. Or at least that&#8217;s what I hope =)</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/436/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/436/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/436/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/436/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/436/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/436/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/436/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/436/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/436/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/436/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=436&subd=embeddedfreak&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2009/07/10/simple-rectifier-for-mcu-psu/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>

		<media:content url="http://embeddedfreak.files.wordpress.com/2009/07/simplerectifier.png?w=1024" medium="image">
			<media:title type="html">SimpleRectifier</media:title>
		</media:content>
	</item>
		<item>
		<title>Linear PSU Efficiency Quiz</title>
		<link>http://embeddedfreak.wordpress.com/2009/05/09/linear-psu-efficiency-quiz/</link>
		<comments>http://embeddedfreak.wordpress.com/2009/05/09/linear-psu-efficiency-quiz/#comments</comments>
		<pubDate>Sat, 09 May 2009 10:15:25 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[embedded-tips]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=431</guid>
		<description><![CDATA[Moving out to Singapore, I&#8217;ve become nearly disabled. No solder, no board, no multimeter, etc. Actually, my employer provides me with the tools, but I&#8217;m kinda hesitated to use it for my own personal use. I guess I have to buy it for my own later.
Anyway, since I&#8217;ve got nothing to do this Sunday, I&#8217;ve [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=431&subd=embeddedfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Moving out to Singapore, I&#8217;ve become nearly disabled. No solder, no board, no multimeter, etc. Actually, my employer provides me with the tools, but I&#8217;m kinda hesitated to use it for my own personal use. I guess I have to buy it for my own later.</p>
<p>Anyway, since I&#8217;ve got nothing to do this Sunday, I&#8217;ve come up with quizzes, just to test my electronic insanity. What is the efficiency of these ugly linear PSUs ?</p>
<div id="attachment_432" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-432" title="Simple Zener Rectifier" src="http://embeddedfreak.files.wordpress.com/2009/05/linear.png?w=300&#038;h=217" alt="Simple Zener Rectifier" width="300" height="217" /><p class="wp-caption-text">Simple Zener Rectifier</p></div>
<p>I&#8217;d say its efficiency is 17.59%..Here&#8217;s another one:</p>
<div id="attachment_433" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-433" title="Current Feedback Linear Rectifier with PVR100AD" src="http://embeddedfreak.files.wordpress.com/2009/05/pvr100ad_circuit.png?w=300&#038;h=181" alt="Current Feedback Linear Rectifier" width="300" height="181" /><p class="wp-caption-text">Current Feedback Linear Rectifier</p></div>
<p>My insanity said that it&#8217;s efficiency is 17.64%.</p>
<p>Is there anyone who has different answer than me ? <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/431/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=431&subd=embeddedfreak&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2009/05/09/linear-psu-efficiency-quiz/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>

		<media:content url="http://embeddedfreak.files.wordpress.com/2009/05/linear.png?w=300" medium="image">
			<media:title type="html">Simple Zener Rectifier</media:title>
		</media:content>

		<media:content url="http://embeddedfreak.files.wordpress.com/2009/05/pvr100ad_circuit.png?w=300" medium="image">
			<media:title type="html">Current Feedback Linear Rectifier with PVR100AD</media:title>
		</media:content>
	</item>
		<item>
		<title>Removing Unused Functions/Dead Codes with GCC/GNU-ld</title>
		<link>http://embeddedfreak.wordpress.com/2009/02/10/removing-unused-functionsdead-codes-with-gccgnu-ld/</link>
		<comments>http://embeddedfreak.wordpress.com/2009/02/10/removing-unused-functionsdead-codes-with-gccgnu-ld/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 02:25:07 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[embedded-tips]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=404</guid>
		<description><![CDATA[I was suprised to know that GCC failed to remove the dead codes from my program. Here&#8217;s an example:
kunil@cerpelai:~/Temp$ vi test.c
#include 
void unusedFunction(void) {
  printf(&#8220;This is a dead code\n&#8221;);
}
int main(void) {
  printf(&#8220;Hello world\n&#8221;);
  return 0;
}
kunil@cerpelai:~/Temp$ gcc -Os test.c -o test.elf
If you take a look carefully on the ELF binary, you can see that GCC still [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=404&subd=embeddedfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I was suprised to know that GCC failed to remove the dead codes from my program. Here&#8217;s an example:</p>
<p>kunil@cerpelai:~/Temp$ vi test.c<br />
#include <stdio.h></p>
<p>void unusedFunction(void) {<br />
  printf(&#8220;This is a dead code\n&#8221;);<br />
}</p>
<p>int main(void) {<br />
  printf(&#8220;Hello world\n&#8221;);<br />
  return 0;<br />
}</p>
<p>kunil@cerpelai:~/Temp$ gcc -Os test.c -o test.elf</p>
<p>If you take a look carefully on the ELF binary, you can see that GCC still includes the &#8220;unusedFunction()&#8221;, although nothing refers to it.</p>
<p>kunil@cerpelai:~/Temp$ objdump -d test.elf </p>
<p>test.elf:     file format elf32-i386<br />
&#8230;.<br />
080483c4 <main>:<br />
&#8230;.<br />
080483e9 <unusedFunction>:<br />
&#8230;.</p>
<p>So I was wondering if there&#8217;s something wrong with GCC (or GNU-ld), or should I add something to remove it.<br />
<span id="more-404"></span>After googling a while, I found this <a href="http://gcc.gnu.org/ml/gcc-help/2003-08/msg00128.html">link</a>, which exactly explains how to do it. So, to repeat the link, to remove the dead/unused functions:</p>
<ul>
<li>Compile with &#8220;<em>-fdata-sections</em>&#8221; to keep the data in separate data sections and &#8220;<em>-ffunction-sections</em>&#8221; to keep functions in separate sections, so they (data and functions) can be discarded if unused.</li>
<li>Link with &#8220;<em>&#8211;gc-sections</em>&#8221; to remove unused sections.</li>
</ul>
<p>So, the above example should be compiled with:</p>
<p>kunil@cerpelai:~/Temp$ gcc -Os -fdata-sections -ffunction-sections test.c -o test.elf -Wl,&#8211;gc-sections</p>
<p>And dead codes now is really really dead.</p>
<p>Btw, <em>&#8220;&#8211;gc-sections&#8221;</em> is architecture dependent. Your architecture&#8217;s GNU-ld may or may not support it. I have tested it with <em>avr-ld</em> and <em>Ubuntu Intrepid ld</em>. Both supports <em>&#8220;&#8211;gc-sections&#8221;</em> option.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/404/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=404&subd=embeddedfreak&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2009/02/10/removing-unused-functionsdead-codes-with-gccgnu-ld/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>
	</item>
		<item>
		<title>Setting Netbeans for Embedded Linux Application Development</title>
		<link>http://embeddedfreak.wordpress.com/2008/12/16/setting-netbeans-for-embedded-linux-application-development/</link>
		<comments>http://embeddedfreak.wordpress.com/2008/12/16/setting-netbeans-for-embedded-linux-application-development/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 10:57:37 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[embedded-linux]]></category>
		<category><![CDATA[embedded-tips]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=317</guid>
		<description><![CDATA[I&#8217;m using Netbeans as my IDE to build embedded linux application. Here&#8217;s the small guide to setup your Netbeans for cross compiler IDE.
Setup The Toolchain
I&#8217;m using CodeSourcery GCC toolchain for my TS-7260 ARM9 board. Download their lite toolchain package, and install it somewhere in your system. For me, I installed it into $HOME/CodeSourcery.  It [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=317&subd=embeddedfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;m using Netbeans as my IDE to build embedded linux application. Here&#8217;s the small guide to setup your Netbeans for cross compiler IDE.</p>
<p><span id="more-317"></span><strong>Setup The Toolchain</strong></p>
<p>I&#8217;m using CodeSourcery GCC toolchain for my TS-7260 ARM9 board. Download their <a href="http://www.codesourcery.com/gnu_toolchains/arm/portal/subscription?@template=lite">lite toolchain package</a>, and install it somewhere in your system. For me, I installed it into <em>$HOME/CodeSourcery</em>.  It doesn&#8217;t matter where you put it, as long you can remember its place.</p>
<p><strong>Setup The Netbeans</strong></p>
<p>I&#8217;m using the new Netbeans 6.5. Download and install it (anywhere you like). Then run it. Open <em>Tools-&gt;Options-&gt;C/C++</em>.</p>
<p><img class="aligncenter size-medium wp-image-320" title="netbeans_c_option" src="http://embeddedfreak.files.wordpress.com/2008/12/netbeans_c_option.png?w=300&#038;h=245" alt="netbeans_c_option" width="300" height="245" /></p>
<p>On your left pane, there&#8217;s <em>Tool Collection</em> pane. Click<em> </em><em>add.</em><strong>.</strong>Fill the <em>Base Directory</em> field with the directory where you put the CodeSourcery (until<strong> </strong><em>bin/</em> directory). Fill the <em>Tool Collection Name</em> with the name of the toolchain (I named it <em>CodeSourcery_ARM_Toolchain</em>, but you can choose anything that you like).</p>
<p><img class="aligncenter size-medium wp-image-321" title="add_new_tool" src="http://embeddedfreak.files.wordpress.com/2008/12/add_new_tool.png?w=300&#038;h=154" alt="add_new_tool" width="300" height="154" />After that, fill up the C/C+/GDB compiler path (eg. take a look at the 1st picture).</p>
<p>Ok that&#8217;s it. Now your Netbeans can be used as IDE for CodeSourcery&#8217;s cross compiler.</p>
<p><strong>Testing Your Setup</strong></p>
<p>Create new C/C++ project: <em>File -&gt;New Project-&gt;C/C++-&gt;C/C++ Application</em>. Let&#8217;s name our test project as <em>ts_hello</em>, and leave everything (except for the name) as default. Once the project is created, modify its properties: <em>Right click the project name on Project View-&gt;Properties</em>.</p>
<p><img class="aligncenter size-medium wp-image-323" title="project_prop_cross_compile" src="http://embeddedfreak.files.wordpress.com/2008/12/project_prop_cross_compile.png?w=300&#038;h=210" alt="project_prop_cross_compile" width="300" height="210" />Goto <em>Build-&gt;Tool Collection</em>, and select the cross toolchain.</p>
<p>Then, goto the <em>C Compiler-&gt;Additional options</em>. This is where you inform the compiler what kind of target architecture that you want. For TS-72xx, add &#8220;<img src="///tmp/moz-screenshot-1.jpg" alt="" /><img src="///tmp/moz-screenshot-2.jpg" alt="" /><strong><em>-march=armv4t -static</em></strong>&#8220;. For TS-78xx, add &#8220;<strong><em>-march=armv5t -static</em></strong>&#8220;.</p>
<p>That&#8217;s it. The project is now configured for ARM920T target.</p>
<p>Now, for the infamous hello world program, add new C files on the project, and type:</p>
<p>#include<br />
#include </p>
<p>/*<br />
 * Hello world for TS-7260 with Netbeans 6.5<br />
 */<br />
int main(int argc, char** argv) {<br />
  printf(&#8220;Hello Worldn&#8221;);<br />
  return (EXIT_SUCCESS);<br />
}</p>
<p>Remember this carefully, you are cross-compiling. <strong>You cannot run the binary on your host</strong> (ie. on your PC). What you can do is build the binary, put it inside the ARM&#8217;s root filesystem, and run it from your board. So, goto <em>Run-&gt;Clean and Build Main Project</em> to compile the program.</p>
<p>If everything is okay, copy the <em>ts_hello</em> executable file into your root fs (I&#8217;m using NFS, so I just need to copy it locally). Like this:</p>
<pre class="brush: java;">

# sudo cp dist/Debug/CodeSourcery_ARM_Toolchain-Linux-x86/ts_hello /nfs/tmp/mnt/root/
</pre>
<p>Then boot your board, and run your hello world with:</p>
<pre class="brush: java;">

# ./root/ts_hello
</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/317/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/317/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/317/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/317/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/317/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/317/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/317/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/317/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/317/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/317/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=317&subd=embeddedfreak&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2008/12/16/setting-netbeans-for-embedded-linux-application-development/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>

		<media:content url="http://embeddedfreak.files.wordpress.com/2008/12/netbeans_c_option.png?w=300" medium="image">
			<media:title type="html">netbeans_c_option</media:title>
		</media:content>

		<media:content url="http://embeddedfreak.files.wordpress.com/2008/12/add_new_tool.png?w=300" medium="image">
			<media:title type="html">add_new_tool</media:title>
		</media:content>

		<media:content url="http://embeddedfreak.files.wordpress.com/2008/12/project_prop_cross_compile.png?w=300" medium="image">
			<media:title type="html">project_prop_cross_compile</media:title>
		</media:content>

		<media:content url="///tmp/moz-screenshot-1.jpg" medium="image" />

		<media:content url="///tmp/moz-screenshot-2.jpg" medium="image" />
	</item>
		<item>
		<title>AVR Auto Power Mode Selection</title>
		<link>http://embeddedfreak.wordpress.com/2008/10/06/avr-auto-power-mode-selection/</link>
		<comments>http://embeddedfreak.wordpress.com/2008/10/06/avr-auto-power-mode-selection/#comments</comments>
		<pubDate>Mon, 06 Oct 2008 11:04:14 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[avr]]></category>
		<category><![CDATA[embedded-tips]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=178</guid>
		<description><![CDATA[To optimize the AVR&#8217;s power consumption, you will need to modify its power mode according to the peripheral that you need at that time.
This is the part of the TinyOS ATMega128 driver that you can use directly (without TinyOS). It will select the best power mode for the MCU, based on the peripheral(s) that is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=178&subd=embeddedfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>To optimize the AVR&#8217;s power consumption, you will need to modify its power mode according to the peripheral that you need at that time.</p>
<p>This is the part of the TinyOS ATMega128 driver that you can use directly (without TinyOS). It will select the best power mode for the MCU, based on the peripheral(s) that is active.</p>
<p><span id="more-178"></span></p>
<p>  uint8_t getPowerState() {<br />
    // Note: we go to sleep even if timer 1, 2, or 3&#8217;s overflow interrupt<br />
    // is enabled &#8211; this allows using these timers as TinyOS &#8220;Alarm&#8221;s<br />
    // while still having power management.</p>
<p>    // Are external timers running?<br />
    if (TIMSK &#038; ~(1 << OCIE0 | 1 << TOIE0 | 1 << TOIE1 | 1 << TOIE2) ||<br />
    ETIMSK &#038; ~(1 << TOIE3)) {<br />
      return SLEEP_MODE_IDLE;<br />
    }<br />
    // SPI (Radio stack on mica/micaZ<br />
    else if (bit_is_set(SPCR, SPE)) {<br />
      return SLEEP_MODE_IDLE;<br />
    }<br />
    // A UART is active<br />
    else if ((UCSR0B | UCSR1B) &#038; (1 << TXCIE | 1 << RXCIE)) { // UART<br />
      return SLEEP_MODE_IDLE;<br />
    }<br />
    // I2C (Two-wire) is active<br />
    else if (bit_is_set(TWCR, TWEN)){<br />
      return SLEEP_MODE_IDLE;<br />
    }<br />
    // ADC is enabled<br />
    else if (bit_is_set(ADCSR, ADEN)) {<br />
      return SLEEP_MODE_ADC;<br />
    }<br />
    else {<br />
      return SLEEP_MODE_PWR_DOWN;<br />
    }<br />
  }</p>
<p>How to use it ? Simple, just call the function to select the correct power mode, before going to sleep. Like this:</p>
<p>while(1)<br />
{<br />
  // do homework before going to nap</p>
<p>  // Take a nap<br />
  set_sleep_mode(getPowerState());<br />
  sleep_mode();<br />
}</p>
<p>Therefore, you can turn on/off your peripheral while optimizing the power mode selection on the fly. Nice invention from TinyOS&#8217; contributor.</p>
<p>Anyway, the function is not covering the whole AVR&#8217;s peripheral (and its sleeping mode), but I guess you got the catch.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/178/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=178&subd=embeddedfreak&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2008/10/06/avr-auto-power-mode-selection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>
	</item>
		<item>
		<title>Using jEdit as NesC&#8217;s Editor</title>
		<link>http://embeddedfreak.wordpress.com/2008/10/01/using-jedit-as-nescs-editor/</link>
		<comments>http://embeddedfreak.wordpress.com/2008/10/01/using-jedit-as-nescs-editor/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 07:41:43 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[embedded-tips]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=163</guid>
		<description><![CDATA[What&#8217;s the thing that I don&#8217;t like from NesC ? Well, it doesn&#8217;t have any of IDE. I heard that Eclipse has plugin for NesC/TinyOS, but I&#8217;m too lazy to download and install whole 210MB of Eclipse, just to have NesC&#8217;s IDE.
My solution was to use simple editor, such as jEdit, then add some plugin [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=163&subd=embeddedfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>What&#8217;s the thing that I don&#8217;t like from NesC ? Well, it doesn&#8217;t have any of IDE. I heard that Eclipse has plugin for NesC/TinyOS, but I&#8217;m too lazy to download and install whole 210MB of Eclipse, just to have NesC&#8217;s IDE.</p>
<p>My solution was to use simple editor, such as <a title="jEdit - Programmer's Text Editor" href="http://www.jedit.org/">jEdit</a>, then add some plugin to execute Makefile and highlight the NesC/TinyOS syntax.</p>
<p>Here&#8217;s the how to</p>
<p><span id="more-163"></span></p>
<p><strong>Syntax Highlighting</strong></p>
<ol>
<li>Download the archived files from <a title="jEdit Syntax Highlight files" href="http://www.4shared.com/file/65194658/fba28213/jedit_nc-091001tar.html">here</a></li>
<li>Find the jEdit local settings directory. In linux, it will be <strong>$HOME/.jedit</strong></li>
<li>Check whether <strong>$HOME/.jedit/catalog</strong> fle is empty or not.</li>
<li>If it is empty, untar the file in <strong>$HOME/.jedit/modes</strong> directory</li>
<li>If it is not empty, copy the <strong>nc.xml</strong> into <strong>$HOME/.jedit/modes</strong> directory. Thus, add this line in the <strong>$HOME/.jedit/modes/catalog</strong> file: <strong>&lt;MODE NAME=&#8221;nesc&#8221; FILE=&#8221;nc.xml&#8221; FILE_NAME_GLOB=&#8221;*.nc&#8221; /&gt;</strong></li>
<li>Restart jEdit</li>
</ol>
<p><em>Additional notes:</em></p>
<ul>
<li>Some NesC files that have been opened before this mode is added will not be highlighted. Delete the <strong>recent.xml</strong> and <strong>history</strong> file in <strong>$HOME/.jedit</strong></li>
<li>You can have this syntax highlight as global (affected all the jEdit users in the system), by replacing the path of <strong>$HOME/.jedit</strong> to <strong>&lt;your_jEdit_installation_directory&gt;</strong></li>
<li>This howto is tested using jEdit 4.3pre15, and Java 1.6.0</li>
</ul>
<p><strong>Makefile Execution</strong></p>
<p><em>&gt; Coming up very soon</em></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/163/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=163&subd=embeddedfreak&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2008/10/01/using-jedit-as-nescs-editor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>
	</item>
		<item>
		<title>RS232 Serial Sniffer/Monitoring Circuit</title>
		<link>http://embeddedfreak.wordpress.com/2008/08/17/rs232-serial-sniffermonitoring-circuit/</link>
		<comments>http://embeddedfreak.wordpress.com/2008/08/17/rs232-serial-sniffermonitoring-circuit/#comments</comments>
		<pubDate>Sun, 17 Aug 2008 08:01:48 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[embedded-tips]]></category>
		<category><![CDATA[debugging]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=95</guid>
		<description><![CDATA[I&#8217;m having trouble debugging the AVR-to-GSM modem serial communication.
Fortunately, my colleague has made me a circuit to view the communication. Unfortunately, it takes two serial ports just to debug the serial communication while my laptop doesn&#8217;t have any serial ports (I use USB-serial converter). So, I was thinking to buy another USB-serial converter, before I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=95&subd=embeddedfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;m having trouble debugging the AVR-to-GSM modem serial communication.</p>
<p>Fortunately, my colleague has made me a circuit to view the communication. Unfortunately, it takes two serial ports just to debug the serial communication while my laptop doesn&#8217;t have any serial ports (I use USB-serial converter). So, I was thinking to buy another USB-serial converter, before I was struck by this idea.</p>
<p>Here&#8217;s the simplest circuit to debug the RS232 serial communication between two devices:</p>
<p><span id="more-95"></span></p>
<div id="attachment_96" class="wp-caption alignnone" style="width: 310px"><a href="http://embeddedfreak.files.wordpress.com/2008/08/rs232_sniffer.png"><img class="size-medium wp-image-96" src="http://embeddedfreak.files.wordpress.com/2008/08/rs232_sniffer.png?w=300&#038;h=245" alt="RS232 Sniffer/Monitoring Schematic" width="300" height="245" /></a><p class="wp-caption-text">RS232 Sniffer/Monitoring Schematic (taken using gEDA-gschem)</p></div>
<p>Believe it or not, although the signal that&#8217;s received by the sniffer is not 100% perfect, this circuit works !!</p>
<p>For diode, I use 1N4004 power diode (since that was the only thing that was inside my pocket). But if you want to make it better, I suggest to use Schottky diodes (since they have low forward voltage and fast recovery).</p>
<p>Anyway, there are other things that you should know too before using this circuit. First, you cannot use this circuit to debug full duplex communication (data is sent while other data is received at the same time). Second, the baud rate is limited by the choice of your diode (that&#8217;s why you need fast recovery diodes).</p>
<h4>Additional Info</h4>
<p>There&#8217;s other version of this circuit. Like this:</p>
<p><img class="aligncenter" src="http://www.airborn.com.au/serial/rs232f.gif" alt="" width="387" height="269" /></p>
<p>You can refer to <a title="RS232 Connector wiring" href="http://www.airborn.com.au/rs232.html">the original site</a> for the details of this circuit.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/embeddedfreak.wordpress.com/95/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/embeddedfreak.wordpress.com/95/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/95/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=95&subd=embeddedfreak&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2008/08/17/rs232-serial-sniffermonitoring-circuit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>

		<media:content url="http://embeddedfreak.files.wordpress.com/2008/08/rs232_sniffer.png?w=300" medium="image">
			<media:title type="html">RS232 Sniffer/Monitoring Schematic</media:title>
		</media:content>

		<media:content url="http://www.airborn.com.au/serial/rs232f.gif" medium="image" />
	</item>
		<item>
		<title>Using GNU screen to debug your serial port</title>
		<link>http://embeddedfreak.wordpress.com/2008/08/12/using-gnu-screen-to-debug-your-serial-port/</link>
		<comments>http://embeddedfreak.wordpress.com/2008/08/12/using-gnu-screen-to-debug-your-serial-port/#comments</comments>
		<pubDate>Tue, 12 Aug 2008 04:06:52 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[embedded-tips]]></category>
		<category><![CDATA[debugging]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=74</guid>
		<description><![CDATA[I&#8217;m using Linux, and tools like Window&#8217;s Hyperterminal to debug your serial port is rare, difficult to use, unpractical, and I have to live with it =) So, after moving here and there, I finally choose my favorite serial debugger in Linux: GNU Screen.
Here&#8217;s some tips to use it for your debugging:


Opening serial port (with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=74&subd=embeddedfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;m using Linux, and tools like Window&#8217;s Hyperterminal to debug your serial port is rare, difficult to use, unpractical, and I have to live with it =) So, after moving here and there, I finally choose my favorite serial debugger in Linux: GNU Screen.</p>
<p>Here&#8217;s some tips to use it for your debugging:</p>
<p><span id="more-74"></span></p>
<ul>
<li><strong>Opening serial port (with the correct baud rate)<br />
</strong></li>
</ul>
<pre class="brush: python;">
bash&gt; screen /dev/ttyUSB0 57600
</pre>
<p>/dev/ttyUSB0 is the serial port, while 57600 sets its baud rate into 57600bps.</p>
<ul>
<li><strong>Enable the CTS/RTS handshake</strong></li>
</ul>
<pre class="brush: python;">
bash&gt; screen /dev/ttyUSB0 57600,ctsrts
</pre>
<ul>
<li><strong>Close the screen after you finish the debugging session</strong></li>
</ul>
<pre>Ctrl + A + k</pre>
<ul>
<li><strong>View your serial port status (CTS/RTS/DTS/PE/RI..etc)</strong></li>
</ul>
<pre>Ctrl + A + i</pre>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/embeddedfreak.wordpress.com/74/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/embeddedfreak.wordpress.com/74/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/74/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=74&subd=embeddedfreak&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2008/08/12/using-gnu-screen-to-debug-your-serial-port/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>
	</item>
		<item>
		<title>Facts about Battery</title>
		<link>http://embeddedfreak.wordpress.com/2007/10/01/facts-about-battery/</link>
		<comments>http://embeddedfreak.wordpress.com/2007/10/01/facts-about-battery/#comments</comments>
		<pubDate>Mon, 01 Oct 2007 09:11:39 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[embedded-tips]]></category>
		<category><![CDATA[hardware]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/2007/10/01/facts-about-battery/</guid>
		<description><![CDATA[I&#8217;m designing battery powered embedded systems. Here&#8217;s some lessons that I got in my daily work.



1000mAH battery should last 10 hours under 100mA continous load, right ?

Whoops&#8230;Read carefully on the battery datasheet &#8212;if you are serious about your work, you should have serious battery supplier vendor which supports you with real datasheet and/or battery sample [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=10&subd=embeddedfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;m designing battery powered embedded systems. Here&#8217;s some lessons that I got in my daily work.</p>
<p align="center"><a title="Energizer E91" href="http://embeddedfreak.files.wordpress.com/2007/10/e91_battery.jpg"><img src="http://embeddedfreak.files.wordpress.com/2007/10/e91_battery.thumbnail.jpg" alt="Energizer E91" /></a></p>
<p><span id="more-10"></span></p>
<ul>
<li><strong>1000mAH battery should last 10 hours under 100mA continous load, right ?</strong></li>
</ul>
<p>Whoops&#8230;Read carefully on the battery datasheet &#8212;if you are serious about your work, you should have serious battery supplier vendor which supports you with real datasheet and/or battery sample =).</p>
<p>1000mAH claim is based on how much continous current draw that your system take. Most of the batteries will die sooner, if you load them more than the datasheet requirement. I&#8217;m taking Energizer E91 battery as example.</p>
<p align="center"><a title="Battery Capasity vs Current Consumption" href="http://embeddedfreak.files.wordpress.com/2007/10/milliamphourscapasity.jpg"><img src="http://embeddedfreak.files.wordpress.com/2007/10/milliamphourscapasity.thumbnail.jpg" alt="Battery Capasity vs Current Consumption" width="171" height="106" /></a></p>
<p>Under 25mA continous load, the battery has 2750 mAH capasity. Under 100mA continous load, the battery has only  around 2000mAH.</p>
<p>This is the characteristic of battery&#8217;s chemical reaction. Battery&#8217;s cathode has limited ability to absorb ion from the anode. Therefore, under heavy load, there&#8217;ll be a layer of ion covers the battery&#8217;s cathode. The heavier the load is, the thicker the layer will be. This layer will prevent other ion from anode to reach cathode. Hence, reduce the total capasity of the battery under continous load.</p>
<p>So, to predict how long your system will run, you will need to average your current draw, and match it with the battery&#8217;s datasheet.</p>
<ul>
<li><strong>Slew rate and battery</strong></li>
</ul>
<p>Like I said, the battery has limited capability to absorb ion from the anode (or battery has limited current that can be delivered in a time). To load battery with higher current, you need to increase the load gradually and slowly. If, you push high load suddenly, the cathode may be broken. This is the explanation why rechargeable battery that was shorted (and has not exploded or burned yet) cannot recover its full capasitance.</p>
<p>The same principle also applies to the slew rate. High speed systems usually have higher slew rate. Therefore, it&#8217;s able to draw current higher than the battery&#8217;s cathode can supply in a time. This may damage the battery. If the battery is rechargeable, this will reduce its charging life.</p>
<p>My suggestion is use capasitors to reduce the current spikes in your system. My experience with this is using the oscilloscope with the resistor in series with the battery. Then, adjust the capasitors (by soldering/desoldering them on board) until the spike slope is reduced. It&#8217;s not easy, but designing the best products have never been easy anyway.</p>
<ul>
<li><strong>Can we extract more power with boost regulator ? </strong></li>
</ul>
<p>This is the thing that I bet you&#8217;re thinking when designing battery powered system. If the battery is low, can we use boost regulator ?</p>
<p>Be careful with the boost regulator. Boost regulator has great efficiency (90%-98%) only if the difference between input-output voltage is low (refer to the boost regulator datasheet). If the difference between input and output is too high, the efficiency is greatly reduced (from 60%-80%..Refer to the datasheet). It means that if the battery is low, more power is needed to boost the voltage than doing the job.</p>
<p>The solution for this is to design the system with minimum operational voltage. The next step is to design the boost regulator to shutdown the system (stop regulating) if the minimum operational voltage reached. This is important, since most of batteries will have zero voltage right after their capasity is finish (its voltage will not gradually down again).</p>
<p><a title="Battery VCC Characteristic" href="http://embeddedfreak.files.wordpress.com/2007/10/vcc_vs_hour.jpg"></a></p>
<p style="text-align:center;"><a title="Battery VCC Characteristic" href="http://embeddedfreak.files.wordpress.com/2007/10/vcc_vs_hour.jpg"><img src="http://embeddedfreak.files.wordpress.com/2007/10/vcc_vs_hour.thumbnail.jpg" alt="Battery VCC Characteristic" width="222" height="161" /></a></p>
<p>In the diagram, the boost regulator should stop working before 0.9V reached.</p>
<p>In battery application, after the system is off for some time, the battery voltage will rise again. This may trigger the system to active. However, since there&#8217;s no capasity left, the battery will drop dead soon. So, it&#8217;s like bouncing ball..the system is on, then off, then on, then off again..This may create trash data logged into the system.</p>
<p>To prevent this kind of problem, add delay in the boost regulator. So, the system will on, only if the battery is stabile for some time.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/embeddedfreak.wordpress.com/10/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/embeddedfreak.wordpress.com/10/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=10&subd=embeddedfreak&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2007/10/01/facts-about-battery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>

		<media:content url="http://embeddedfreak.files.wordpress.com/2007/10/e91_battery.thumbnail.jpg" medium="image">
			<media:title type="html">Energizer E91</media:title>
		</media:content>

		<media:content url="http://embeddedfreak.files.wordpress.com/2007/10/milliamphourscapasity.thumbnail.jpg" medium="image">
			<media:title type="html">Battery Capasity vs Current Consumption</media:title>
		</media:content>

		<media:content url="http://embeddedfreak.files.wordpress.com/2007/10/vcc_vs_hour.thumbnail.jpg" medium="image">
			<media:title type="html">Battery VCC Characteristic</media:title>
		</media:content>
	</item>
	</channel>
</rss>