7 Replies Latest reply on Feb 19, 2015 1:08 PM by DiegoV_Intel

    Serial2.read not working !!!!

    GVPArdooie

      Hi everyone,

       

      I'm still not able to use "Serial2" for reading !!!!

      What is wrong?  Please help

       

      Thanks

       

      Gerard

        • 1. Re: Serial2.read not working !!!!
          rgb

          Hi GVPArdoole

          I am not sure what you are trying to do. In your code you are trying to write to and read from the same device, so could you be a little more specific.

          What board do you have? Galileo Gen 1 or Gen 2?

          How are you connected to the 3.5mm serial port (Gen 1) or FTDI connection (Gen 2)?

          What is the device that you are using to send and receive with? Are you sure it is sending data one byte at a time at 9600 8N1?

          What code is running on the device?

          Are you sure the device can receive data and display it?

          rgb

           

          your code

          -----------

          void setup() {

            // put your setup code here, to run once:

          Serial2.begin(9600);

          delay(500);

          Serial2.println("TAXIMETER KLAAR !!!");

          }

           

          void loop() {

            // put your main code here, to run repeatedly:

          if (Serial2.available()) {

             int inByte = Serial2.read();

             Serial2.print("I received: ");

               Serial2.println(inByte, DEC);

          }

          • 2. Re: Serial2.read not working !!!!
            DiegoV_Intel

            Hi GVPArdooie,

             

            How are you testing the serial communication?

             

            Please take a look at the sketch I made. It reads the Serial2 port.

             

            Please let me know if it works for you.

             

            Regards,

            Diego.

            • 3. Re: Serial2.read not working !!!!
              GVPArdooie

              Hi Diego,

               

              Thank you for the reply !!!

              I have tested your code, and as i expected, no answer on SERIAL2.....

              I use Intel Edison on Arduino breakout.

              Flashed the latest linux, downloaded the latest Arduino, no results.

              Hardware seems to work, because no problems to ssh root@........ in linux terminal

                                                                                           to Serial Putty on the board

              These apps uses the same serial port as i would like to use.

              Testing is done by

                  1 : Arduino serial terminal (Serial in Arduino code)

                  2 : Cutecom with /dev/ttyUSB0 on 9600 baud

              See printscreen

               

              Thanks for the help

               

              Gerard

              Schermafdruk van 2015-02-18 06:57:56.png

              • 4. Re: Serial2.read not working !!!!
                GVPArdooie

                Thank you for the reply !!!

                I have made an other sketch....

                *******************************************

                int inByte = 0;

                 

                void setup() {

                  Serial.begin(9600);

                  Serial1.begin(9600);

                  Serial2.begin(9600);

                 

                  Serial.println("Testing Rx for Serial_2");

                }

                void loop() {

                  Serial.println("\nWriting from Serial_1 to Serial_2...");

                  delay(500);

                  Serial1.print(1);

                  delay(500);

                  Serial.println("\nPrinting message received from Serial_1 to Serial_2...");

                  delay(500);

                 

                  if (Serial2.available()) {

                    while (Serial2.available()) {

                      inByte = Serial2.read();

                      Serial.println(inByte,DEC);

                    }

                  }

                  else {

                    Serial.println("***No message received in Serial_2***");

                  }

                 

                  delay(3000);

                }

                *************************************************************************

                No answer on SERIAL2....., Serial and Serial1 are OK.

                (Serial2.Writeln(....); is WORKING fine)

                I use Intel Edison on Arduino breakout.

                Flashed the latest linux, downloaded the latest Arduino, no results.

                Hardware seems to work, because no problems to ssh root@........ in linux terminal

                                                                                             to Serial Putty on the board

                These apps uses the same serial port as i would like to use.

                Testing is done by

                    1 : Arduino serial terminal (Serial in Arduino code)

                    2 : Cutecom with /dev/ttyUSB0 on 9600 baud

                 

                Thanks for the help

                • 5. Re: Serial2.read not working !!!!
                  GVPArdooie

                  Thank you for the reply !!!

                  I have made an other sketch....

                  *******************************************

                  int inByte = 0;

                   

                  void setup() {

                    Serial.begin(9600);

                    Serial1.begin(9600);

                    Serial2.begin(9600);

                   

                    Serial.println("Testing Rx for Serial_2");

                  }

                  void loop() {

                    Serial.println("\nWriting from Serial_1 to Serial_2...");

                    delay(500);

                    Serial1.print(1);

                    delay(500);

                    Serial.println("\nPrinting message received from Serial_1 to Serial_2...");

                    delay(500);

                   

                    if (Serial2.available()) {

                      while (Serial2.available()) {

                        inByte = Serial2.read();

                        Serial.println(inByte,DEC);

                      }

                    }

                    else {

                      Serial.println("***No message received in Serial_2***");

                    }

                   

                    delay(3000);

                  }

                  *************************************************************************

                  No answer on SERIAL2....., Serial and Serial1 are OK.

                  (Serial2.Writeln(....); is WORKING fine)

                  I use Intel Edison on Arduino breakout.

                  Flashed the latest linux, downloaded the latest Arduino, no results.

                  Hardware seems to work, because no problems to ssh root@........ in linux terminal

                                                                                               to Serial Putty on the board

                  These apps uses the same serial port as i would like to use.

                  Testing is done by

                      1 : Arduino serial terminal (Serial in Arduino code)

                      2 : Cutecom with /dev/ttyUSB0 on 9600 baud

                   

                  Thanks for the help

                  • 6. Re: Serial2.read not working !!!!
                    rgb

                    Hi GVPArdooie

                    If you have an Edison I can't help you as I don't have one and don't even know what Serial 2 is on the Edison.

                    I sent a message to Al_Hill saying your message should be moved to the Edison board.

                    rgb

                    • 7. Re: Serial2.read not working !!!!
                      DiegoV_Intel

                      Hi GVPArdooie,

                       

                      I'm sorry; I thought you were using a Galileo board.

                       

                      Which pins are you using for the Serial2? Serial2 should works fine, however it is accessible via the USB debug port (FTDI) only.

                       

                      Please check the release notes in page 7 and 12: Desktop Boards — Release Notes for Arduino* IDE

                       

                      Regards,

                      Diego.