Where is software reset?
I'd like to be able to tell the Javelin to go reboot itself. I know I can do this by connecting an I/O pin to RST and then driving the pin low, but that takes a pin. Isn't there some software operation that has the same effect? I'm looking for something like CPU.reset(). (I can't just put main() in a loop - I'm using new, and memory will run out.)
If there isn't one, why not? Can it be added? "I screwed up and need to start over" is a very useful embedded-programming operation.
·
If there isn't one, why not? Can it be added? "I screwed up and need to start over" is a very useful embedded-programming operation.
·
Comments
There isn't a software reset (too bad). It might be
possible to load some native register with some specific
value but I'm not aware of that.
You might be able to rewrite your code so
you don't need 'new' inside a loop.
Please post some code.
regards peter
put some external circuitry that detects pulses
with the JIDE port pins TX and ATN.
In your mainloop you only need to print
a character using System.out to prevent
that circuitry pulling the ATN line.
You don't need an I/O pin in that case.
Perhaps something with a 555 timer chip.
You may be required to clamp the signals
to 0 and 5V.
regards peter.
Array out of bounds would be caused by bad data coming over a serial link. I can either elaborately check all arriving data for problems (which would be slow, which is bad), or let the bad data just cause an exception, which I could catch in main and use to restart the Javelin in a clean state.
Sounds like I need to tie a pin to RST, and drive it low when I catch an exception. Ugly.
Anyone know if the Javelin can execute any instructions after RST is pulled low? In other words, will this work:
CPU.writePin(pinTiedToRST, false); //we'll never return
or should I be doing
CPU.writePin(pinTiedToRST, false);
while (true) {} //wait until it notices
you can catch locally and set a flag:
public void test() {
· try {
··· buf[noparse][[/noparse]index] = 1; //index may be out of range
· }
· catch {
··· testError = true;
· }
static void main () {
· if (testError) {
· //delete received frame
· }
}
or something like that. I use uarts all the time,
and I always check buffer indexes
if ((index<0) || (index>=buf.length()) {
· //print error or whatever
}
else {
· //store/retrieve data
}
and I have never had need for a complete reset,
rather I dispose of any bad received message
and wait for the next, or re-initialize communication
regards peter
·