Go Down

Topic: Sometimes after reboot, Yun bridge will not connect between Linux and Microcon (Read 397 times) previous topic - next topic

born2net

Sometimes after reboot, Yun bridge will not connect between Linux and Microcontroller.
I was thinking maybe it's related to the USB Adapter not having enough amp ... while it seems to make a difference which USB to 120V power adapter I am using (some seem to make this behavior worse), I still can't make the problem go 100% away (tried 4 diff USB > 120V adapters)...

Is anyone experiencing this kind of behavior where the Serial1 between the Linux and Micro Controller doesn't come up and you need to reboot again?

I am using Arduino Yun Rev 4 with latest software build

regards,

Sean.

born2net

I hope this helps someone.
you need to use this code.

void setup()
{

  Serial1.begin(9600); // 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
}



Go Up