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

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

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

		<entry>
		<author><name><![CDATA[vsovereign]]></name></author>
		<updated>2010-04-15T13:46:32+02:00</updated>

		<published>2010-04-15T13:46:32+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3065&amp;p=14118#p14118</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3065&amp;p=14118#p14118"/>
		<title type="html"><![CDATA[Re: hid-data on tiny45]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3065&amp;p=14118#p14118"><![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" /><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-14T23:00:28+02:00</updated>

		<published>2010-04-14T23:00:28+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3065&amp;p=14103#p14103</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3065&amp;p=14103#p14103"/>
		<title type="html"><![CDATA[Re: hid-data on tiny45]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3065&amp;p=14103#p14103"><![CDATA[
hi Maxi, 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 buuilt the host software according to the readme file <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.<br /></div></blockquote><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!<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3326">vsovereign</a> — Wed Apr 14, 2010 11:00 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[maxi]]></name></author>
		<updated>2010-04-08T21:12:25+02:00</updated>

		<published>2010-04-08T21:12:25+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3065&amp;p=14045#p14045</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3065&amp;p=14045#p14045"/>
		<title type="html"><![CDATA[Re: hid-data on tiny45]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3065&amp;p=14045#p14045"><![CDATA[
Hi, for OSCCAL all you really need to do is modify usbconfig.h something like this, in the relevant section.<br /><div class="codebox"><p>Code: </p><pre><code> */<br />#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><br />Read osccal.h for more information where you will need to 'un-comment' this section:<br /><div class="codebox"><p>Code: </p><pre><code>#ifndef __ASSEMBLER__<br />#include &lt;avr/interrupt.h&gt;  // for sei()<br />extern void calibrateOscillator(void);<br />#endif<br />#define USB_RESET_HOOK(resetStarts)  if(!resetStarts){cli(); calibrateOscillator(); sei();}<br /></code></pre></div><br />All the necessary code is in osccal.c so no need to copy it into your main program. You will ofcourse need to add the path to libs-device to your project's makefile.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=2570">maxi</a> — Thu Apr 08, 2010 9:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[vsovereign]]></name></author>
		<updated>2010-04-08T11:13:17+02:00</updated>

		<published>2010-04-08T11:13:17+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3065&amp;p=14026#p14026</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3065&amp;p=14026#p14026"/>
		<title type="html"><![CDATA[Re: hid-data on tiny45]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3065&amp;p=14026#p14026"><![CDATA[
<blockquote><div><cite>maxi wrote:</cite><blockquote><div><cite>vsovereign wrote:</cite>what did you change when you adapted easylogger to hid-data example?</div></blockquote><br /><br />So just get a fresh copy of the hid-data example, edit the makefile (DEVICE, FUSE_L &amp; FUSE_H), edit usbconfig.h (port/pin configs)<br />Add OSCCAL from libs-device and that should be about all there is to it.</div></blockquote><br /><br />Hey Maxi, I tried to add OSCCAL and call it from the main function of HID_DATA.<br />So far it doesn't work. But I might have call OSCCAL the wrong way. <br /><br />This is the OSCCAL as I put it into the main program and in the main program is how I call it, what do you think?<br /><br /><div class="codebox"><p>Code: </p><pre><code><br /><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 /></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:13 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[maxi]]></name></author>
		<updated>2010-03-13T21:51:04+02:00</updated>

		<published>2010-03-13T21:51:04+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3065&amp;p=13641#p13641</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3065&amp;p=13641#p13641"/>
		<title type="html"><![CDATA[Re: hid-data on tiny45]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3065&amp;p=13641#p13641"><![CDATA[
<blockquote><div><cite>vsovereign wrote:</cite>what did you change when you adapted easylogger to hid-data example?</div></blockquote><br /><br />Sorry, that was a while back and I no longer have the code but IIRC very little change was required. Really more a matter of adapting the hid-data exampe for ATtiny45 not really anything to do with easylogger other than copying the pin configs etc. <br /><br />So just get a fresh copy of the hid-data example, edit the makefile (DEVICE, FUSE_L &amp; FUSE_H), edit usbconfig.h (port/pin configs)<br />Add OSCCAL from libs-device and that should be about all there is to it.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=2570">maxi</a> — Sat Mar 13, 2010 9:51 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[vsovereign]]></name></author>
		<updated>2010-03-11T00:04:04+02:00</updated>

		<published>2010-03-11T00:04:04+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3065&amp;p=13609#p13609</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3065&amp;p=13609#p13609"/>
		<title type="html"><![CDATA[Re: hid-data on tiny45]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3065&amp;p=13609#p13609"><![CDATA[
<blockquote><div><cite>maxi wrote:</cite>Just to confirm I have successfully had both of those examples running on my ATtiny45 so it certainly can be done.<br /><br />I have no idea what could be causing your particular problem but i'd guess that its something minor that you have simply overlooked.<br />Perhaps when you post your sources someone will spot it.</div></blockquote><br /><br />Hi Maxi, what did you change when you adapted easylogger to hid-data example?<br />Because I have the same problem: easylogger works, but hid-data example based on easylogger doesn't work.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3326">vsovereign</a> — Thu Mar 11, 2010 12:04 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[maxi]]></name></author>
		<updated>2009-07-30T00:03:56+02:00</updated>

		<published>2009-07-30T00:03:56+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3065&amp;p=10325#p10325</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3065&amp;p=10325#p10325"/>
		<title type="html"><![CDATA[Re: hid-data on tiny45]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3065&amp;p=10325#p10325"><![CDATA[
Just to confirm I have successfully had both of those examples running on my ATtiny45 so it certainly can be done.<br /><br />I have no idea what could be causing your particular problem but i'd guess that its something minor that you have simply overlooked.<br />Perhaps when you post your sources someone will spot it.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=2570">maxi</a> — Thu Jul 30, 2009 12:03 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2009-07-29T23:15:19+02:00</updated>

		<published>2009-07-29T23:15:19+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3065&amp;p=10324#p10324</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3065&amp;p=10324#p10324"/>
		<title type="html"><![CDATA[hid-data on tiny45]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3065&amp;p=10324#p10324"><![CDATA[
Hi there,<br /><br />I've tried to get the hid-data example on a tiny45. I used some parts of the Easylogger project to adopt it to the tiny, also the OSC-Calibration.<br />The device is recognized properly, I can see it in the device manager - also bushound sees the device with correct descriptor and definitions<br />BUT: It's not possible to exchange data with the device. Also when I replace the EEProm-Access with dummy values it doesn't work.<br /><br />Now, to see if the host software is compiled correctly, I ported the source to the atmega8 - where it works like a charm.<br /><br />Does anybody know if there's a incompatibility between hid-data and the tiny45 or has someone ported that example successfully to the tiny45?<br />I don't have access to my source right now - I can upload it by tomorrow.<br /><br />best wishes,<br /><br />chris<p>Statistics: Posted by Guest — Wed Jul 29, 2009 11:15 pm</p><hr />
]]></content>
	</entry>
	</feed>
