Pages: [1]   Go Down
Author Topic: exteral watchdog timer ic for mega2560  (Read 2245 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I have build a home automation arduino circuit with ethernet, SD logger, whireless RF12 transmissions over nodes, LCD display. So my master arduino is mission critical and crashes ones in a month. (always when requesting tcpip packages)

as I can't get the internal wdt for atmega2560 (on standard mega board) to work (due to restrictions of the bootloader)
and I cant flash the bootloader (I did not find a very good explanation).

So my only option is to use an external watchdog timer ic.
Has anyone got experience with it ?

Thanks in advance,
Jeroen.
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 208
Posts: 12933
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you have another Arduino?
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, I have another one, but just for the power consumption and the space, I would like to use a small chip.
But this could be also an option.

Jeroen
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 208
Posts: 12933
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You misunderstand.  You can use the second Arduino to reprogram or even remove the bootloader from the home automation Arduino.  The second Arduino acts as an in-circuit serial programmer allowing you to change the home automation Arduino anyway you wish...
http://arduino.cc/en/Tutorial/ArduinoISP
Logged

Hurley, NY
Offline Offline
Jr. Member
**
Karma: 0
Posts: 86
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

a few days ago, i found myself needing a watchdog without evening knowing there was such a thing and that it had a name.  my initial plan was to hook up two 555 timers (actually, two such timers in a 556 package), using one as a missing pulse detector and the other as a brief one-shot (it would have to work through a logical inverter).  i'd dedicate an arduino pin to sending regular pulses to the missing pulse detector, and if that ever failed, i'd fire the one shot, which would strobe the reset pin through the inverter.  it wouldn't be difficult to implement and wouldn't require a special bootloader. but then i discovered that watchdogs are real things and are implemented in hardware on atmel chips.  the tricky part was getting past the stock bootloader, which is inherently incompatible with the built-in hardware watchdog. if i were in your position and gave up on the bootloader, i might implement the dual 555 analog watchdog.
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8530
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

There are chips that do this without requiring any (or as many?) external components as the 555 would.

There are so many it's not funny, start by looking at TPS3820, MCP131x, MCP132x, MAX823/4/5 for starters.

Probably all SMDs though if that's a problem.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Hurley, NY
Offline Offline
Jr. Member
**
Karma: 0
Posts: 86
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

the thing is, if you don't know the name for something and are simply experiencing a problem that you think you can solve, you find yourself designing something (at least in your head) until finally your research takes you to the wheel that has already been invented. i did a lot of research on how best to implement a 555 "auto resetter" (as i called it) before stumbling across a web page that spoke of watchdogs.  at that point i found atmel builds watchdogs into their chips and i was ecstatic!  i didn't have to build anything, i just needed a different bootloader and a couple lines of code. the more i work with arduino, the more i discover how rich an environment it is.  there's the arduino layer, but just beneath that is this huge avr layer. i do a google search, find some non-arduino page referencing libraries that turn out to exist in the the arduino environment. it's continually surprising (but in a good way).
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks all for the response.

I will give the reflash bootloader another try as Coding Badly suggested.

Does anyone know where to find a good bootloader for the mega2560 (fe from adafruit) ?
But I need the full hardware memory capacity (as it is a large sketch with a lot of variables)

Thanks in advance,
Jeroen
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 134
Posts: 6763
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Does anyone know where to find a good bootloader for the mega2560 (fe from adafruit) ?
the 2560 uses a different bootloader than the 328-based arduinos, and I don't know of any crafted alternatives.

Quote
But I need the full hardware memory capacity (as it is a large sketch with a lot of variables)
"lots of variables" is irrelevant to bootloader issues with large AVRs.  The 328 bootloader (based on stk500v1) doesn't handle flash memory pointers larger than 16 bits, so it's limited to AVRs with 128k or less of memory (64k words.)  But the existing MEGA bootloader implements stk500v2, which includes support for more than 128k.  The 8k bytes of RAM usable by variables is pretty much a drop in the bucket.

I don't see any support for WDT in the stk500v2 bootloader; is that all you actually need?
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8530
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
the tricky part was getting past the stock bootloader, which is inherently incompatible with the built-in hardware watchdog.
I use the WDT all the time on a Mega, I wasn't aware that it didn't work smiley, I haven't changed the bootloader or done anything special except write to the appropriate registers.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 134
Posts: 6763
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I use the WDT all the time on a Mega, I wasn't aware that it didn't work
If you program the WDT to reset the cpu, and the bootloader is WDT-unaware, then you'll be unable to download new sketches because the WDT will reset the chip before the download finishes (because RESET does not turn off the WDT.)  If the WDT timeout is less than the bootloader timeout, it also won't get a chance to start the loaded sketch before being reset.  This has happened accidentally on 328-based Arduinos running the old bootloader.  You can usually rescue things by setting up a power-up reset rather than a reset-reset.
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8530
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, now that you mention it I'm using interrupt mode.

However one of the options within that interrupt is a JMP 0 which is for most intents the same as a hard reset. So that might be an easier option to reflashing the bootloader.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Westfw,

I only want to use the WDT and my sketch is around 205 kbyte (larger than the 128kb)

Whats now the conclusion ?

Please advice,
Jeroen
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 134
Posts: 6763
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've updated http://code.google.com/p/arduino/issues/detail?id=181&q=watchdog
to reflect that a patch is needed for the mega bootloader as well.

Although this "issue" has a somewhat questionable history (it never made it into the duemilanove bootloader, but it IS fixed in the Uno bootloader.)  Since the bootloader is hard for users to change, and change in the bootloader code that doesn't coincide with a new board can lead to "interesting" support problems (how does a user know whether they have the new bootloader?)
Logged

Pages: [1]   Go Up
Jump to: