Serial1.available() returning false

Hi all,
I’m trying to code a Due to read and write from the various serial ports, however I can’t seem to get an output from any serial aside from the usb programming port (Serial0).

I’m using a small serial to usb device to try to read Serial 1, 2 and 3 but can’t get any data.

If I plug the device into Serial1, I no longer receive any output from Serial0, however plugging it into Serial 2 or 3 still allows me to get data from Serial0.

I’m running Arduino IDE 1.5.8 but am hesitant to update, as I did that on my other computer and can no longer compile for the Due on it.

Even with no devices plugged in, I get false from Serial1.available(), Serial2.available() and Serial3.available();

Can these serial ports take a 5V device, or will that damage it?

Any other ideas on why this would happen or what I’m doing wrong?

Any help or ideas are greatly appreciated.

Thanks,
Cowmoo

My code is simple as follows and simply outputs “serial x not available”:

void setup(){
  Serial.begin(9600);
  delay(1000);
  Serial1.begin(9600);
  delay(1000);
  Serial2.begin(9600);
  delay(1000);
  Serial3.begin(9600);
  delay(1000);
}

void loop() {  
 if (Serial1.available() <= 0) {
    Serial.println("serial 1 not available");
  }  
 if (Serial2.available() <= 0) {
    Serial.println("serial 2 not available");
  }  
 if (Serial3.available() <= 0) {
    Serial.println("serial 3 not available");
  }
}
[code]

Even with no devices plugged in, I get false from Serial1.available(), Serial2.available() and Serial3.available();

Nonsense. The available() method returns the number of bytes available to read. It does NOT return true or false.

The available() method will NEVER return a value less than 0, so checking for negative values is a waste.

With nothing connected to the serial ports, only a dreamer would expect some data to appear on the serial port connect to the pins.

You need to post a schematic.

The Due is a 3V3 device. AFAIK none of its pins are 5V tolerant.

Pete

Wow, Paul. Thanks for the incredibly eloquent response. Please disregard this thread