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

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2010-11-06T19:56:11+02:00</updated>

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

		<entry>
		<author><name><![CDATA[chrysn]]></name></author>
		<updated>2010-11-06T19:56:11+02:00</updated>

		<published>2010-11-06T19:56:11+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=5032&amp;p=16554#p16554</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=5032&amp;p=16554#p16554"/>
		<title type="html"><![CDATA[usbasploader / wdt_disable]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=5032&amp;p=16554#p16554"><![CDATA[
i am using usbasploader in a setup where i define a vendor usb command in the flashed program that makes the avr reset via<br /><br /><div class="codebox"><p>Code: </p><pre><code>wdt_enable(WDTO_15MS);<br />for(;;)<br />    _delay_ms(1);<br /></code></pre></div><br /><br />concerning changes to the default config in the first place, i disabled the check in the<br />default bootLoaderInit for MCUCSR. (NB: MCUCSR is defined as MCUSR on some chips)<br /><br />when i reset like this with the bootLoaderCondition ==<br /><ul><li> false, the reset restarts the program i flashed on top of usbasploader. otherwise, when i reset with the condition</li><li> true, it seems like the programmer is stuck somehow (as soon as i remove the jumper, the bootloader boots into the flashed program).</li></ul><br />it seems that the problem is related to the wdt_disable in usbasploader. according to <a href="http://avr-libc.nongnu.org/user-manual/group__avr__watchdog.html" class="postlink">the libavr documentation</a>, MCUSR has to be set to 0 before wdt_disable().<br /><br />would it be reasonable to generally (in the sense of the next version of usbasploader) move the wdt_disable call to bootLoaderInit, extract MCUC?SR to a mirror as described in the <a href="http://avr-libc.nongnu.org/user-manual/group__avr__watchdog.html" class="postlink">documentation</a> after setting MCUCSR to 0?<br /><br />the bootLoaderInit code i'm finally using is:<br /><br /><div class="codebox"><p>Code: </p><pre><code>    PORTD |= (1 &lt;&lt; JUMPER_BIT);     /* activate pull-up */<br />    if(!(MCUCSR &amp; ((1 &lt;&lt; EXTRF) | (1 &lt;&lt; WDRF))))    /* If this was not an external reset or a watchdog reset, ignore */<br />        leaveBootloader();<br />    MCUCSR = 0;                     /* clear all reset flags for next time */<br />    wdt_disable();                  /* main app may have enabled watchdog */<br /></code></pre></div><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=4549">chrysn</a> — Sat Nov 06, 2010 7:56 pm</p><hr />
]]></content>
	</entry>
	</feed>
