This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS: undefined reference to `Serial1'

Other Parts Discussed in Thread: ENERGIA, MSP430F5529, MSP430G2553

Tool/software: Code Composer Studio

Hello, 

I am using Energia 1.6.10E18 and I'm trying to use the multiserial example . 


void setup() {
// initialize both serial ports:
Serial.begin(9600);
Serial1.begin(9600);
}

void loop() {
// read from port 1, send to port 0:
if (Serial1.available()) {
int inByte = Serial1.read();
Serial.write(inByte);
}
}

When opening the example project  and trying to verify - I get the error :\Local\Temp\arduino_modified_sketch_33016/MultiSerial.ino:22: undefined reference to `Serial1' 

Other functions work well, even using just Serial.begin(9600) can create a failure free project. 

How can I get rid of the undefinded Serial1 ? Where is it defined? 

Any help is appreciated 

  • What board?

    Serial1 is used when you have more than one *hardware* serial port. AFAIK, all the launchpads have only one hardware serial port exposed, and thus supported by Energia. If you want another, you will have to do it yourself.
  • That isn't true across the entire Launchpad product line.  I have used Serial and Serial1 on both the MSP432 Launchpad the MSP430F5529 Launchpad.  There may be others but I can speak with certainty with regard to the two aforementioned boards.  If the OP is using the original MSP430G2 Launchpad then that one only has one hardware serial port.

  • According to Energia website :
    "Depending on your hardware you may have more than one pair of UART pins. By default, you can use “Serial” when using UART. You can use additional UART pins by calling “Serial1, Serial2, …” etc."
    On the MSP430G2553 , I think it has the ability to support Serial 1, but could you please tell me how to check this ?
    Thanks
  • Unfortunately,  the 2553 only has one  serial port so Serial1 is not available on that device.  The MSP430F5529 might be a good choice as it does have 2 serial ports.  The MSP432 has 4 ports but , to the best of my knowledge, only 2 of those ports are available in Energia. All 4 are available if you use CCS.

    Even though the documentation references ports beyond Serial1, and even if the device has more than two ports, I don't believe they have been implemented in Energia as of yet.

**Attention** This is a public forum