2 Replies Latest reply on Sep 15, 2015 7:30 AM by DiegoV_Intel

    Serial communication does not work on Intel Galileo Gen 2

    Krychlic

      I cannot get serial communication working on Intel Galileo Gen 2. I'm using `Serial1` on port `/dev/ttyS0` assigned to pin 0 and 1. For testing purposes I created loopback on that serial port (connected RX and TX together). Unfortunately, it seems that nothing works. After few test it seems that my board can receive data, but cannot send any.

       

      void setup() {
        Serial.begin(9600);
        Serial1.begin(19200);
        Serial.println("Ready");
      }
      
      void loop() {
        while(Serial1.available() > 0) {
          Serial.print(Serial1.read());
          Serial.print(' ');
        }
        
        uint8_t buf[3] = {0xC0, 0xFF, 0xEE};
        Serial1.write(buf, 3);
        delay(2000);
      }
      

      I run same sketch with same configuration on Arduino Yún and it worked well. Where the problem could be? Thanks.

        • 1. Re: Serial communication does not work on Intel Galileo Gen 2
          Krychlic

          I need to communicate with serial port from Node.js then. I found I need to run this commands.

           

          echo -n "28" > /sys/class/gpio/export

          echo -n "out" > /sys/class/gpio/gpio28/direction

          echo -n "0" > /sys/class/gpio/gpio28/value

           

          echo -n "32" > /sys/class/gpio/export

          echo -n "out" > /sys/class/gpio/gpio32/direction

          echo -n "1" > /sys/class/gpio/gpio32/value

           

          echo -n "45" > /sys/class/gpio/export

          echo -n "out" > /sys/class/gpio/gpio45/direction

          echo -n "1" > /sys/class/gpio/gpio45/value

           

          I have few questions:

          • When I run first and few other commands, I'm getting "-sh: echo: write error: Device or resource busy". Is this OK?
          • Should I run this commands on every reboot?
          • 2. Re: Serial communication does not work on Intel Galileo Gen 2
            DiegoV_Intel

            Hello Krychlic,

             

            I ran your code and I was able to send data through the Serial1 interface (pin 1 - Tx). Take a look at the screenshot below:

            Serial1Test.JPG

             

            How are you testing your code? How do you know that there is nothing being sent?

             

            Answering your last questions:

            • The error message "-sh: echo: write error: Device or resource busy" appears when you are trying to export a GPIO that is already exported. You can ignore the message, it doesn't affect anything. It only tells you that the GPIO was already exported.
            • You should run the required commands to configure the GPIO on every reboot. However, those commands shouldn't be necessary because the pins Tx and Rx are configured by the Arduino IDE (or at least they should be). When I ran your code I only compiled and uploaded it to the Galileo board and it worked.

             

            Regards,

            Diego.