SOFTWARE reset of Javelin - how to reboot?
GregS
Posts: 15
Is there any way from Javelin Java (in the program)·of forcing the equivalent of a hardware reset - i.e. a total reset of the hardware and restart of the Java interpreter and my program?
I have an embedded Javelin application·that runs for weeks but then triggers and exception (probably caused by a bug in my software that I cannot trace).· The exception cannot be handled sensibly so I would prefer to "reboot" automatically and continue from scratch (at least until I can find the bug).· In this way I can be assured that all timers, stacks, heaps, VPs etc are in a known condition.· I don't have a hardware watchdog that can force the reset.
Any help would be appreciated.
I have an embedded Javelin application·that runs for weeks but then triggers and exception (probably caused by a bug in my software that I cannot trace).· The exception cannot be handled sensibly so I would prefer to "reboot" automatically and continue from scratch (at least until I can find the bug).· In this way I can be assured that all timers, stacks, heaps, VPs etc are in a known condition.· I don't have a hardware watchdog that can force the reset.
Any help would be appreciated.
Comments
The easiest way is to connect an I/O pin to the reset pin.
The I/O pin is normally an input.
When you want to reboot make the pin a low output and wait forever.
This makes the javelin restart (and also the I/O pin becomes an input again).
regards peter
No free pins unfortunately!· Was hoping for the equivalent of a GOTO 0 or some undocumented method.
You can always simply put a default or most common value in resultvalues
or as parameters and then continue the program.
You can also set a main variable that you use to initialize the javelin.
//static variables
static boolean restart = true;
static void main() {
· while (true) {
··· if (restart) {
····· //initialize variables here
····· restart = false;
··· }
··· while (!restart) {
······ try {
········ //mainloopcode
······ }
······ catch {
········ restart = true;
······ }
··· }
· }
}
As soon as an exception occurs that is not handled somewhere else, the mainloop code will exit
and reinitialize all variables.
regards peter
I particularly want to reset all Javelin INTERNAL "interpreter" variables (VPs, stack, heap etc.) as the exception concerns too many VPs when I am NOT creating a VP - this points to some other corruption which probably cannot be cured by re-inititializing application variables. I don't trust the state of the Javelin (interpreter and application) at that stage - who knows which HCF instruction (see halt and catch fire) I could have executed by the time the exception is raised?
Regards
Greg
Another problem with the setup I proposed is that if variables are newly initialized
they require again memory without freeing the memory the variables already
occupied. You can solve that by having a single memorypool object from
which you allocate variablespace and then you can also reclaim any memory
upon reinitializing. But this requires a full rewrite of your code.
If you have an output pin that already at regular times toggles within a specific period,
then you could use an external watchdog chip that monitors that pin and when
the toggle does not occur within the specific timepriod, it sends a low pulse
to the javelin reset pin.
regards peter
I'm afraid that an external watchdog is my only option!
[noparse];)[/noparse]
JM
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Linux? There is worst, but it's more expensive.
A chip I use frequently is the PicAxe-08M - a Basic programmable· 8-pin chip (much like Basic Stamp but MUCH cheaper).· Easy to program with a startup delay and then to sense pulses on a input; if the pulses are missing it resets the Javelin, and then goes thru the startup delay/sense again.· Very easy and flexible, I even use the same serial programming cable as I use for the Javelin/Basic Stamps.
The PixAxe chips are·fantastic for simple applications·- I use them as data concentrators to 1-wire devices and as analogue to digital convertors.· Trouble is they are programmed in a very primitive Basic.· Hardware is cheap and easy, good programming is slow and expensive, something that Parallax and PicAxe seem to not understand with their insistance on Basic and Spin rather than modern, well designed programming languages </end rant>.
Look at www.picaxe.co.uk.
I don't really like this option [noparse];)[/noparse] What if the PicAxe crash? Do you have a WatchDog for it?
That's why I prefer to have a dedicated component for that. Because my controller is used for my solar system, and if it crash for to long, it can overheat quickly.
So I'm sur the PicAxe can works, but it will depend on the application.
JM
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Linux? There is worst, but it's more expensive.
Another advantage of the PicAxe is that you can program long/flexible/context-sensitive delays for start-up/reprogramming of the Javelin by connecting a PicAxe input to the Attention input of the Javelin·(shooting my mouth off before actually doing it!!!).
My point (and I am not associated with PicAxe) is that the 08M is a very felixible, cheap and general purpose chip that can be used in multiple, diverse applications.· I live in a third-world country where you cannot easily access a wide variety of special-purpose chips off the shelf.· The PicAxe solves many problems (and they have more complex chips).· However, even in the most advanced countries, simplicity has its benefits (cf Apple and Microsoft software and products) </end-end-rant>
I'll keep you updated to my progress.