<?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; design-issue</title>
	<atom:link href="http://embeddedfreak.wordpress.com/tag/design-issue/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; design-issue</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>Handling URC (Unsolicited Result Code) in Hayes AT Command</title>
		<link>http://embeddedfreak.wordpress.com/2008/08/19/handling-urc-unsolicited-result-code-in-hayes-at-command/</link>
		<comments>http://embeddedfreak.wordpress.com/2008/08/19/handling-urc-unsolicited-result-code-in-hayes-at-command/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 03:19:30 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[programming-tips]]></category>
		<category><![CDATA[design-issue]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=99</guid>
		<description><![CDATA[URC is the message that is sent from the ME (Mobile Equipment, eg. GSM/GPRS/CDMA modem) that\&#8217;s not the result of the AT command.
Here\&#8217;s some examples: RING is sent when the modem is called, CONNECTED is sent when the modem answer the call, or +CNMI is sent when modem received new SMS. You can think of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=99&subd=embeddedfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>URC is the message that is sent from the ME (Mobile Equipment, eg. GSM/GPRS/CDMA modem) that\&#8217;s not the result of the AT command.</p>
<p>Here\&#8217;s some examples: <code>RING</code> is sent when the modem is called, <code>CONNECTED</code> is sent when the modem answer the call, or <code>+CNMI</code> is sent when modem received new SMS. You can think of URC as modem\&#8217;s soft interrupt.</p>
<p>So, what\&#8217;s the problem with the URC ? Unless you haven\&#8217;t programmed any of application that deals with the modem directly, you will notice that URC sometimes destroy your parser state machine when it fires in middle of executing AT command.</p>
<p>Here\&#8217;s the illustration of the URC problem:</p>
<p><code><br />
application&gt;AT+CMGL=4 # List all of SMS inside the ME<br />
ME&gt; RING # Incoming call<br />
ME&gt; OK # There\'s no SMS inside the ME<br />
ME&gt; RING # Incoming call<br />
</code></p>
<p>The RING between AT+CMGL and OK is happenned because the AT command hasn\&#8217;t reach the serial port, while the incoming call is received. This may break the AT command parser. But there\&#8217;s a way to help it.</p>
<p><span id="more-99"></span></p>
<h4>Turn ON the ECHO (ATE1)</h4>
<p>Most of application samples that I\&#8217;ve seen turn off the ECHO (by sending ATE0). The reason is unknown, but most of them saying to reduce the serial port communication (hence reducing the parser effort). But that is not correct.</p>
<p>If you want to build robust communication, you should turn ON the ECHO. The reason is simple, you can detect the sequence of the command/URC that\&#8217;s received by the modem. Here\&#8217;s the actual sequence of the illustration above (viewed from the modem\&#8217;s echo):</p>
<p><code><br />
application&gt;AT+CMGL=4 # List all of SMS inside the ME<br />
ME&gt; OK # There\'s no SMS inside the ME<br />
ME&gt; RING # Incoming call<br />
ME&gt; RING # Incoming call<br />
</code></p>
<p>Most of modems will have this feature activated in the start-up. Otherwise, you have to activated it manually using ATE1 command.</p>
<h4>Give Delay for Each AT Command</h4>
<p>All of AT commands are ended with OK (or ERROR/+CME ERROR/+CMS ERROR). Once you\&#8217;ve received the string, you need to wait (ie. 100ms) before launching another AT command. By this way, you will not crash your AT command with the URC from modem (The modem will guarantee that it will not issue URC while AT command is processed..but it will issue URC once the AT command is finished..That\&#8217;s why you have to wait).</p>
<h4>Use The Special Purpose Pin</h4>
<p>This feature is not available in all of modems. But in certain modems, such as Siemens TC35, it has special pin that will be pulled low during the URC. This might be used as the low triggered interrupt for the main MCU/MPU.</p>
<p>I bet this feature is far more useful than sending URC..but since it\&#8217;s not standard feature, I cannot rely on it.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/embeddedfreak.wordpress.com/99/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/embeddedfreak.wordpress.com/99/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/99/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=99&subd=embeddedfreak&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2008/08/19/handling-urc-unsolicited-result-code-in-hayes-at-command/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>
	</item>
	</channel>
</rss>