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

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2013-07-06T17:30:54+02:00</updated>

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

		<entry>
		<author><name><![CDATA[bbarny]]></name></author>
		<updated>2013-07-06T17:30:54+02:00</updated>

		<published>2013-07-06T17:30:54+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=5779&amp;p=25552#p25552</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=5779&amp;p=25552#p25552"/>
		<title type="html"><![CDATA[Re: 2 SOF detection in 1ms (SOLVED!!!)]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=5779&amp;p=25552#p25552"><![CDATA[
I have received from OBDEV expert a correct answer for my original problem as follows: ( <img class="smilies" src="./../../../images/smilies/icon_biggrin.gif" alt=":D" title="Very Happy" />   <img class="smilies" src="./../../../images/smilies/icon_biggrin.gif" alt=":D" title="Very Happy" />   <img class="smilies" src="./../../../images/smilies/icon_biggrin.gif" alt=":D" title="Very Happy" />  ) <br /><br />&gt;&gt;<br />&gt;&gt;This behavior does not surprise me, since the SOF detection does not actually<br />&gt;&gt; trigger on SOF but rather on malformed sync patterns.<br />&gt;&gt; If we see an edge, but can't detect a valid sync pattern, we assume it's<br />&gt;&gt; a SOF spike. We don't have the time to identify SOF correctly, the<br />&gt;&gt; pulse is long over when the interrupt handler executes.<br />&gt;&gt;<br />&gt;&gt; Furthermore, SOF pulses are frequently followed immediately by<br />&gt;&gt; valid data packets. If you do some SOF processing (even if it's only a couple<br />&gt;&gt; of instructions), you miss the data packet.<br />&gt;&gt;That's not a problem because the host will retry the packet.<br />&gt;&gt; However, the remainings of the packet trigger another USB interrupt and<br />&gt;&gt; at that point we usually can't detect a valid sync pattern.<br />&gt;&gt; This makes us believe that it's another SOF pulse.<br />&gt;&gt;<br />&gt;&gt; This is not a problem for our purposes of SOF detection since we do a kind of PLL<br />&gt;&gt; synchronization only. If the SOF time is far from the expected value, we simply<br />&gt;&gt; ignore it.<br />&gt;&gt;<br />&gt;&gt; If you need precise timing, I would recommend that you do the same.<br />&gt;&gt; Use the built-in oscillator to set a reasonable window for the distance between<br />&gt;&gt; SOF pulses. This will eliminate the second one.<br />&gt;&gt;<br />&gt;&gt; BTW: Whether or not there is a second SOF detected depends on the host/hub<br />&gt;&gt; implementation.<br />&gt;&gt;<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=5395">bbarny</a> — Sat Jul 06, 2013 5:30 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[EmbeddedCreations]]></name></author>
		<updated>2013-06-03T16:04:12+02:00</updated>

		<published>2013-06-03T16:04:12+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=5779&amp;p=25355#p25355</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=5779&amp;p=25355#p25355"/>
		<title type="html"><![CDATA[Re: 2 SOF detection in 1ms]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=5779&amp;p=25355#p25355"><![CDATA[
I had the same issue as you, and was using the SOF hook to capture the value of a timer and clear it.  I skipped the extra run through the hook routine by looking for a low timer value and jumping past the rest of the code in the routine if the value was too low.<br /><br />Hope that helps (maybe not you, but someone else searching for an answer to this issue)<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=6720">EmbeddedCreations</a> — Mon Jun 03, 2013 4:04 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bbarny]]></name></author>
		<updated>2011-07-24T23:18:33+02:00</updated>

		<published>2011-07-24T23:18:33+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=5779&amp;p=19113#p19113</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=5779&amp;p=19113#p19113"/>
		<title type="html"><![CDATA[Re: 2 SOF detection in 1ms]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=5779&amp;p=19113#p19113"><![CDATA[
I summarize the problem again:<br />- Since the USB host sends Start-Of_Frame (SOF) packet to the device in every 1ms, I want to detect the arriving of SOF packets to the device. I thought, there is only one SOF packet in each 1ms time interval, but using the SOF detection capability of the V_USB software, I found, sometimes it detects more then 1 in 1ms.<br />To see SOF on oscilloscope I defined the myUSB_SOF_HOOK macro to contain the instruction “sbi PINB,1”. This instruction toggles PB1 pin (if its direction is set to output) when SOF is detected. But instead of getting a square wave signal on PB1 with 50% duty cycle and 2ms cycle time, I got a narrow spike in every 1 ms. It means, that an SOF detection is followed nearly immediately with an other SOF detection.<br />My question is:<br />How can I detect only the first SOF in each 1ms period?<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=5395">bbarny</a> — Sun Jul 24, 2011 11:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2011-07-24T02:02:51+02:00</updated>

		<published>2011-07-24T02:02:51+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=5779&amp;p=19108#p19108</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=5779&amp;p=19108#p19108"/>
		<title type="html"><![CDATA[Re: 2 SOF detection in 1ms]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=5779&amp;p=19108#p19108"><![CDATA[
sbi does not toggle: &quot;Set Bit in I/O Register&quot; &quot;I/O(P,b) ← 1&quot;<br />So really it should be High(1) all the time, you must have something else setting it Low(0).<p>Statistics: Posted by Guest — Sun Jul 24, 2011 2:02 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bbarny]]></name></author>
		<updated>2011-06-30T17:50:54+02:00</updated>

		<published>2011-06-30T17:50:54+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=5779&amp;p=18832#p18832</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=5779&amp;p=18832#p18832"/>
		<title type="html"><![CDATA[2 SOF detection in 1ms]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=5779&amp;p=18832#p18832"><![CDATA[
Using an USB_SOF_HOOK macro (only one instruction: sbi PINB,1 ) in order to toggle PB1 for testing SOF detection, instead of getting a square wave signal on output pin 1, a narrow pulse appears in every 1 ms. The pulse width is less then 100us. Actually it is around 5us.<br />Can the USB driver of the device detect 2 SOF instead of 1 in every 1ms? How can I eliminate it?<br />During a data exchange between host and device the PB1 pulse polarity changes several times, but between two data exchange the polarity is stable. It seems to have a second SOF detected following by 100us the first one, but some times only a single SOF is detected. <br /><br />The PB1 signal sequence looks like:<br />1ms rate:       ........|......|......|......|.......|......|.......|....<br />PB1 output:     L...LHL...LHL...LHL...LHH...HLH...HLL...LHL...<br />The expected PB1 sequence would be:<br />PB1 output:     L...LHH...HLL...LHH...HLL...LHH...HLL...LHH...<br /><br />(I am using a HID application based on ATtiny45. The USB D- and D+ lines are connected to PB3 and PB4 respectively. The application uses PB0 and PB2 as input, PB1 as output, PB5 as reset. Only pin change interrupt on D- is used. The HOST exchanges data with the device in every 400ms.<br />The main parameter setings:<br />#define USB_CFG_HAVE_INTRIN_ENDPOINT    1 <br />#define USB_CFG_HAVE_INTRIN_ENDPOINT3   0 <br />#define USB_CFG_EP3_NUMBER              3 <br />#define USB_CFG_SUPPRESS_INTR_CODE      0 <br />#define USB_CFG_INTR_POLL_INTERVAL      10 <br />#define USB_CFG_IMPLEMENT_FN_WRITE      1 <br />#define USB_CFG_IMPLEMENT_FN_READ       1 <br />)<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=5395">bbarny</a> — Thu Jun 30, 2011 5:50 pm</p><hr />
]]></content>
	</entry>
	</feed>
