Go Down

Topic: Software Reset with WiFi Shield (Read 567 times) previous topic - next topic

AndroidArduino

Hi, guys

I would like to be able to reset my Arduino WiFi Shield when the connection is dropped. I am currently using an Arduino R3 board. I have used the below procedure this works in resetting to the beginning of code however the WiFi Shield does not want to connect again after this code is run and I must re-upload the sketch

I call the function softReset when connection fails, this restarts arduino to beginning of sketch
Quote
void softReset(){
asm volatile ("  jmp 0");
}


then I use http://arduino.cc/en/Tutorial/EEPROMClear , to clear memory (1024 because arduino has this much eeprom http://arduino.cc/en/Main/arduinoBoardUno
Quote
for (int i = 0; i < 1024; i++)
    EEPROM.write(i, 0);

Cybernetician

Try this

void(* resetFunc) (void) = 0

call
resetFunc();

Software reset not reliable in arduino case. You can also do it by WDT
From Idea To Invention

pYro_65

Also, don't destroy your eeprom cos your wifi disconnected.

Code: [Select]
for (int i = 0; i < 1024; i++){
  if( EEPROM.read(i) != 0 ){
    EEPROM.write(i, 0);
  }
}


I'm not sure if EEPROM.write does this automatically, but it would be worth checking.

AndroidArduino

Thanks for the help but,

Unfortunately the above reset function does not work. The code will reset and go back to the beginning on the program however, it will not reconnect to the WiFi network once the Arduino gets to that line of code. 

Cybernetician

Without seeing your code it's really difficult to help you. 8)

Did you call WiFi.disconnect() before calling the reset function.
From Idea To Invention

Nick Gammon

Jumping to address 0 does not do a hardware reset. Even if you did a hardware reset using the watchdog timer that will almost certainly not reset the WiFi shield.
http://www.gammon.com.au/electronics

Go Up