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

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2012-09-17T07:40:58+02:00</updated>

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

		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2012-09-17T07:40:58+02:00</updated>

		<published>2012-09-17T07:40:58+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6749&amp;p=22682#p22682</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6749&amp;p=22682#p22682"/>
		<title type="html"><![CDATA[Re: Interrupt driven Adc and vusb in atmega8]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6749&amp;p=22682#p22682"><![CDATA[
Could you post a link to the post that answered your question?<p>Statistics: Posted by Guest — Mon Sep 17, 2012 7:40 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Madara]]></name></author>
		<updated>2012-06-29T18:11:43+02:00</updated>

		<published>2012-06-29T18:11:43+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6749&amp;p=21918#p21918</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6749&amp;p=21918#p21918"/>
		<title type="html"><![CDATA[Re: Interrupt driven Adc and vusb in atmega8]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6749&amp;p=21918#p21918"><![CDATA[
Found soln in other posts of the forum.....thanx to vusb team<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=6952">Madara</a> — Fri Jun 29, 2012 6:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Madara]]></name></author>
		<updated>2012-06-29T18:11:04+02:00</updated>

		<published>2012-06-29T18:11:04+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6749&amp;p=21917#p21917</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6749&amp;p=21917#p21917"/>
		<title type="html"><![CDATA[Re: Interrupt driven Adc and vusb in atmega8]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6749&amp;p=21917#p21917"><![CDATA[
<blockquote><div><cite>Madara wrote:</cite>I am trying to make usb based oscilloscope.USB startups and data transfers work well.However on starting adc channel it throws an usb error &quot;-5&quot;.<br /><br />and the code works sometimes too..<br />The code is:<br /><br />#include &lt;avr/io.h&gt;<br />#include &lt;avr/interrupt.h&gt;<br />#include &lt;util/delay.h&gt;<br />#include &lt;avr/wdt.h&gt;<br />#include &lt;avr/pgmspace.h&gt;<br />#include &quot;usbdrv.h&quot;<br />#include &quot;oddebug.h&quot;<br /><br /><br />#define START_ADC  0<br />#define STOP_ADC  1<br />#define READ_VAL 2<br /><br />static int8_t j=0,k;<br />static uchar replyBuf[128];<br /><br />USB_PUBLIC uchar usbFunctionSetup(uchar data[8]) {<br />       usbRequest_t *rq = (void *)data; // cast data to correct type<br /><br />    switch(rq-&gt;bRequest) { <br />    <br />case START_ADC:<br />ADCSRA|=((1&lt;&lt;ADEN)|(1&lt;&lt;6));<br />return 0;<br />case STOP_ADC: <br />        ADCSRA&amp;=(0&lt;&lt;ADEN);<br />        return 0;<br />case READ_VAL:<br />usbMsgPtr=replyBuf;<br />k=j;<br />j=0;<br />return k;<br />}<br /><br />    return 0; <br />}<br /><br />int __attribute__((noreturn)) main(void) {<br />    uchar i;<br /><br />wdt_enable(WDTO_1S); // enable 1s watchdog timer<br /><br />odDebugInit();<br />    DBG1(0x00, 0, 0);<br />    <br />usbInit();<br />    usbDeviceDisconnect(); // enforce re-enumeration<br />    <br />i=0;<br />    while(--i){             /* fake USB disconnect for &gt; 250 ms */<br />        wdt_reset();<br />        _delay_ms(1);<br />    }<br />    <br />usbDeviceConnect();<br />    sei(); // Enable interrupts after re-enumeration<br />     <br /> DBG1(0x01, 0, 0);<br /> ADCSRA=0x2f;<br />ADMUX=0x40;<br />    <br />while(1) {<br />        DBG1(0x02, 0, 0);<br />wdt_reset(); <br />        usbPoll();<br />    }<br />}<br /><br />ISR(ADC_vect,ISR_NOBLOCK)<br />{<br />replyBuf[j]=ADCL;<br />replyBuf[++j]=ADCH;<br />j++;<br />}<br /><br /><br />Please help...... I am using 16Mhz crystall.</div></blockquote><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=6952">Madara</a> — Fri Jun 29, 2012 6:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Madara]]></name></author>
		<updated>2012-06-29T13:45:41+02:00</updated>

		<published>2012-06-29T13:45:41+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6749&amp;p=21915#p21915</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6749&amp;p=21915#p21915"/>
		<title type="html"><![CDATA[Interrupt driven Adc and vusb in atmega8]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6749&amp;p=21915#p21915"><![CDATA[
I am trying to make usb based oscilloscope.USB startups and data transfers work well.However on starting adc channel it throws an usb error &quot;-5&quot;.<br /><br />and the code works sometimes too..<br />The code is:<br /><br />#include &lt;avr/io.h&gt;<br />#include &lt;avr/interrupt.h&gt;<br />#include &lt;util/delay.h&gt;<br />#include &lt;avr/wdt.h&gt;<br />#include &lt;avr/pgmspace.h&gt;<br />#include &quot;usbdrv.h&quot;<br />#include &quot;oddebug.h&quot;<br /><br /><br />#define START_ADC  0<br />#define STOP_ADC  1<br />#define READ_VAL 2<br /><br />static int8_t j=0,k;<br />static uchar replyBuf[128];<br /><br />USB_PUBLIC uchar usbFunctionSetup(uchar data[8]) {<br />       usbRequest_t *rq = (void *)data; // cast data to correct type<br /><br />    switch(rq-&gt;bRequest) { <br />    <br />case START_ADC:<br />ADCSRA|=((1&lt;&lt;ADEN)|(1&lt;&lt;6));<br />return 0;<br />case STOP_ADC: <br />        ADCSRA&amp;=(0&lt;&lt;ADEN);<br />        return 0;<br />case READ_VAL:<br />usbMsgPtr=replyBuf;<br />k=j;<br />j=0;<br />return k;<br />}<br /><br />    return 0; <br />}<br /><br />int __attribute__((noreturn)) main(void) {<br />    uchar i;<br /><br />wdt_enable(WDTO_1S); // enable 1s watchdog timer<br /><br />odDebugInit();<br />    DBG1(0x00, 0, 0);<br />    <br />usbInit();<br />    usbDeviceDisconnect(); // enforce re-enumeration<br />    <br />i=0;<br />    while(--i){             /* fake USB disconnect for &gt; 250 ms */<br />        wdt_reset();<br />        _delay_ms(1);<br />    }<br />    <br />usbDeviceConnect();<br />    sei(); // Enable interrupts after re-enumeration<br />     <br /> DBG1(0x01, 0, 0);<br /> ADCSRA=0x2f;<br />ADMUX=0x40;<br />    <br />while(1) {<br />        DBG1(0x02, 0, 0);<br />wdt_reset(); <br />        usbPoll();<br />    }<br />}<br /><br />ISR(ADC_vect,ISR_NOBLOCK)<br />{<br />replyBuf[j]=ADCL;<br />replyBuf[++j]=ADCH;<br />j++;<br />}<br /><br /><br />Please help...... I am using 16Mhz crystall.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=6952">Madara</a> — Fri Jun 29, 2012 1:45 pm</p><hr />
]]></content>
	</entry>
	</feed>
