WiFi connectivity - help needed

If I install the YunSerialTerminal, bring up the serial monitor and press the Yun Reset button, the board resets and I can then connect via WiFi to the board. If I then install YunStandardFirmata (Standard Firmata that uses Serial1) and some Python scripts on the Linino side, I can still connect and successfully connect via WiFi to the Yun and activate the Python scripts and interact with YunStandardFirmata.

However, if I reset the board, either by pressing the reset button or by re-powering, I can no longer connect unless I first bring up the YunSerialTerminal again.

Is there a way for me to gain access to WiFi right from power-up without having to go through the YunSerialTerminal route?

The serial terminal sketch should have little to no effect on the wifi connection. Are you sure you are giving Linino enough time to boot up and either connect to your network or bring up it's own AP? It takes at least 60 seconds.

Yes, I have waited and what is strange, is that sometimes (rarely) I can ssh into linino, but most of the time, there is no route to host.

You only mention two sketches, yunserial terminal and firmata, what happens if you have something else on the Leonardo? Maybe the blink example?

@noblepepper:

Great tip about trying blink. It led me to discover that my problem is a race condition between the sketch and Linino. Linino has to be fully booted before starting the sketch otherwise WiFi is never enabled. I can either put a long delay in the sketch to allow Linino to complete its boot, or somehow figure out a way on the Arduino side that Linino has completed booting before proceeding with running the sketch.

Well, it isn't a exactly a race condition, your sketch is interfering with the boot process.

Once linino is booted it will still send messages on /dev/ttyATH0 so you may want to check out Tty for serial port to Arduino from Linino - Arduino Yún - Arduino Forum.

You need to let uboot get past the Hit any key to stop autoboot: prompt and the failsafe prompt: Press the [f] key and hit [enter] to enter failsafe mode

Here is how Bridge.cpp gets past uboot, as long as your sketch doesn't send "F" {enter} failsafe won't be a problem:

void BridgeClass::begin() {
  if (started)
    return;
  started = true;
  
  // Wait for U-boot to finish startup
  do {
    dropAll();
    delay(1000);
  } while (stream.available()>0);

  while (true) {
    // Bridge interrupt:
    // - Ask the bridge to close itself
    uint8_t quit_cmd[] = {'X','X','X','X','X'};
    max_retries = 1;
    transfer(quit_cmd, 5);

    // Bridge startup:
    // - If the bridge is not running starts it safely
    stream.print(CTRL_C);
    delay(250);
    stream.print(F("\n"));
    delay(250);
    stream.print(F("\n"));
    delay(500);
    // Wait for OpenWRT message
    // "Press enter to activate console"
    stream.print(F("run-bridge\n"));
    delay(500);
    dropAll();
  
    // Reset the brigde to check if it is running
    uint8_t cmd[] = {'X','X', '1','0','0'};
    uint8_t res[1];
    max_retries = 50;
    uint16_t l = transfer(cmd, 5, res, 1);
    if (l == TRANSFER_TIMEOUT) {
      // Bridge didn't start...
      // Maybe the board is starting-up?

      // Wait and retry
      delay(1000);
      continue;
    }
    if (res[0] != 0)
	  while (true);

    max_retries = 50;
    return;
  }
}
void BridgeClass::dropAll() {
  while (stream.available() > 0) {
    stream.read();
  }
}

I can't thank you enough, the wait for u-boot solution works. For those that may be trying to do the same thing with Firmata, I am providing the modified setup routine.

void setup() 
{
  
  Serial1.begin(115200); // Set the baud.
  while (!Serial1) {}
   // Wait for U-boot to finish startup.  Consume all bytes until we are done.
  do {
     while (Serial1.available() > 0) {
        Serial1.read();
        }
    
    delay(1000);
  } while (Serial1.available()>0);
  
  Firmata.setFirmwareVersion(FIRMATA_MAJOR_VERSION, FIRMATA_MINOR_VERSION);

  Firmata.attach(ANALOG_MESSAGE, analogWriteCallback);
  Firmata.attach(DIGITAL_MESSAGE, digitalWriteCallback);
  Firmata.attach(REPORT_ANALOG, reportAnalogCallback);
  Firmata.attach(REPORT_DIGITAL, reportDigitalCallback);
  Firmata.attach(SET_PIN_MODE, setPinModeCallback);
  Firmata.attach(START_SYSEX, sysexCallback);
  Firmata.attach(SYSTEM_RESET, systemResetCallback);

 
  Firmata.begin(Serial1);
  systemResetCallback();  // reset to default config

}