Author Topic: Is there a way to do a "hard" reset in software?  (Read 4809 times)

tastewar

  • Jr. Member
  • **
  • Posts: 50
Is there a way to do a "hard" reset in software?
« on: March 02, 2014, 04:24:41 pm »
This may be as much of an Arduino question as a DigiX one, but my situation is that sometimes when starting up, the DigiX won't connect to my WiFi network. I unplug it, and plug it back in, and that usually does the trick. Sometimes have to do it more than once. I have this loop (cribbed from a sample) in my setup:

Code: [Select]
  wifi.begin ( 9600 );
  while (wifi.ready() != 1)
  {
    Serial.println("Error connecting to network");
    delay(15000);
  }

and if it displays that line once, it will keep on giving me that error. Doesn't ever seem to get "ready."

So, is there something I can do if I find myself in that state to give the board a good swift kick in the pants to see if it helps? Or maybe just the wifi module itself?

gogol

  • Sr. Member
  • ****
  • Posts: 398
Re: Is there a way to do a "hard" reset in software?
« Reply #1 on: March 03, 2014, 01:03:56 am »
much better to reset only Wifi!
close Jumper SJ4  and make sure, that SJ3 is open. In that case you can reset wifi with Pin106 (PC11 ).

dfarrell

  • Newbie
  • *
  • Posts: 30
Re: Is there a way to do a "hard" reset in software?
« Reply #2 on: March 03, 2014, 06:36:44 am »
I usually see this (registration failure with AP) when I forget to plug in external power so only USB powers the board.  The WiFi really needs external power.  I agree with gogol, use PC11.  I would not use MASTER_RESET as it is a slow risetime (not logic friendly) signal that can cause more problems than it solves.

tastewar

  • Jr. Member
  • **
  • Posts: 50
Re: Is there a way to do a "hard" reset in software?
« Reply #3 on: March 03, 2014, 08:43:26 am »
Thanks, folks.

I've only ever used USB, and it only fails occasionally, but I'd still like to handle the case.

I guess I'm more of an idiot than I thought, because after looking at the board itself for quite some time, and going back to gogol's pin diagram, I find mention of SJn jumpers on the diagram, but the only thing I see on my board that appears to be a jumper is the one labeled "wifi enable" Where are these other jumpers??

Also, assuming I get past that hurdle (with your help :-) ), a little code snippet for reseting wifi with Pin106 (PC11) would be helpful -- is it something like digitalWrite(Pin106,HIGH);delay(10);digitalWrite(Pin106,LOW);? And having accomplished such a reset, do I need to "start again" on the software side with wifi.begin(9600)?

Please feel free to point me in the direction of documentation, if there's useful stuff I've overlooked!

tastewar

  • Jr. Member
  • **
  • Posts: 50
Re: Is there a way to do a "hard" reset in software?
« Reply #4 on: March 03, 2014, 09:41:03 am »
As noted in my other thread, I did connect external power, but just as it didn't alleviate the other problem, it didn't alleviate this one either! Although in these cases, I've been using the on-board reset button since unplugging USB doesn't have quite the same effect when the board still has external power.

gogol

  • Sr. Member
  • ****
  • Posts: 398
Re: Is there a way to do a "hard" reset in software?
« Reply #5 on: March 04, 2014, 12:05:49 am »
look at the back of the board, close to the Wifi-card.  There you see both jumpers.  Those are Solder-Jumpers, you connect them using a tiny blob of solder.

Check back with the schematics and board-layout, which of those jumpers are connected by default (and need to be opened with a sharp knife)
SJ3 and SJ4 are open by default!






tastewar

  • Jr. Member
  • **
  • Posts: 50
Re: Is there a way to do a "hard" reset in software?
« Reply #6 on: March 04, 2014, 04:24:07 am »
Thanks -- I will try this. What does the code to reset wifi look like? Is it documented somewhere?

gogol

  • Sr. Member
  • ****
  • Posts: 398
Re: Is there a way to do a "hard" reset in software?
« Reply #7 on: March 04, 2014, 06:23:53 am »
you need to configure pin 106 as output and make sure it is high.
Once you pull it low for more than 10ms, the wifi gets resetted.
from the wifi-documentation:
Quote
There is pull-up resister internal and no external pull-up required. When module power up or some
issue happened, MCU need assert nRST signal “0” at least 10ms, then set” 1” to keep module fully
reset.

tastewar

  • Jr. Member
  • **
  • Posts: 50
Re: Is there a way to do a "hard" reset in software?
« Reply #8 on: March 04, 2014, 07:50:21 am »
Thank you!