Project Horus High altitude balloon project

5Nov/091

How to kill an Arduino

I was playing around with the Arduino's watchdog timer the other day - ideally, I'd like to use it to reset the flight computer in case it locks up, or my code goes awry somehow & gets stuck in a loop, etc.

The Atmega328 (the core of my Arduino) does implement a watchdog timer - though unfortunately it's not possible to use it with the standard Arduino bootloader - the reason being that if the watchdog resets the chip, it remains enabled, and worse, its timeout reduces to 15ms - which doesn't give the Arduino bootloader long enough to run any code, so the Arduino gets stuck in a reset loop.

Fortunately, ladyada has written a modification to the Arduino bootloader to work around this problem - all I need to do is reflash the Atmega to use the modified bootloader.

Besides buying a dedicated programmer, the easiest (and cheapest) way to do this is by building a parallel port programmer - an old parallel printer cable, a few resistors and a hacked together ICSP header and I was done - at a cost of $0.

Fast forward to a few minutes later, trying to burn the bootloader into the chip - things are not working well, all I am getting is errors.

Eventually I had another look at my wiring to ensure I hadn't made a mistake (though I did triple check everything) and realised what I'd done. In my rush, I had not read the pin numbers on the parallel cable - I'd based my pinout at looking at the male end of the cable, wheras the diagram I was following was using the female (host) end. So while my leftmost pin was #1, it was #13 in the diagram.

I undid my wiring, and rewired everything up correctly, then tried to reflash to chip - but too late, I'd already toasted it with my first attempts! It no longer runs, and I can't upload any new code to it, so I've ordered a couple of new Atmega328's (they're cheap, thankfully!) which should arrive soon.

I've also been running a few predications with the CUSF flightplan predictor and trying to pick an appropriate launch spot. Whilst I've previously found that winds tend to blow west -> east here, current predications are rather variable, with the possibility east -> west winds (which would land us in the ocean) quite high. It looks like we might need to move further inland for the launch, and keep an eye on the forecasts. I'll also be writing an automatic cutdown system to cut the payload down if it looks like it might drift over populated areas or the ocean.

Filed under: Build, Code Leave a comment
Comments (1) Trackbacks (0)
  1. Maybe its too late already, but you can also use another Arduino to flash new bootloader to Arduino.


Leave a comment

No trackbacks yet.