<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forums.obdev.at/app.php/feed/topic/585" />

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2007-07-16T23:20:43+02:00</updated>

	<author><name><![CDATA[Objective Development Forums]]></name></author>
	<id>https://forums.obdev.at/app.php/feed/topic/585</id>

		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2007-07-16T23:20:43+02:00</updated>

		<published>2007-07-16T23:20:43+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=585&amp;p=1722#p1722</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=585&amp;p=1722#p1722"/>
		<title type="html"><![CDATA[AVR USB device and UART Polling]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=585&amp;p=1722#p1722"><![CDATA[
Since the suggested code goes into rxChar_poll() only when data is available, there's no delay, at least no delay related to the bit rate. The maximum delay between calls to usbPoll() is documented in usbdrv.h, I think it's 50 ms.<br /><br />One byte sent through asynchronous serial transmission consists of 10 bits. This means that one byte at 9600 bps takes 10 / 9600 = 1.04 ms. But that's not relevant in your case.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Mon Jul 16, 2007 11:20 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2007-07-16T20:51:20+02:00</updated>

		<published>2007-07-16T20:51:20+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=585&amp;p=1720#p1720</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=585&amp;p=1720#p1720"/>
		<title type="html"><![CDATA[Wrong File Name]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=585&amp;p=1720#p1720"><![CDATA[
sry , the file name was usbdrv.h not obDebug.h<p>Statistics: Posted by Guest — Mon Jul 16, 2007 8:51 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2007-07-16T20:46:28+02:00</updated>

		<published>2007-07-16T20:46:28+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=585&amp;p=1719#p1719</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=585&amp;p=1719#p1719"/>
		<title type="html"><![CDATA[USB polling time]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=585&amp;p=1719#p1719"><![CDATA[
Hi christian<br />  One more doubt i had in my mind . How much maximum delay is <br />  allowed between two successive calls to usbPoll() ? if the delay is <br />  more than the time it takes to receive the 12 bytes over the UART<br />  at a baud rate of 9600 by the AVR clocked at 12Mhz , then that <br />  shouldn't matter . Should it ? I have seen in the odDebug.h , it is<br />  written  that it takes .5ms per byte to receive the data on the UART <br />  at 19200bps through polling, but my baud rate is 9600 so is it .25ms per <br />  byte ? then it should be  .25ms / byte x 12 bytes = 3ms .<br />  Am i correct ?<p>Statistics: Posted by Guest — Mon Jul 16, 2007 8:46 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2007-07-16T17:35:26+02:00</updated>

		<published>2007-07-16T17:35:26+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=585&amp;p=1715#p1715</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=585&amp;p=1715#p1715"/>
		<title type="html"><![CDATA[AVR USB device and UART Polling]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=585&amp;p=1715#p1715"><![CDATA[
Yes, checking for data available on the UART is done via the RXC flag. The while statement should therefore be:<br /><div class="codebox"><p>Code: </p><pre><code>    while&#40;UCSRA &amp; &#40; 1 &lt;&lt; RXC &#41;&#41;&#123;<br />        ....<br />    &#125;<br /></code></pre></div><br /><br />The watchdog timer is a hardware unit which resets your device when the firmware has crashed. Your firmware must call wdt_reset() in regular intervals to prove that it has not crashed (yet).<br /><br />The watchdog timer is turned on and configured for a maximum interval somewhere close to the beginning of main().<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Mon Jul 16, 2007 5:35 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2007-07-16T17:29:51+02:00</updated>

		<published>2007-07-16T17:29:51+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=585&amp;p=1714#p1714</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=585&amp;p=1714#p1714"/>
		<title type="html"><![CDATA[UART polling]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=585&amp;p=1714#p1714"><![CDATA[
Hi christian , <br />     My rxChar_poll() is this <br /><div class="codebox"><p>Code: </p><pre><code>char rxChar_poll &#40; void &#41;<br />&#123;<br />        while &#40; ! &#40; UCSRA &amp; &#40; 1 &lt;&lt; RXC &#41; &#41; &#41; ;<br />        return UDR ;<br /><br />&#125;<br /></code></pre></div><br />     Well i got your point , but i didnt get one thing out of what you wrote <br /><div class="codebox"><p>Code: </p><pre><code> while &#40; data available on UART &#41; </code></pre></div> how do i check whether data is available <br />on the UART , is it checking for the RXC flag ?<br />   <br />By the way what is the watchdog timer doing here ?<p>Statistics: Posted by Guest — Mon Jul 16, 2007 5:29 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2007-07-16T15:57:09+02:00</updated>

		<published>2007-07-16T15:57:09+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=585&amp;p=1709#p1709</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=585&amp;p=1709#p1709"/>
		<title type="html"><![CDATA[AVR USB device and UART Polling]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=585&amp;p=1709#p1709"><![CDATA[
With this code, you'll not only run into troubles with AVR-USB, you will also get hit by the watchdog. I don't know what your rxChar_poll() routine looks like, but I suspect that it busy-waits for a character to arrive on the UART.<br /><br />Since it may take a long time until 12 bytes are received, your main loop will not iterate with the required frequency.<br /><br />Please see the RemoteSensor example (receiver firmware) how to receive data in the background from an interrupt routine. If you don't want to use interrupts and have a low bit rate, you could also so something like this:<br /><div class="codebox"><p>Code: </p><pre><code>for&#40;;;&#41;&#123;<br />    wdt_reset&#40;&#41;;<br />    usbPoll&#40;&#41;;<br />    while&#40;data available on UART&#41;&#123;<br />        receiveBuffer&#91;i++&#93; = rxChar_poll&#40;&#41;;<br />        if&#40;i &gt;= 12&#41;&#123;<br />            do_whatever_you_like_with_buffer&#40;&#41;;<br />            i = 0;<br />        &#125;<br />    &#125;<br />&#125;<br /></code></pre></div><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Mon Jul 16, 2007 3:57 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2007-07-15T21:34:43+02:00</updated>

		<published>2007-07-15T21:34:43+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=585&amp;p=1702#p1702</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=585&amp;p=1702#p1702"/>
		<title type="html"><![CDATA[AVR USB device and UART Polling]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=585&amp;p=1702#p1702"><![CDATA[
Hi , <br />    Is it not possible to receive 12 bytes of data at Buad Rate of 9600 <br />    with the AVR polling the usb in the main loop .<br />    i am doing like this <br />    <div class="codebox"><p>Code: </p><pre><code>    //main loop<br />    for &#40; ; ; &#41; &#123;<br />    wdt_reset&#40;&#41;;<br />    usbPoll&#40;&#41;;<br />   for &#40; i = 0 ; i &lt; 12 ; i++ &#41; <br />    receiveBuffer&#91;i&#93;=rxChar_poll&#40;&#41;;<br />   &#125;<br />   </code></pre></div><br /><br />   and i am pointing usbMsgPtr  =  receiveBuffer in the usbFunctionSetup() <br />   function and returning 12 . When does these 12 bytes get transferred <br />   through the USB port to the host pc .<br />   I am always receiving 0 0 0 0 0 0 0 0 0 0 0 0 as the 12 bytes at the <br />   host , whatever the transmission may be .<p>Statistics: Posted by Guest — Sun Jul 15, 2007 9:34 pm</p><hr />
]]></content>
	</entry>
	</feed>
