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

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2010-02-16T06:46:00+02:00</updated>

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

		<entry>
		<author><name><![CDATA[ulao]]></name></author>
		<updated>2010-02-16T06:46:00+02:00</updated>

		<published>2010-02-16T06:46:00+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3766&amp;p=13263#p13263</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3766&amp;p=13263#p13263"/>
		<title type="html"><![CDATA[Re: Error: Constant Value Required]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3766&amp;p=13263#p13263"><![CDATA[
glad to help.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1281">ulao</a> — Tue Feb 16, 2010 6:46 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[darvelo]]></name></author>
		<updated>2010-02-16T01:26:45+02:00</updated>

		<published>2010-02-16T01:26:45+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3766&amp;p=13259#p13259</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3766&amp;p=13259#p13259"/>
		<title type="html"><![CDATA[Re: Error: Constant Value Required]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3766&amp;p=13259#p13259"><![CDATA[
I got the 500mW zener diodes and that solved the whole problem.<br /><br />In the meantime I got an ATmega8 so I'm gonna use that for the SNES code for now, but if I have time I will definitely try porting over to the Mega88PA with your advice.<br /><br />Thanks, ulao.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3387">darvelo</a> — Tue Feb 16, 2010 1:26 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ulao]]></name></author>
		<updated>2010-01-18T05:10:18+02:00</updated>

		<published>2010-01-18T05:10:18+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3766&amp;p=12880#p12880</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3766&amp;p=12880#p12880"/>
		<title type="html"><![CDATA[Re: Error: Constant Value Required]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3766&amp;p=12880#p12880"><![CDATA[
Cant say for sure on that funky-nes.. but the diods will make for troubles..<br /><br />On that note.. Do your self a favor.. Scratch Ralf's code, if you have not already, to reset the device. Un solder his bridge from pd0 to pd1, and control the pull up with usv-v.. Ralf's did not have the latest when he designed it.<br /><br />Desolder pd1, and desolder the 1.5 pull up on the +5 end. Solder the 1.5 to pd1. and use this code.<br /><div class="codebox"><p>Code: </p><pre><code>static void usbReset(void)<br />{<br />    usbDeviceDisconnect();  /* enforce re-enumeration, do this while interrupts are disabled! */<br />   uchar i = 0;<br />    while(--i){                // USB disconnect for &gt;250ms<br />        _delay_ms(1);<br />    };<br />    usbDeviceConnect();<br />}</code></pre></div><br /><br />I dont use the timer registers so I take them out also.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1281">ulao</a> — Mon Jan 18, 2010 5:10 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[darvelo]]></name></author>
		<updated>2010-01-18T03:58:22+02:00</updated>

		<published>2010-01-18T03:58:22+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3766&amp;p=12879#p12879</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3766&amp;p=12879#p12879"/>
		<title type="html"><![CDATA[Re: Error: Constant Value Required]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3766&amp;p=12879#p12879"><![CDATA[
Thanks for the blinky code.  I had to replace that chip because I tried a different fuse set that broke it and I can't get it to work again without extra equipment.  I put in a new chip and tried a new, blank project with just your code and the blink works perfectly, so I put that code into the hid-data project to use it for debugging:<br /><br /><div class="codebox"><p>Code: </p><pre><code>static void blinkLed(int n_times)<br />{<br />if (n_times == 0 )  return;<br />char i;<br />DDRC |= 0x08;<br />   LED_OFF();<br />   while (n_times--)<br />   {<br />      LED_ON();<br />      for (i=0; i&lt;1; i++) _delay_ms(1000);<br />      LED_OFF();<br />      for (i=0; i&lt;1; i++) _delay_ms(1000);<br />   }   <br /><br />}<br /></code></pre></div><br /><br /><div class="codebox"><p>Code: </p><pre><code>int main(void)<br />{<br />uchar   i;<br />   <br />   DDRC |= 0x08;<br /><br />     blinkLed(5);   /* &lt;---------------------- it's blinking time */<br /><br />     wdt_enable(WDTO_1S);<br />    /* Even if you don't use the watchdog, turn it off here. On newer devices,<br />     * the status of the watchdog (on/off, period) is PRESERVED OVER RESET!<br />     */<br /> //   DBG1(0x00, 0, 0);       /* debug output: main starts */<br />    /* RESET status: all port bits are inputs without pull-up.<br />     * That's the way we need D+ and D-. Therefore we don't need any<br />     * additional hardware initialization.<br />     */<br />    odDebugInit();<br />    usbInit();<br />    usbDeviceDisconnect();  /* enforce re-enumeration, do this while interrupts are disabled! */<br />    i = 0;<br />    while(--i){             /* fake USB disconnect for &gt; 250 ms */<br />        wdt_reset();<br />        _delay_ms(1);<br />    }<br />    usbDeviceConnect();<br />    sei();<br /> //   DBG1(0x01, 0, 0);       /* debug output: main loop starts */<br />    for(;;){                /* main event loop */<br /> //       DBG1(0x02, 0, 0);   /* debug output: main loop iterates */<br />        wdt_reset();<br />        usbPoll();<br />     }<br />    return 0;<br />}</code></pre></div><br /><br />First I put the code right after DDRC to test if it would blink right.  Windows makes a &quot;USB Connected&quot; sound and the light blinks great, 1s per on, 1s per off 5 times and stays on forever (since I wire my LED backwards lol). Then Windows makes a &quot;USB Disconnected&quot; sound.<br /><br />I put the blink line anywhere after wdt_enable(WDTO_1S) and before usbDeviceConnect and this is what happens: blinks both on and off in the span of 1s forever.  Windows makes no sounds.<br /><br />I put the line right after usbDeviceConnect: Windows &quot;USB Connected&quot; sound, LED takes ~1.5 seconds to blink both on and off again (taking slightly longer to turn on), blinks like that forever.<br /><br />Line placed anywhere after sei(): LED goes very low intensity blinks on/off (can barely see it) in ~1.5s, Windows makes &quot;USB connected&quot; sound every 5 seconds.<br /><br />I'm not sure if these results are related to the zener diodes.. the only way I'll know for sure is when my order comes in and I replace the ones I have.  Different things happen depending on where I put the blink code.  I especially find it strange that the light would blink forever if it's not in a loop.. maybe the device is disconnecting and reconnecting constantly.  Placing the line after sei() seems to dis/reconnect the device.  I'll update the status once I put the diodes in, but if anything looks weird but fixable to you, please let me know.  Thank you for your help so far ulao, you're awesome!<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3387">darvelo</a> — Mon Jan 18, 2010 3:58 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ulao]]></name></author>
		<updated>2010-01-18T00:02:52+02:00</updated>

		<published>2010-01-18T00:02:52+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3766&amp;p=12878#p12878</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3766&amp;p=12878#p12878"/>
		<title type="html"><![CDATA[Re: Error: Constant Value Required]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3766&amp;p=12878#p12878"><![CDATA[
Well if you have 1w's in there that is a problem period. As far as the blinks go, it look good? Your fuse are correct.. Here is my blink code but I dont see why yours wont work. <br /><br /><br />I use the ground for the light not +5..<br /><div class="codebox"><p>Code: </p><pre><code><br />#define LED_OFF() do { PORTD |= 0x20; } while(0)<br />#define LED_ON() do { PORTD &amp;= ~0x20; } while(0)<br /><br /><br />static void blinkLed(int n_times)<br />{<br />if (n_times == 0 )  return;<br />char i;<br />DDRD |= 0x20;<br />   LED_OFF();<br />   while (n_times--)<br />   {<br />      LED_ON();<br />      for (i=0; i&lt;20; i++) _delay_ms(10);<br />      LED_OFF();<br />      for (i=0; i&lt;50; i++) _delay_ms(10);<br />   }   <br /><br />}<br /></code></pre></div><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1281">ulao</a> — Mon Jan 18, 2010 12:02 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[darvelo]]></name></author>
		<updated>2010-01-17T19:18:23+02:00</updated>

		<published>2010-01-17T19:18:23+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3766&amp;p=12869#p12869</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3766&amp;p=12869#p12869"/>
		<title type="html"><![CDATA[Re: Error: Constant Value Required]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3766&amp;p=12869#p12869"><![CDATA[
Thanks, I just ordered 500mW zener diodes since i was using 1W.  I hope this fixes it.  I was thinking that the problem could be with my 12MHz crystal or fuses because of what I describe below.  I put this code in the infinite for loop to blink an LED every second: <br /><br /><div class="codebox"><p>Code: </p><pre><code>    for(;;){                /* main event loop */<br /> //       DBG1(0x02, 0, 0);   /* debug output: main loop iterates */<br />        wdt_reset();<br />        usbPoll();<br />      if(led_on == 1) {<br />         PORTC &amp;= ~_BV(4);  // turn LED off<br />         led_on = 0;<br />         _delay_ms(1000);   // delay 1 second<br />      }else{<br />         PORTC |= _BV(4);   // turn LED on<br />         led_on = 1;<br />         _delay_ms(1000);<br />      }<br />    }<br />    return 0;</code></pre></div><br />and the LED blinks very erratically.  It looks like it blinks on for a second, then dims for about half a second, then full brightness for a second.  So I took out the V-USB code completely:<br /><div class="codebox"><p>Code: </p><pre><code>#define F_CPU 12000000L<br />#include &lt;avr/io.h&gt;<br />#include &lt;util/delay.h&gt;<br /><br />int main(void)<br />{<br />   int led_on = 0;<br />   DDRC = 0x08; // configure output on pin 3<br /><br />   while(1)<br />   {<br />      PORTC |= 0x08;  // output voltage on pin 3<br />      _delay_ms(1000);<br />      PORTC &amp;= ~0x08;  // clear voltage on pin 3<br />      _delay_ms(1000);<br />   }<br />    return 0;<br />}<br /></code></pre></div><br />and the LED stays on forever.  Does this sound like a problem with my 12MHz crystal or fuses?  I placed it exactly like in the V-USB diagram on pins 9 and 10 with a 20pF cap like the datasheet asked for with fuses E: 0xF9, H: 0xDD, L: 0xDF.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3387">darvelo</a> — Sun Jan 17, 2010 7:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ulao]]></name></author>
		<updated>2010-01-17T06:31:58+02:00</updated>

		<published>2010-01-17T06:31:58+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3766&amp;p=12857#p12857</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3766&amp;p=12857#p12857"/>
		<title type="html"><![CDATA[Re: Error: Constant Value Required]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3766&amp;p=12857#p12857"><![CDATA[
I ported his code over to an 168 same as your chip for the most part, but not the P... That may be the issue..<br /><br />I had some struggles but was able to make it work. <strong class="text-strong">Make sure you do not use 1 watt diods</strong>.. They will not work, use 1/2. This goes for all 88/168 chips.<br /><br /><blockquote class="uncited"><div>Well, I used the latest source files from the V-USB download area and the problem went away.</div></blockquote> Ralphs code had some older files, I had this issue also. And I had to define USBATTR_BUSPOWER as well.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1281">ulao</a> — Sun Jan 17, 2010 6:31 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[darvelo]]></name></author>
		<updated>2010-01-14T04:48:10+02:00</updated>

		<published>2010-01-14T04:48:10+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3766&amp;p=12822#p12822</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3766&amp;p=12822#p12822"/>
		<title type="html"><![CDATA[Re: Error: Constant Value Required]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3766&amp;p=12822#p12822"><![CDATA[
Well, I used the latest source files from the V-USB download area and the problem went away.  I had to hardcode &quot;#define USBATTR_BUSPOWER        0x80&quot; since there was an error with the definition missing and the original source code needed it.<br /><br />The code compiles, but the USB device is not recognized, and is listed under Windows Device Manager as &quot;Unknown Device.&quot;  Is there any way I can debug this?<br /><br /><strong class="text-strong"><span style="text-decoration: underline">UPDATE</span>:</strong>  I found that the &quot;Unknown Device&quot; was actually my AVR programmer plugged into the ISP header.  When I take it out and unplug and reinsert the USB connector from the board, nothing happens.  No audio notification from Windows that a device has been connected, and no visual indicators either.  What could be wrong?  I'm using the bare hid-data project from the examples folder and an ATmega88PA.  Please help.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3387">darvelo</a> — Thu Jan 14, 2010 4:48 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[darvelo]]></name></author>
		<updated>2010-01-14T02:17:41+02:00</updated>

		<published>2010-01-14T02:17:41+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3766&amp;p=12820#p12820</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3766&amp;p=12820#p12820"/>
		<title type="html"><![CDATA[Error: Constant Value Required]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3766&amp;p=12820#p12820"><![CDATA[
Hey all,<br /><br />I'm trying to compile a project from <a href="http://www.raphnet.net/electronique/snes_nes_usb/index_en.php" class="postlink">http://www.raphnet.net/electronique/snes_nes_usb/index_en.php</a>, which was originally designed for the ATmega8, over to the chip ATmega88PA.<br /><br />I've ported over all the registers, bits, and fuses according to <a href="http://www.atmel.com/dyn/resources/prod_documents/doc2553.pdf" class="postlink">http://www.atmel.com/dyn/resources/prod_documents/doc2553.pdf</a> and I read on this thread: <a href="http://forums.obdev.at/viewtopic.php?f=8&amp;t=2663" class="postlink">http://forums.obdev.at/viewtopic.php?f=8&amp;t=2663</a> that there was an issue with the definition of an interrupt, which I changed to the proper &quot;INT0_vect&quot; value in usbdrvasm.S.<br /><br />Now, when I compile the project, the compiler AVR Studio/avr-gcc gives me a ton of the same error in file usbdrvasm12.S, which is &quot;Constant value required&quot;.<br /><br />I'm using an ATmega88PA with a 12Mhz crystal.  F_CPU is set to 12000000L.  Any help would be appreciated much.  Thanks!<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3387">darvelo</a> — Thu Jan 14, 2010 2:17 am</p><hr />
]]></content>
	</entry>
	</feed>
