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

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2008-12-05T21:40:31+02:00</updated>

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

		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2008-12-05T21:40:31+02:00</updated>

		<published>2008-12-05T21:40:31+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1953&amp;p=6820#p6820</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1953&amp;p=6820#p6820"/>
		<title type="html"><![CDATA[Free Running Mode possible?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1953&amp;p=6820#p6820"><![CDATA[
If you enable the interrupt, you must supply an implementation for the vector. Otherwise the reset vector is called.<br /><br />Where in your code do you read the ADC data? If you don't need the accuracy of an interrupt, you may poll for it instead. Leave ADIE zero and check for ADIF regularly. If it is set, write a &quot;1&quot; to it and read the ADC value.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Fri Dec 05, 2008 9:40 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[psc]]></name></author>
		<updated>2008-12-05T21:23:18+02:00</updated>

		<published>2008-12-05T21:23:18+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1953&amp;p=6819#p6819</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1953&amp;p=6819#p6819"/>
		<title type="html"><![CDATA[Free Running Mode possible?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1953&amp;p=6819#p6819"><![CDATA[
it's true, i am new to avr so it might be my code  <img class="smilies" src="./../../../images/smilies/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes" /><br /><br />//sbi(ADCSRA, ADIE); //Enable ADC conversion complete interrupt<br />working ([ 2732.974342] usb 3-1: configuration #1 chosen from 1 choice)<br /><br />sbi(ADCSRA, ADIE); //Enable ADC conversion complete interrupt<br />not working ([ 2720.042034] usb 3-1: device not accepting address 12, error -71)<br /><br /><div class="codebox"><p>Code: </p><pre><code>#include &lt;avr/io.h&gt;<br />#include &lt;avr/interrupt.h&gt;<br />#include &lt;avr/pgmspace.h&gt;<br />#include &lt;avr/wdt.h&gt;<br />#include &quot;usbdrv.h&quot;<br /><br />#ifndef BV<br />   #define BV&#40;bit&#41;         &#40;1&lt;&lt;&#40;bit&#41;&#41;<br />#endif<br />#ifndef cbi<br />   #define cbi&#40;reg,bit&#41;   reg &amp;= ~&#40;BV&#40;bit&#41;&#41;<br />#endif<br />#ifndef sbi<br />   #define sbi&#40;reg,bit&#41;   reg |= &#40;BV&#40;bit&#41;&#41;<br />#endif<br /><br />#define ADC_PRESCALE_DIV64      0x06   ///&lt; 0x06 -&gt; CPU clk/64<br />#define ADC_PRESCALE         ADC_PRESCALE_DIV64<br />#define ADC_PRESCALE_MASK      0x07<br />#define ADC_MUX_MASK         0x1F<br /><br />void adcfrm&#40;void&#41;<br />&#123;<br />   DDRA    = 0x00; // set all pins to input<br />   PORTA    = 0x00; // make sure pull-up resistors are turned off<br />   sbi&#40;ADCSRA, ADEN&#41;; //Enable the ADC<br />   sbi&#40;ADCSRA, ADATE&#41;; //Enable free-running mode<br />   ADCSRA = &#40;&#40;ADCSRA &amp; ~ADC_PRESCALE_MASK&#41; | ADC_PRESCALE_DIV64&#41;;<br />   SFIOR &amp;= 0x1F;<br />   sbi&#40;ADMUX,REFS0&#41;;cbi&#40;ADMUX,REFS1&#41;;<br />   ADMUX = 0; //Initial channel selection<br />   sbi&#40;ADCSRA, ADIE&#41;; //Enable ADC conversion complete interrupt<br />   sbi&#40;ADCSRA, ADSC&#41;; //Start first conversion in Free-running mode<br />   sei&#40;&#41;; //Enable global interrupts<br />   //Now the conversions are running<br />&#125;<br /><br />void initCoreHardware&#40;void&#41;<br />&#123;<br />   // --------------------- Init USB<br />   DDRD = 0xe0;<br />   PORTD = 0x70;<br />   usbDeviceConnect&#40;&#41;;<br />   wdt_enable&#40;WDTO_1S&#41;;<br />   usbReset&#40;&#41;;<br />    usbInit&#40;&#41;;<br />   cbi&#40;MCUCR, ISC11&#41;;<br />   sbi&#40;MCUCR, ISC10&#41;;<br />   set_sleep_mode&#40;SLEEP_MODE_PWR_DOWN&#41;;<br />   TCCR1B = 3;<br />   TCNT1 = 0;<br />   sbi&#40;TIFR, TOV1&#41;;<br />   sei&#40;&#41;;<br />&#125;<br /><br />int main&#40;void&#41;<br />&#123;<br />   initCoreHardware&#40;&#41;;<br />   adcfrm&#40;&#41;;<br />   while&#40;1&#41; &#123;<br />      wdt_reset&#40;&#41;;<br />      usbPoll&#40;&#41;;   <br />   &#125;<br />   return 0;<br />&#125;<br /></code></pre></div><br /><br />i found another post in this forum saying that a low priority interrupt:<br />#define UTIL_INTERRUPT(signame)                         \<br />    void signame (void) __attribute__ ((interrupt));    \<br />    void signame (void) <br /><br />UTIL_INTERRUPT(XXX_vect)<br />{<br />    ... interrupt implementation<br />} <br /><br />not sure if it would be necessary in my case?<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1494">psc</a> — Fri Dec 05, 2008 9:23 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2008-12-05T20:21:21+02:00</updated>

		<published>2008-12-05T20:21:21+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1953&amp;p=6818#p6818</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1953&amp;p=6818#p6818"/>
		<title type="html"><![CDATA[Free Running Mode possible?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1953&amp;p=6818#p6818"><![CDATA[
There's nothing special with AVR-USB and free running mode of the ADC. It looks as if your code crashes, maybe because you enabled an interrupt which has no vector assigned or the vector is called recursively.<br /><br />If you need an interrupt for the ADC, you must make sure it enables global interrupts within several cycles after interrupt start AND that it does not trigger again after enabling the interrupts.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Fri Dec 05, 2008 8:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[psc]]></name></author>
		<updated>2008-12-05T09:35:29+02:00</updated>

		<published>2008-12-05T09:35:29+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1953&amp;p=6810#p6810</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1953&amp;p=6810#p6810"/>
		<title type="html"><![CDATA[Free Running Mode possible?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1953&amp;p=6810#p6810"><![CDATA[
hi all,<br /><br />from the datasheet (in my case atmega16):<br /><br />Using the ADC Interrupt Flag as a trigger source makes the ADC start a new conversion as soon as the ongoing conversion has finished. The ADC then operates in Free Running mode, constantly sampling and updating the ADC Data Register. The first conversion must be started by writing a logical one to the ADSC bit in ADCSRA. In this mode the ADC will perform successive conversions independently of whether the ADC Interrupt Flag, ADIF is cleared or not.<br /><br />turning this feature &quot;on&quot; i get this error in linux when connecting my device:<br />[ 1173.796651] usb 4-1: new low speed USB device using uhci_hcd and address 44<br />[ 1173.850848] usb 4-1: device descriptor read/64, error -71<br /><br />is it possible to make it work with obdev-usb?<br />pat<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1494">psc</a> — Fri Dec 05, 2008 9:35 am</p><hr />
]]></content>
	</entry>
	</feed>
