8 Replies Latest reply on Jul 17, 2015 9:29 AM by DiegoV_Intel

    Serial pin 0-1 burned?

    cristian_lainfo

      Hello all i'm new with Arduino on my lasts projects i ever work with a small form factor motherboards. I purchased a Galileo Gen2.

       

      My project is to receive NMEA form a GPS DB9 serial port.

       

      On my first day with Arduino, I connected directly rs232 db9 to pin 0-1 (TX to 0 RX to 1 and GND), i receive only trash in my SD file.

       

      Finding the solution, i found i need to convert the rs-232 serial to TTL to receive. I purchased the sparkfun 232 shifter.

       

      I connected all, DB9 to sparkfun (and powering the sparkfun with 5v), and outputs to pin 0-1 in galileo, but i can't receive nothing.

       

      I'm using a sketch for get the data from Serial1 and save this to SD card.

       

      Can anybody tell me if i burned the serial port? Galileo seem to work fine, all is working but i cant receive data from pins 0-1

      I really like this card..

       

      See attached, and this is the sample code.

      !

      #include <SD.h>

      #define LED 8           // status LED for SD operations

      #define BUFF_MAX 100    // size of GPS & SD buffers

      File GPSlog;

       

      void setup()

      {

        Serial.begin(9600); // Para el debug de consola

        Serial.println("welcome");

        Serial1.begin(115200);

        pinMode(10, OUTPUT);   // Per SD library notes, pin 10 must be set to output

        pinMode(LED, OUTPUT);

       

        if (!SD.begin(4)) {        // SD card detected?

          Serial.println("NO SD CARD");

          return;

        }

        else   Serial.println("SD DETECTED"); // turn on LED if SD detection is OK

       

        GPSlog = SD.open("GPS.log", FILE_WRITE);  // open/append to a file GPS.log

        if (!GPSlog) {               // test if file can be opened

           Serial.println("OPEN FAILED");

          return;

        }

        else  Serial.println("FILE OPENED");  // turn on status LED if file open is OK

      }

       

      void loop()

      {

        char inBuffer[BUFF_MAX];    // buffer used to read NMEA lines from GPS

        byte outBuffer[BUFF_MAX];   // buffer used to write NMEA lines to SD card

        int sizeBuffer = 0;        // counter of how many chars per line

       

        while (Serial1.available()>0)  // if serial data available from GPS

        {       

         

          sizeBuffer = Serial1.readBytesUntil('\n', inBuffer, BUFF_MAX);  // read one NMEA line from GPS until end of line

          for (int i = 0; i < BUFF_MAX; i++) outBuffer[i] = inBuffer[i];   // create CSV file on SD

          int j = 0;

          if (GPSlog) {

            GPSlog.write(outBuffer, sizeBuffer);  // write GPS NMEA output to SD

            GPSlog.print("\r\n");   

            GPSlog.flush();

            digitalWrite(LED, HIGH);  // Keep LED on so long as SD logging is working.

          }

          else {

            // if the file didn't open, turn LED off

           Serial.println("ERROR SAVING");  // turn LED off if writing to file fails

          }

        }

        Serial.println("NO DATA");

      }

       

       

       

      Thank you, regards

        • 1. Re: Serial pin 0-1 burned?
          DiegoV_Intel

          Hi cristian_lainfo,

           

          According to your description, I understand that you applied a RS232 signal to the pins 0 and 1, which are TTL signal compatible. A RS232 signal is typically between +13V and -13V. If you apply it directly to a TTL port, it could damage the TTL port because of the different voltage levels. I recommend you to check the following information about RS232 and TTL: RS-232 vs. TTL Serial Communication

           

          Hopefully your Galileo pins are still ok, so let's be positive and try to run some tests. Personally, I've worked with RS232 - TTL conversions using the MAX232 IC, but I suppose the RS232 shifter you are using works in the same manner. To make sure the pins are damaged, I would try to send simple data, for example a string "a", instead of running the complete sketch with the SD card. Additionally, you can measure if there is data flowing to and from the Galileo pins. This way you will be sure that the pins are ok.

           

          Regards,

          Diego.

          • 2. Re: Serial pin 0-1 burned?
            cristian_lainfo

            Hello Diego, and thank you for your good answer, i'm trying to do this test.

             

            I'm connecting to Galileo Gen2 using the USB Client, this could affect transmission in PIN 0-1 ? I heard while we are using USB client to connect to Arduino, we can't use this pins.


            Regards

            Cristian

            • 3. Re: Serial pin 0-1 burned?
              cristian_lainfo

              Only to tell all, port is working , not burned!

               

              I'm sending data from console using

               

              echo hello > /dev/ttyUSB0

               

              And i can receive from serial console with this sketch

              void setup()

              {

                Serial.begin(9600);

                Serial1.begin(9600);

              }

               

              void loop()

              {

                if(Serial1.available()>0) //Comprobamos si en el buffer hay datos

                {

                  char dato=Serial1.read();  //Lee cada carácter uno por uno y se almacena en una variable

               

                  Serial.println(dato);  //Imprimimos en la consola el carácter recibido

                }

              }

               

              i need to check my gps serial config

               

              regards

              • 4. Re: Serial pin 0-1 burned?
                DiegoV_Intel

                Hello cristian_lainfo,

                 

                It's great that the pins are still working!

                 

                The transmissions through the pins 0 and 1 are not affected by the use of the USB Client port. You should use both without any issues.

                 

                Regards,

                Diego.

                • 5. Re: Serial pin 0-1 burned?
                  peter__wu

                  Hi, I am using Arduino with Serial.print() or Serial.Write(). I could see the output on Serial monitor but I cannot detect any signal on Pin 1. Can you advise?

                  Thank you!

                  • 6. Re: Serial pin 0-1 burned?
                    DiegoV_Intel

                    Hello peter__wu,

                     

                    The Serial object is used to send and receive data from the Serial Monitor only. If you want to send/receive data through the pins 0 and 1, you should use the Serial1 object instead.

                     

                    Regards,

                    Diego.

                    • 7. Re: Serial pin 0-1 burned?
                      peter__wu

                      Hi Diego, it works.Thank you! However, all reference from Arduino website defines pin 0 and 1 to Serial object. Can you advise a document from Intel that describe those?

                      • 8. Re: Serial pin 0-1 burned?
                        DiegoV_Intel

                        Hello peter__wu,

                         

                        It is not a document but in this thread you can find more details about the Serial1 object: Serial ports.

                         

                        Regards,

                        Diego.