<?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/6109" />

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2011-11-16T04:13:28+02:00</updated>

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

		<entry>
		<author><name><![CDATA[honupata]]></name></author>
		<updated>2011-11-16T04:13:28+02:00</updated>

		<published>2011-11-16T04:13:28+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6109&amp;p=20198#p20198</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6109&amp;p=20198#p20198"/>
		<title type="html"><![CDATA[Re: usbPoll() &amp; _delay_ms() error]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6109&amp;p=20198#p20198"><![CDATA[
Thank you for the info.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=5786">honupata</a> — Wed Nov 16, 2011 4:13 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ulao]]></name></author>
		<updated>2011-10-27T04:11:27+02:00</updated>

		<published>2011-10-27T04:11:27+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6109&amp;p=19999#p19999</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6109&amp;p=19999#p19999"/>
		<title type="html"><![CDATA[Re: usbPoll() &amp; _delay_ms() error]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6109&amp;p=19999#p19999"><![CDATA[
well there ya go.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1281">ulao</a> — Thu Oct 27, 2011 4:11 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Daid]]></name></author>
		<updated>2011-10-24T10:54:11+02:00</updated>

		<published>2011-10-24T10:54:11+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6109&amp;p=19963#p19963</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6109&amp;p=19963#p19963"/>
		<title type="html"><![CDATA[Re: usbPoll() &amp; _delay_ms() error]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6109&amp;p=19963#p19963"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>USB_PUBLIC void usbPoll(void);<br />/* This function must be called at regular intervals from the main loop.<br /> * Maximum delay between calls is somewhat less than 50ms (USB timeout for<br /> * accepting a Setup message). Otherwise the device will not be recognized.<br /> * Please note that debug outputs through the UART take ~ 0.5ms per byte<br /> * at 19200 bps.<br /> */</code></pre></div><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=5154">Daid</a> — Mon Oct 24, 2011 10:54 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ulao]]></name></author>
		<updated>2011-10-23T21:45:32+02:00</updated>

		<published>2011-10-23T21:45:32+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6109&amp;p=19930#p19930</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6109&amp;p=19930#p19930"/>
		<title type="html"><![CDATA[Re: usbPoll() &amp; _delay_ms() error]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6109&amp;p=19930#p19930"><![CDATA[
I apologize if I'm out of line here, and I can not say I know whether or not this is an issue. However I'm fairly certain 500 ms is a bit of a long wait in between pulls. I though t the usb expects talk after x ms, otherwise quits.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1281">ulao</a> — Sun Oct 23, 2011 9:45 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[honupata]]></name></author>
		<updated>2011-10-22T05:24:49+02:00</updated>

		<published>2011-10-22T05:24:49+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6109&amp;p=19925#p19925</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6109&amp;p=19925#p19925"/>
		<title type="html"><![CDATA[usbPoll() &amp; _delay_ms() error]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6109&amp;p=19925#p19925"><![CDATA[
Hi,<br /><br />I'm blinking a RGB LED depending of the the number in buffer[0] (fill with usbFunctionWrite).<br />Everything is working fine without the 2 _delay_ms(500) in the main loop but with them I can only do one write (ie 0x03 for 3 blinks) after I lost the connection and I can't do any reads or writes.<br />Someone have a clue why the _delay_ms() in the main loop  is crashing the usbPoll()  ?<br /><br />Thank you<br /><br />Here is my main:<br /><br /><div class="codebox"><p>Code: </p><pre><code>int main(void) <br />{<br />   // PWM LED<br />   int iteration = 0;<br />   uchar colorState = 0;<br />   // PWM LED<br />   // Set pins to output<br />    DDRB|= _BV(REDLED);<br />   DDRB|= _BV(GREENLED);<br />   DDRB|= _BV(BLUELED);<br /><br />   // VUSB   <br />   wdt_enable(WDTO_1S);<br />   usbInit();<br />   <br />       uchar delayIteration = 20;<br />        while(delayIteration){ //300 ms disconnect, also allows our oscillator to stabilize<br />              _delay_ms(1);<br />              delayIteration--;<br />       }<br />        sei(); <br /><br />    for(;;) /* main event loop */<br />    {    <br />      // VUSB<br />      wdt_reset();<br />      usbPoll();<br />            <br />      if (iteration==INTERATION_MAX)<br />      {<br />         int nbrMessage;<br />         for (nbrMessage =  buffer&#91;0&#93;;nbrMessage&gt;0;nbrMessage--)<br />         {   <br />            wdt_reset();<br /><br />            PORTB &amp;= ~(1&lt;&lt;REDLED);<br />            PORTB &amp;= ~(1&lt;&lt;GREENLED);<br />            PORTB &amp;= ~(1&lt;&lt;BLUELED);<br /><br />            // !!!!!!!!! Here !!!!!!!!!!!!!<br />            // I lost the connection after one write if I leave this delay and the other after.<br />            _delay_ms(500);  <br /><br />            PORTB |= (1&lt;&lt;REDLED);<br />            PORTB |= (1&lt;&lt;GREENLED);<br />            PORTB |= (1&lt;&lt;BLUELED) ;<br /><br />            // !!!!!!!!! Here !!!!!!!!!!!!!<br />            _delay_ms(500); <br />          }<br />         iteration=0; <br />      }<br />    }<br />    return 0;<br />}<br /></code></pre></div><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=5786">honupata</a> — Sat Oct 22, 2011 5:24 am</p><hr />
]]></content>
	</entry>
	</feed>
