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

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2008-01-24T14:31:21+02:00</updated>

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

		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2008-01-24T14:31:21+02:00</updated>

		<published>2008-01-24T14:31:21+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3966#p3966</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3966#p3966"/>
		<title type="html"><![CDATA[AVR-USB on ATmega 162]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3966#p3966"><![CDATA[
The logical conclusion would be that there is something in your interrupt handler which affects AVR-USB.<br /><br />You DID declare your interrupt handler with __attribute__ ((interrupt)), right? And there is no cli() in the interrupt handler or any other code which runs only if the interrupt occurs?<br /><br />To analyze this, can you replace the interrupt handlers with an empty function and check whether USB works in this case? If it does, go back to the original code for one of them, then the other to find out which caused the problem. If you nailed down one particular interrupt handler, start with an empty function and add more and more of the desired code until you know which change causes the problem.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Thu Jan 24, 2008 2:31 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2008-01-24T12:37:55+02:00</updated>

		<published>2008-01-24T12:37:55+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3965#p3965</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3965#p3965"/>
		<title type="html"><![CDATA[AVR-USB on ATmega 162]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3965#p3965"><![CDATA[
Hi all,<br /><br />I have got now the AVR Dragon for debugging, but still no luck. <br /><br />Here is what I see and what I have verified:<br /><br />- the basic USB functionality is working if I don't use the Timer/Counter1<br />- if I enable TImer/Counter1, the USB stops working. (message: connected device is not ok...)<br />- the program does not hang, if I stop the program, it holds at different positions in the code (usb_poll)<br />- I have implemented the following ISR: SIG_INPUT_CAPTURE1 and SIG_TIMER1_COMPA<br />- both are ok, they are called if they should, this is verified<br /><br />Here is how I enable the TImer and the output compare units:<br /><br />TCCR1B = _BV(ICNC1)// noise canceler, trigger on negative edge<br />              | _BV(CS11);// clock source clk/8<br />TIMSK   = _BV(OCIE1A)// output compare 1A match interrupt enable<br />              | _BV(TICIE1);// input capture 1 interrupt enable<br /><br />Does the USB stack use a Timer or something else which could interfere with my settings?<br /><br />Any other idea, what I could check? As I said, I can use a AVR dragon for debugging.<br /><br />Many thanks!<br />Stefan<p>Statistics: Posted by Guest — Thu Jan 24, 2008 12:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2008-01-16T13:34:37+02:00</updated>

		<published>2008-01-16T13:34:37+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3902#p3902</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3902#p3902"/>
		<title type="html"><![CDATA[AVR-USB on ATmega 162]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3902#p3902"><![CDATA[
OK, then this MUST be a problem with the interrupt routine. There are two possible causes: Either you enable an interrupt and define a service routine for another interrupt so that it jumps into nirvana when the interrupt occurs, or the interrupt rate is way too high and uses up all CPU time.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Wed Jan 16, 2008 1:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2008-01-15T18:06:22+02:00</updated>

		<published>2008-01-15T18:06:22+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3895#p3895</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3895#p3895"/>
		<title type="html"><![CDATA[AVR-USB on ATmega 162]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3895#p3895"><![CDATA[
<blockquote class="uncited"><div>Other than that: Did you make sure that D+ triggers an interrupt and that the interrupt line is an input with internal pull-up disabled? And did you ensure that your D+ and D- pins are configured as inputs without internal pull-up? <br /><br />Then there are the obvious things like fuse values, system clock divider etc. to make sure that the AVR runs on the desired crystal clock.</div></blockquote><br /><br />This is all ok, because USB is working fine if I do not set the interrupt enable bit with<br /><br />TIMSK = _BV(OCIE1A);<br /><br />USB does not work only if this bit is set.<br /><br />I have now checked the behavior on an ATmega8, it is all the same.<br /><br />Everything is working on the ATtiny2313, it fails only on the ATmega162 /8.<br /><br />I have ordered an AVR Dragon for debuging. I hope that I will get it tomorrow.<p>Statistics: Posted by Guest — Tue Jan 15, 2008 6:06 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2008-01-14T15:30:21+02:00</updated>

		<published>2008-01-14T15:30:21+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3886#p3886</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3886#p3886"/>
		<title type="html"><![CDATA[AVR-USB on ATmega 162]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3886#p3886"><![CDATA[
It's not sufficient to put your own sei() into the interrupt handler, you must declare it with __attribute__ ((interrupt)) so that gcc emits an sei() as the first instruction.<br /><br />Other than that: Did you make sure that D+ triggers an interrupt and that the interrupt line is an input with internal pull-up disabled? And did you ensure that your D+ and D- pins are configured as inputs without internal pull-up?<br /><br />Then there are the obvious things like fuse values, system clock divider etc. to make sure that the AVR runs on the desired crystal clock.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Mon Jan 14, 2008 3:30 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2008-01-14T11:36:45+02:00</updated>

		<published>2008-01-14T11:36:45+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3882#p3882</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3882#p3882"/>
		<title type="html"><![CDATA[AVR-USB on ATmega 162]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3882#p3882"><![CDATA[
Hi vobs, christian,<br /><br />I'm quite sure that I did not enable the UARTS. Anyway, I tried a different port for the USB wires (PA0, PA1), still no luck.<br /><br />sei(), which enables the global interrupts is first called in the main() function and then in the SIG_TIMER1_COMPA() interrupt handler.<br /><br />At the moment, only the sei() instruction is called in this interrupt handler.<p>Statistics: Posted by Guest — Mon Jan 14, 2008 11:36 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2008-01-14T11:36:14+02:00</updated>

		<published>2008-01-14T11:36:14+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3881#p3881</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3881#p3881"/>
		<title type="html"><![CDATA[AVR-USB on ATmega 162]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3881#p3881"><![CDATA[
Hi vobs, christian,<br /><br />I'm quite sure that I did not enable the UARTS. Anyway, I tried a different port for the USB wires (PA0, PA1), still no luck.<br /><br />sei(), which enables the global interrupts is first called in the main() function and then in the SIG_TIMER1_COMPA() interrupt handler.<br /><br />At the moment, only the sei() instruction is called in this interrupt handler.<p>Statistics: Posted by Guest — Mon Jan 14, 2008 11:36 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2008-01-13T19:14:33+02:00</updated>

		<published>2008-01-13T19:14:33+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3877#p3877</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3877#p3877"/>
		<title type="html"><![CDATA[AVR-USB on ATmega 162]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3877#p3877"><![CDATA[
Does the interrupt handler routine set the global interrupt enable flag as its first instruction? If not and the interrupt rate is high, this could interfere with the USB interrupt.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Sun Jan 13, 2008 7:14 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[vobs]]></name></author>
		<updated>2008-01-11T18:18:34+02:00</updated>

		<published>2008-01-11T18:18:34+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3861#p3861</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3861#p3861"/>
		<title type="html"><![CDATA[AVR-USB on ATmega 162]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3861#p3861"><![CDATA[
Stefan,<br /><blockquote><div><cite>Stefan wrote:</cite>I forgot to say what inputs I use for USB: PB2 USB-, PB3 for USB+</div></blockquote><br />are you sure, that you do not enable the 2nd UART's transmitter or receiver unit? As these use PB2 and PB3, this might be the true reason for your problem. I use AVR-USB on a Mega162 and it works fine, even when timer2 overflow interrupt is enabled.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=339">vobs</a> — Fri Jan 11, 2008 6:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2008-01-11T12:56:30+02:00</updated>

		<published>2008-01-11T12:56:30+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3856#p3856</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3856#p3856"/>
		<title type="html"><![CDATA[AVR-USB on ATmega 162]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1117&amp;p=3856#p3856"><![CDATA[
I forgot to say what inputs I use for USB: PB2 USB-, PB3 for USB+<p>Statistics: Posted by Guest — Fri Jan 11, 2008 12:56 pm</p><hr />
]]></content>
	</entry>
	</feed>
