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

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2010-01-17T19:44:44+02:00</updated>

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

		<entry>
		<author><name><![CDATA[z0ttel]]></name></author>
		<updated>2010-01-17T19:44:44+02:00</updated>

		<published>2010-01-17T19:44:44+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3778&amp;p=12870#p12870</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3778&amp;p=12870#p12870"/>
		<title type="html"><![CDATA[Re: V-USB HID joystick doesn't work ... sometimes]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3778&amp;p=12870#p12870"><![CDATA[
Update: Grendel, your hint was right. After inserting a sei() at the beginning of the ADC ISR the device ran as expected. Thank you very much - you saved my day  <img class="smilies" src="./../../../images/smilies/icon_biggrin.gif" alt=":D" title="Very Happy" /><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=680">z0ttel</a> — Sun Jan 17, 2010 7:44 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[z0ttel]]></name></author>
		<updated>2010-01-17T12:31:39+02:00</updated>

		<published>2010-01-17T12:31:39+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3778&amp;p=12860#p12860</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3778&amp;p=12860#p12860"/>
		<title type="html"><![CDATA[Re: V-USB HID joystick doesn't work ... sometimes]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3778&amp;p=12860#p12860"><![CDATA[
@Grendel: thanks for the hint - I must have overlooked this ...  <img class="smilies" src="./../../../images/smilies/icon_neutral.gif" alt=":|" title="Neutral" /> <br /><br />That would mean that I must ensure that there are no ISR blocking situations which last longer than ~2µs (25/12MHz) - is that correct? In the code there's a section where I copy several 100 bytes of data with interrupts disabled - so I will have to check the runtime for that, too.<br /><br />Damn, time to get an oscilloscope ...  <img class="smilies" src="./../../../images/smilies/icon_biggrin.gif" alt=":D" title="Very Happy" /><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=680">z0ttel</a> — Sun Jan 17, 2010 12:31 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Grendel]]></name></author>
		<updated>2010-01-17T09:01:39+02:00</updated>

		<published>2010-01-17T09:01:39+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3778&amp;p=12858#p12858</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3778&amp;p=12858#p12858"/>
		<title type="html"><![CDATA[Re: V-USB HID joystick doesn't work ... sometimes]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3778&amp;p=12858#p12858"><![CDATA[
Check usbdrv.h:<br /><br /><div class="codebox"><p>Code: </p><pre><code>Interrupt latency:<br />The application must ensure that the USB interrupt is not disabled for more<br />than 25 cycles (this is for 12 MHz, faster clocks allow longer latency).<br />This implies that all interrupt routines must either be declared as &quot;INTERRUPT&quot;<br />instead of &quot;SIGNAL&quot; (see &quot;avr/signal.h&quot;) or that they are written in assembler<br />with &quot;sei&quot; as the first instruction.</code></pre></div><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=101">Grendel</a> — Sun Jan 17, 2010 9:01 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[z0ttel]]></name></author>
		<updated>2010-01-16T21:59:29+02:00</updated>

		<published>2010-01-16T21:59:29+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3778&amp;p=12855#p12855</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3778&amp;p=12855#p12855"/>
		<title type="html"><![CDATA[Re: V-USB HID joystick doesn't work ... sometimes]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3778&amp;p=12855#p12855"><![CDATA[
I forgot something to mention: sometimes (1 out of 10 tries or so), the device gets recognized by windows and is shown in the game controller panel. But then it seems, that the communication broke down, because no matter what I do, the shown values of the analog axis don't change any more. If I change the analog input value on the device (by twisting a poti), then that value seems to be displayed after disconnecting and connecting the device to the usb bus.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=680">z0ttel</a> — Sat Jan 16, 2010 9:59 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2010-01-16T20:56:01+02:00</updated>

		<published>2010-01-16T20:56:01+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3778&amp;p=12852#p12852</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3778&amp;p=12852#p12852"/>
		<title type="html"><![CDATA[V-USB HID joystick doesn't work ... sometimes]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3778&amp;p=12852#p12852"><![CDATA[
Hi,<br /><br />I'm tyring to create a HID joystick device based on V-USB and I'm nearly going mad. I took the HID-mouse example as basis for my project: I modified the descriptor, threw out the advanceCircleByFixedAngle() function, added the ADC routines and got it finally running. The device got recognized by windows 7 x64 and the captured analog data (1 axis, 10 bit) was shown in the gamepad controller panel.<br /><br />Then I wanted to extend the firmware so that now 5 analog inputs are sampled by the ADC and sent to the host. First, I just added the ADC routines and didn't modify the USB descriptor (in usbSetInterrupt() the same data is sent as before) - the ADC routines are working fine (I checked this with AVR dragon and AVRStudio), but now the device doesn't get recognized by windows any more!  <img class="smilies" src="./../../../images/smilies/icon_eek.gif" alt=":shock:" title="Shocked" /> The data sent via USB hasn't been modified and the structure to send the data hasn't also been modified - I just added some code to the ADC routine.<br /><br />My assumption is that because of the ADC interrupt service routine gets triggered more often now this breaks the usb communication part somehow. I tried to get some information about time-criticial parts of V-USB, but either I'm blind or their not documented.<br /><br />The problem occurs on an ATmega32 running at 12MHz. The endless loop in main.c looks like this:<br /><br /><div class="codebox"><p>Code: </p><pre><code>for(;;){                /* main event loop */<br />        wdt_reset();<br /><br />        AdcGetCurrentStatus (&amp;AdcCurrentState_en);<br /><br />        /* Get data from Adc if AD conversion is finished */<br />        if (ADC_FINISHED == AdcCurrentState_en) {<br /><br />            /* Read single channel data from ADC */<br />            AdcGetCurrentData(&amp;AnalogAxisData_u16);<br />        }<br /><br />        usbPoll();<br /><br />        if(usbInterruptIsReady()){<br />            usbSetInterrupt((void *)&amp;AnalogAxisData_u16, sizeof(AnalogAxisData_u16));<br />        }<br />    }</code></pre></div><br /><br />Any ideas, anyone?<p>Statistics: Posted by Guest — Sat Jan 16, 2010 8:56 pm</p><hr />
]]></content>
	</entry>
	</feed>
