0
Offline
Jr. Member
Karma: 0
Posts: 61
Arduino rocks
|
 |
« on: April 11, 2011, 12:37:17 pm » |
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
Shannon Member
Karma: 129
Posts: 10378
|
 |
« Reply #1 on: April 11, 2011, 12:52:56 pm » |
Do you have another Arduino?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 61
Arduino rocks
|
 |
« Reply #2 on: April 11, 2011, 01:46:58 pm » |
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
Shannon Member
Karma: 129
Posts: 10378
|
 |
« Reply #3 on: April 11, 2011, 02:15:00 pm » |
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
Jr. Member
Karma: 0
Posts: 77
|
 |
« Reply #4 on: April 11, 2011, 06:54:34 pm » |
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
Tesla Member
Karma: 75
Posts: 6970
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #5 on: April 11, 2011, 07:41:55 pm » |
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
|
|
|
|
|
Hurley, NY
Offline
Jr. Member
Karma: 0
Posts: 77
|
 |
« Reply #6 on: April 12, 2011, 08:47:18 am » |
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
Jr. Member
Karma: 0
Posts: 61
Arduino rocks
|
 |
« Reply #7 on: April 12, 2011, 05:07:46 pm » |
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
Faraday Member
Karma: 80
Posts: 5513
Strongly opinionated, but not official!
|
 |
« Reply #8 on: April 12, 2011, 07:01:10 pm » |
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. 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
Tesla Member
Karma: 75
Posts: 6970
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #9 on: April 12, 2011, 07:21:26 pm » |
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  , I haven't changed the bootloader or done anything special except write to the appropriate registers. ______ Rob
|
|
|
|
|
Logged
|
|
|
|
|
SF Bay Area (USA)
Offline
Faraday Member
Karma: 80
Posts: 5513
Strongly opinionated, but not official!
|
 |
« Reply #10 on: April 12, 2011, 11:42:41 pm » |
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
Tesla Member
Karma: 75
Posts: 6970
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #11 on: April 13, 2011, 12:57:42 am » |
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
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 61
Arduino rocks
|
 |
« Reply #12 on: April 13, 2011, 12:05:37 pm » |
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
Faraday Member
Karma: 80
Posts: 5513
Strongly opinionated, but not official!
|
 |
« Reply #13 on: April 13, 2011, 12:50:33 pm » |
I've updated http://code.google.com/p/arduino/issues/detail?id=181&q=watchdogto 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
|
|
|
|
|
|