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

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2011-07-01T15:16:33+02:00</updated>

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

		<entry>
		<author><name><![CDATA[CaCO3]]></name></author>
		<updated>2011-07-01T15:16:33+02:00</updated>

		<published>2011-07-01T15:16:33+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3996&amp;p=18850#p18850</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3996&amp;p=18850#p18850"/>
		<title type="html"><![CDATA[Re: SOLVED! &quot;device not recognized&quot;]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3996&amp;p=18850#p18850"><![CDATA[
All right, I got it working now.<br />As it was not a very obvious way, I documented it on my blog: <!-- m --><a class="postlink" href="http://www.ruinelli.ch/how-to-use-v-usb-on-an-attiny85">http://www.ruinelli.ch/how-to-use-v-usb-on-an-attiny85</a><!-- m --><br />There is also patched version for download.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=5393">CaCO3</a> — Fri Jul 01, 2011 3:16 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CaCO3]]></name></author>
		<updated>2011-07-01T01:34:00+02:00</updated>

		<published>2011-07-01T01:34:00+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3996&amp;p=18837#p18837</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3996&amp;p=18837#p18837"/>
		<title type="html"><![CDATA[Re: SOLVED! &quot;device not recognized&quot;]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3996&amp;p=18837#p18837"><![CDATA[
Sorry to open an old thread again.<br /><br />I am also looking to get the examples to work on an attiny85.<br />EasyLogger works fine, but none of the other examples.<br /><br />I tried to follow the suggestions in this tread, but never got it working.<br /><br />SO if one of you have a working example for a attiny, that would help me a lot.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=5393">CaCO3</a> — Fri Jul 01, 2011 1:34 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[vsovereign]]></name></author>
		<updated>2010-04-15T13:46:01+02:00</updated>

		<published>2010-04-15T13:46:01+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3996&amp;p=14117#p14117</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3996&amp;p=14117#p14117"/>
		<title type="html"><![CDATA[Re: &quot;device not recognized&quot;]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3996&amp;p=14117#p14117"><![CDATA[
I managed to communicate with the device as well as sending  and receiving bytes <img class="smilies" src="./../../../images/smilies/icon_smile.gif" alt=":-)" title="Smile" /><br /><br />The trick is to get rid of include &quot;osccal.h&quot; before you compile the hidtool.<br />And then add it again after you finish compiling <img class="smilies" src="./../../../images/smilies/icon_smile.gif" alt=":-)" title="Smile" /><br /><br />If anyone wanna know more, look at the <em class="text-italics">hid-data on attiny 45</em> post<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3326">vsovereign</a> — Thu Apr 15, 2010 1:46 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[vsovereign]]></name></author>
		<updated>2010-04-15T11:39:54+02:00</updated>

		<published>2010-04-15T11:39:54+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3996&amp;p=14115#p14115</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3996&amp;p=14115#p14115"/>
		<title type="html"><![CDATA[Re: &quot;device not recognized&quot;]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3996&amp;p=14115#p14115"><![CDATA[
<blockquote><div><cite>Osamu wrote:</cite>See usbconfig.h carefully. You have to define USB_CFG_HAVE_MEASURE_FRAME_LENGTH to 1 and include &quot;osccal.h&quot; here.</div></blockquote><br /><br />hi Osamu, I managed to connect the device to the host. <br />I put #include &quot;osccal.h&quot; in the usbconfig.h just like you showed.<br />the device is now recognized by the host.<br /><br />but now I have trouble trying to communicate with the device.<br />I built the host software according to the readme file with MinGW.<br /><br /><blockquote class="uncited"><div>BUILDING THE HOST SOFTWARE<br />==========================<br />Make sure that you have libusb (on Unix) or the DDK (on Windows) installed.<br />We recommend MinGW on Windows since it includes a free version of the DDK.<br />Then change to directory &quot;commandline&quot; and run &quot;make&quot; on Unix or<br />&quot;make -f Makefile.windows&quot; on Windows.</div></blockquote><br /><br /><br />but when I tried to create the makefile it says that in usbconfig.h the osccal.h file can't be found and failed.<br /><br />I tried this before when the device was still couldn't be connected and that time everything worked fine.<br /><br />any ideas how to test if any communication can be done between the device &amp; the host?<br /><br />thanks!<br />vsovereign<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3326">vsovereign</a> — Thu Apr 15, 2010 11:39 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[vsovereign]]></name></author>
		<updated>2010-04-08T15:15:17+02:00</updated>

		<published>2010-04-08T15:15:17+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3996&amp;p=14039#p14039</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3996&amp;p=14039#p14039"/>
		<title type="html"><![CDATA[Re: &quot;device not recognized&quot;]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3996&amp;p=14039#p14039"><![CDATA[
the above is written by me, lol!  <img class="smilies" src="./../../../images/smilies/icon_biggrin.gif" alt=":D" title="Very Happy" /> <br />didn't realize I was writing as a guest   <img class="smilies" src="./../../../images/smilies/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green" /><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3326">vsovereign</a> — Thu Apr 08, 2010 3:15 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2010-04-08T15:13:21+02:00</updated>

		<published>2010-04-08T15:13:21+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3996&amp;p=14038#p14038</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3996&amp;p=14038#p14038"/>
		<title type="html"><![CDATA[Re: &quot;device not recognized&quot;]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3996&amp;p=14038#p14038"><![CDATA[
<blockquote><div><cite>Osamu wrote:</cite>See usbconfig.h carefully. You have to define USB_CFG_HAVE_MEASURE_FRAME_LENGTH to 1 and include &quot;osccal.h&quot; here.</div></blockquote><br /><br /><strong class="text-strong">REALLY STRANGE! </strong> <img class="smilies" src="./../../../images/smilies/icon_question.gif" alt=":?:" title="Question" />  <img class="smilies" src="./../../../images/smilies/icon_question.gif" alt=":?:" title="Question" /> <br /><br />I did what you said and now the device is recognized by the host!<br />Whatever happened?<br /><br />I did not include osccal.h in the header folder.<br />There is nothing about calling osccal in the main program.<br />But now it seems to be working.<br /><br />Oh I need to check if it can read/write data with hid-tool &amp; hid-data commandline<br />I hope it's ok...<p>Statistics: Posted by Guest — Thu Apr 08, 2010 3:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2010-04-08T13:18:10+02:00</updated>

		<published>2010-04-08T13:18:10+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3996&amp;p=14032#p14032</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3996&amp;p=14032#p14032"/>
		<title type="html"><![CDATA[Re: &quot;device not recognized&quot;]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3996&amp;p=14032#p14032"><![CDATA[
See usbconfig.h carefully. You have to define USB_CFG_HAVE_MEASURE_FRAME_LENGTH to 1 and include &quot;osccal.h&quot; here.<p>Statistics: Posted by Guest — Thu Apr 08, 2010 1:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[vsovereign]]></name></author>
		<updated>2010-04-08T11:18:40+02:00</updated>

		<published>2010-04-08T11:18:40+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3996&amp;p=14027#p14027</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3996&amp;p=14027#p14027"/>
		<title type="html"><![CDATA[Re: &quot;device not recognized&quot;]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3996&amp;p=14027#p14027"><![CDATA[
hi, thanks for the answers.<br /><br />I tried to put the OSCCAL into the main.c of HID_DATA and then to call it in the main program (int_main(void))<br />It doesn't work so far. But I maight have call it the wrong way.<br /><br />The program below is how I put the OSCCAL into the main.c and how I call it in main.<br />Any ideas as to what might have gone wrong?<br /><br /><div class="codebox"><p>Code: </p><pre><code><br />/* -----------------------------------------------------------------------------*/<br />static void calibrateOscillator(void)<br />{<br />uchar       step = 128;<br />uchar       trialValue = 0, optimumValue;<br />int         x, optimumDev, targetValue = (unsigned)(1499 * (double)F_CPU / 10.5e6 + 0.5);<br /> <br />    /* do a binary search: */<br />    do{<br />        OSCCAL = trialValue + step;<br />        x = usbMeasureFrameLength();    // proportional to current real frequency<br />        if(x &lt; targetValue)             // frequency still too low<br />            trialValue += step;<br />        step &gt;&gt;= 1;<br />    }while(step &gt; 0);<br />    /* We have a precision of +/- 1 for optimum OSCCAL here */<br />    /* now do a neighborhood search for optimum value */<br />    optimumValue = trialValue;<br />    optimumDev = x; // this is certainly far away from optimum<br />    for(OSCCAL = trialValue - 1; OSCCAL &lt;= trialValue + 1; OSCCAL++){<br />        x = usbMeasureFrameLength() - targetValue;<br />        if(x &lt; 0)<br />            x = -x;<br />        if(x &lt; optimumDev){<br />            optimumDev = x;<br />            optimumValue = OSCCAL;<br />        }<br />    }<br />    OSCCAL = optimumValue;<br />}<br /> <br />/* ------------------------------------------------------------------------- */<br /><br />int main(void)<br />{<br />uchar   i;<br />uchar   calibrationValue;<br />    <br />   wdt_enable(WDTO_1S);<br />    <br /><br /><br />    calibrationValue = eeprom_read_byte(0); /* calibration value from last time */<br />    if(calibrationValue != 0xff){<br />        OSCCAL = calibrationValue;<br />    }<br />   <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 = 250;<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 />}<br /><br />/* ------------------------------------------------------------------------- */<br /><br /><br /></code></pre></div><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3326">vsovereign</a> — Thu Apr 08, 2010 11:18 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2010-03-14T01:42:07+02:00</updated>

		<published>2010-03-14T01:42:07+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3996&amp;p=13643#p13643</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3996&amp;p=13643#p13643"/>
		<title type="html"><![CDATA[Re: &quot;device not recognized&quot;]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3996&amp;p=13643#p13643"><![CDATA[
If you connect other low-speed device(e.g. mouse, keyboard..) under the same hub controller, its downstream packets are broadcasted to your ATtiny45. This causes RC calibration to fail. I haven't found a clear solution yet, but there is a workaround in my code. See lib-device/osccal.c in<br /><!-- m --><a class="postlink" href="http://www.recursion.jp/avrcdc/cdc232.2010-02-28.zip">http://www.recursion.jp/avrcdc/cdc232.2010-02-28.zip</a><!-- m --><p>Statistics: Posted by Guest — Sun Mar 14, 2010 1:42 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[maxi]]></name></author>
		<updated>2010-03-13T22:15:28+02:00</updated>

		<published>2010-03-13T22:15:28+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3996&amp;p=13642#p13642</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3996&amp;p=13642#p13642"/>
		<title type="html"><![CDATA[Re: &quot;device not recognized&quot;]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3996&amp;p=13642#p13642"><![CDATA[
At a guess i'd say the calibration is not being done correctly.  Take a closer look at usbconfig.h &amp; osccal.h<br /><div class="codebox"><p>Code: </p><pre><code>#if USB_CFG_CLOCK_KHZ==16500<br />#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH   1<br />#include &quot;osccal.h&quot;<br />#else<br />#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH   0<br />#endif<br />/* define this macro to 1 if you want the function usbMeasureFrameLength()<br /> * compiled in. This function can be used to calibrate the AVR's RC oscillator.<br /> */<br /></code></pre></div><div class="codebox"><p>Code: </p><pre><code>General Description:<br />This module contains a function which calibrates the AVR's internal RC<br />oscillator so that the CPU runs at F_CPU (F_CPU is a macro which must be<br />defined when the module is compiled, best passed in the compiler command<br />line). The time reference is the USB frame clock of 1 kHz available<br />immediately after a USB RESET condition. Timing is done by counting CPU<br />cycles, so all interrupts must be disabled while the calibration runs. For<br />low level timing measurements, usbMeasureFrameLength() is called. This<br />function must be enabled in usbconfig.h by defining<br />USB_CFG_HAVE_MEASURE_FRAME_LENGTH to 1. It is also recommended to call<br />calibrateOscillator() from the reset hook in usbconfig.h:<br />*/<br />#ifndef __ASSEMBLER__<br />#include &lt;avr/interrupt.h&gt;  /* for sei() */<br />extern void calibrateOscillator(void);<br />#define USB_RESET_HOOK(resetStarts)  if(!resetStarts){cli(); calibrateOscillator(); sei();}<br />/*<br />This routine is an alternative to the continuous synchronization described<br />in osctune.h.<br /></code></pre></div><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=2570">maxi</a> — Sat Mar 13, 2010 10:15 pm</p><hr />
]]></content>
	</entry>
	</feed>
