Disabled Reset pin while debugWire was enabled

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi everybody,

 

I just tumbled into a little dead lock that probably some of you guys know a solution too ... I'm actually surprised that I couldn't find the solution by searching the web already. Am I really the only one whos dum enough to do something like this? 
Anyways, here's what happened

I'm currently debugging an ISR to trigger an external watchdog. I tried to get some more details by accessing my Atmega328bp via debug wire. I could set breakpoints and so forth but the behaviour was somewhat flaky. I though "maybe it's the Watchdog interfering with the debug wire, cause they boath have access to the reset line right?!" so I disabled the reset pin and tadaaaa got stuck. Now I can't access the Atmega either via DebugWire nor via SPI, due to the debugWire and ResetDsiable Fuse being set (at least that's my assumption)

Is there any trick how I can access the fuses now so I can disable the debugWire or ResetDisable Fuse? Unfortunately I only have an Atmel-ICE programmer so HVPP is not available I guess?!

 

Any help would be highly appreciated,

 

thanks,

 

Lenn 

This topic has a solution.
Last Edited: Fri. Mar 27, 2020 - 01:31 PM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, of course a watchdog is going to interfere with your debug session!

 

The whole point of a watchdog is precisely to reset the CPU if your code becomes unresponsive - and, by definition, it will be unresponsive if you halt it with a debugger!

 

This is the same for any chip. It is especially true when you use an external watchdog - because you can't just disable that by having a DEBUG build with the watchdog disabled.

 

Dudovitz wrote:
cause they both have access to the reset line right?! 

Not really. Usually, the WD reset is distinct from the external reset line,

 

Dudovitz wrote:
I disabled the reset pin

 

A really bad move!

 

The external reset pin is essential to the operation of the debug interface - so, if you disable that, you have no debug access!

 

Once you've disabled the external reset, HV programming is your only option:

 

https://www.avrfreaks.net/commen...

 

https://www.avrfreaks.net/forum/tutsoft-recovering-locked-out-avr

 

EDIT

 

In the Tutorial, clawson wrote:
Perhaps the most insidious of all the fuses is the one found on low pin count AVRs called RSTDISBL. Because these AVRs have so few pins they can sacrifice the use of the _RESET pin to be used (usually) as another GPIO pin instead. The problem is that ISP works by holding the chip in reset and it does this by pulling the _RESET pin low. If that pin has now been disconnected from the internal _RESET signal in favour of using it as an I/O then you simply cannot start ISP ever again in order to recover the situation.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Thu. Mar 26, 2020 - 08:54 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

This is where STK500 ownership still pays dividends - it can do HVPP (assuming you can lift the chip and plug it into the socket - trying to connect the 20 wires to a chip "in-situ" is close to impossible.

 

To be honest most people who make the RSTDISBL mistake only make it once, they throw away the $2 micro and chalk it up to experience !

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

The ATmega328PB is only available in SMD.    So you would have to remove the chip.  Solder it on a DIP adapter for the STK500.    Perform HVPP.   Remove the chip from the DIP adapter.  Solder it back on your pcb.

 

I would buy another chip.   Much easier.

 

Never touch RSTDISBL again.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Dudovitz wrote:
maybe it's the Watchdog interfering with the debug wire, cause they boath have access to the reset line right?!" so I disabled the reset pin
DebugWire shares the /RESET pin, but the watchdog triggers a reset internally.  The /RESET pin has nothing at all to do with it.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

joeymorin wrote:

but the watchdog triggers a reset internally. 

OP said:

I'm currently debugging an ISR to trigger an external watchdog.

 

Joey, he is using an EXTERNAL watchdog chip!

 

 

 

 

 

Last Edited: Thu. Mar 26, 2020 - 05:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

ki0bk wrote:
 he is using an EXTERNAL watchdog chip!

Either I missed that (entirely possible), or the edit to the OP added that after my reply in #1.

 

Of course, when you have an external watchdog you must have some way to disconnect it for debugging!

 

Again, that applies to any processor - but especially so if you're going to use debugWIRE !

 

And it is clearly stated in the datasheet:

 

 

EDIT

 

Jacl Ganssle wrote:
Everyone knows we should include a jumper to disable the [external] WDT during debugging

 

http://www.ganssle.com/watchdogs.htm

 

 

EDIT 2

 

And see that article for why kicking the WD from an interrupt is unlikely to be a Good Thing ... 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Thu. Mar 26, 2020 - 05:51 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:

Joey, he is using an EXTERNAL watchdog chip!

Yup, missed it!

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

HUIIII

 

thanks for all these enlightning answers! 

clawson wrote:

To be honest most people who make the RSTDISBL mistake only make it once, they throw away the $2 micro and chalk it up to experience !

Turned out to be what I had to do.  And I even added some solder experience to it. Isn't that grate :-P The HVPP is not supported by the Atmega-ICE and after some thoughts it turned quite clear that disbaling the reset pin WHILE having DWEN set is probably the easiest way to turn you're $2 into a piece of junk.  Wouldn't happen again. I promise ;-)

 

Thank you guys so much for taking the time to explain. Really appreciate it! 

Last Edited: Fri. Mar 27, 2020 - 06:09 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dudovitz wrote:
disbaling the reset pin WHILE having DWEN set is probably the easiest way to turn you're $2 into a piece of junk.

Actually, disabling the reset pin at any time is probably the easiest way to turn your $2 into a piece of junk

 

Thank you guys so much for taking the time to explain

You're welcome.

 

Now please see Tip #5 in my signature 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

woops. Sorry!