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

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2012-02-03T06:36:55+02:00</updated>

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

		<entry>
		<author><name><![CDATA[ulao]]></name></author>
		<updated>2012-02-03T06:36:55+02:00</updated>

		<published>2012-02-03T06:36:55+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20868#p20868</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20868#p20868"/>
		<title type="html"><![CDATA[Re: reset device via bootloader?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20868#p20868"><![CDATA[
Hi John, as addressed that is not what the topic is about and as I said I already use the WD method for device resets. This topic is about how to reset the device externally. That is to say how can one communicate with the device to reset it or call a reset function from the OS. The proposed solution is using an out interrupt and looking for a report ID. Though the flash tool does it without looking for a report id, so I wonder how it does this?<br /><br />Off topic . Since there is so much talk on WD timers I better chime in encase someone searches for this. First off this trick will not work as suggested with a boot loader. You must tell it where to jump. There are a few ways to do this but below I find is the best,<br /><br />// this is assuming you have a atmega328<br /><br /><div class="codebox"><p>Code: </p><pre><code>void reboot() <br />{<br />   wdt_disable();<br />   cli(); <br />   typedef void (*f_ptr_t)(void);<br />   f_ptr_t boot_entry = (f_ptr_t) 0x7800; //adjust this to fit your needs. <br />   boot_entry(); <br />}<br /></code></pre></div><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1281">ulao</a> — Fri Feb 03, 2012 6:36 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[jcassidento_atmel]]></name></author>
		<updated>2012-02-02T18:54:49+02:00</updated>

		<published>2012-02-02T18:54:49+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20861#p20861</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20861#p20861"/>
		<title type="html"><![CDATA[Re: reset device via bootloader?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20861#p20861"><![CDATA[
Micha suggested &quot;E.g. you could enable the watchdog and let the device run into a while(1)/for(;;)&quot;<br /><br />I have used this method for other cases of transitioning between application and bootloader, and it works fine.  It is actually particularly good since the WDT reset is a hard reset, and will result in all the registers being at their default so you don't have to worry about any artifacts from previous code in case the bootloader code makes any assumptions.  Just set the WDT timeout as short as possible, and spin in a delay loop for a little longer than this.  This might be better for debugging than an infinite while in case you don't set the WDT correctly since it will eventually time out instead of spinning forever.<br /><br />   - john<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=6339">jcassidento_atmel</a> — Thu Feb 02, 2012 6:54 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ulao]]></name></author>
		<updated>2012-02-02T06:14:03+02:00</updated>

		<published>2012-02-02T06:14:03+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20848#p20848</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20848#p20848"/>
		<title type="html"><![CDATA[Re: reset device via bootloader?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20848#p20848"><![CDATA[
I definitely follow you here. I guess if I developed an app to communicate with my usb descriptor I could simply send a report id to indicate this. I would not really need the bootloader for that at all, this could be done in my normal code area.  I already have an out interrupt for my FFB that has plenty of unused report I could hijack. I guess the thing that got me wondering is my flash tool ( HIDBootFlash) somehow does this already.<br /><!-- m --><a class="postlink" href="http://vusb.wikidot.com/project:hidbootflash">http://vusb.wikidot.com/project:hidbootflash</a><!-- m --><br />Unfortunately its not open source --<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1281">ulao</a> — Thu Feb 02, 2012 6:14 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2012-02-01T08:56:45+02:00</updated>

		<published>2012-02-01T08:56:45+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20844#p20844</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20844#p20844"/>
		<title type="html"><![CDATA[Re: reset device via bootloader?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20844#p20844"><![CDATA[
You have to add some code to the firmware, it's impossible to do this only with OS functionality. As you don't want to edit the firmware it is not possible.<br /><div class="codebox"><p>Code: </p><pre><code>    if(rq-&gt;bRequest == USBRQ_HID_SET_REPORT){<br />        if(rq-&gt;wValue.bytes&#91;0&#93; == 2){<br />            offset = 0;<br />            return USB_NO_MSG;<br />        }<br />#if BOOTLOADER_CAN_EXIT<br />        else{<br />            exitMainloop = 1;<br />        }<br />#endif<br /></code></pre></div><br />If there's a message with a report ID != 2 it will exit. But with this code you can also do a watchdog reset not only a restart. So we're back at my first answer again.<p>Statistics: Posted by Guest — Wed Feb 01, 2012 8:56 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ulao]]></name></author>
		<updated>2012-02-01T02:50:10+02:00</updated>

		<published>2012-02-01T02:50:10+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20843#p20843</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20843#p20843"/>
		<title type="html"><![CDATA[Re: reset device via bootloader?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20843#p20843"><![CDATA[
in this case that would work, Micha. So how do you call leaveBootloader from a bat file, or exe?<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1281">ulao</a> — Wed Feb 01, 2012 2:50 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2012-01-31T21:55:33+02:00</updated>

		<published>2012-01-31T21:55:33+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20840#p20840</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20840#p20840"/>
		<title type="html"><![CDATA[Re: reset device via bootloader?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20840#p20840"><![CDATA[
To me it looks like<br /><div class="codebox"><p>Code: </p><pre><code>static void (*nullVector)(void) __attribute__((__noreturn__));<br /><br />static void leaveBootloader()<br />{<br />    //...<br />    nullVector();<br />    //...<br />}</code></pre></div>doesn't reset the device but only jumps to the beginning of the code. So either try this code or reset the controller via the watchdog after receiving a specific piece of code. Or be more precise what exactly you want and what exactly not.<p>Statistics: Posted by Guest — Tue Jan 31, 2012 9:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ulao]]></name></author>
		<updated>2012-01-31T02:00:37+02:00</updated>

		<published>2012-01-31T02:00:37+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20830#p20830</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20830#p20830"/>
		<title type="html"><![CDATA[Re: reset device via bootloader?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20830#p20830"><![CDATA[
uhh, wow ok &quot;I want to reset my device via a tool or bat file&quot; Can anyone tell me how?<br /><br />Thx to Davie I know know its possible but I'm still looking for a way to do it?<br /><br />Hi Micha, yes I know it can be done in the firmware, but I want to do it via the OS.<br /><br />I use an atmega328 and the bootloader provided by object dev.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1281">ulao</a> — Tue Jan 31, 2012 2:00 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2012-01-30T23:09:15+02:00</updated>

		<published>2012-01-30T23:09:15+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20829#p20829</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20829#p20829"/>
		<title type="html"><![CDATA[Re: reset device via bootloader?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20829#p20829"><![CDATA[
E.g. you could enable the watchdog and let the device run into a while(1)/for(;;)<p>Statistics: Posted by Guest — Mon Jan 30, 2012 11:09 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Daid]]></name></author>
		<updated>2012-01-30T15:03:46+02:00</updated>

		<published>2012-01-30T15:03:46+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20822#p20822</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20822#p20822"/>
		<title type="html"><![CDATA[Re: reset device via bootloader?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20822#p20822"><![CDATA[
My answer is as good as your question. You didn't give much info, so I couldn't give much info.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=5154">Daid</a> — Mon Jan 30, 2012 3:03 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ulao]]></name></author>
		<updated>2012-01-28T02:34:29+02:00</updated>

		<published>2012-01-28T02:34:29+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20804#p20804</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20804#p20804"/>
		<title type="html"><![CDATA[Re: reset device via bootloader?]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6397&amp;p=20804#p20804"><![CDATA[
Hi David, could you elaborate please?  Or are you saying you just know its possible?<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1281">ulao</a> — Sat Jan 28, 2012 2:34 am</p><hr />
]]></content>
	</entry>
	</feed>
