8 Replies Latest reply on Mar 11, 2016 1:38 PM by Intel_Peter

    Connecting 2 Galileo gen 2 using Gadget Serial

    APAR

      For an IOT Solution, I am trying to connect two Galileo Gen 2 boards using the Gadget serial port on both. Connecting RX from first board to TX on second one and vice versa.

      The client and server program running on both sides is written in C (not Arduino) and uses the mraa library to access the UARTs, but as raw by using the device names (/dev/ttyS0 | /dev/ttyS1).

       

      Which device should be used for the Gadget serial port on Galileo gen2 (/dev/ttyS0 or /dev/ttyS1 or /dev/ttyGS0 ?). Also is there any MUX that i need to do for communicating over Gadget serial or is that not possible ?. I tried /dev/ttyS1 first since from the board schematics, it seemed that UART1 is connected to the Gadget serial unless mux is used to route it to IO2 & IO3 ports. Thanks in advance for all the help.

       

      To prevent confusions, adding a picture marking the port. The port in question is the one right above the red coloured text.Untitled.jpeg

       

      Message was edited by: Arun P

        • 1. Re: Connecting 2 Galileo gen 2 using Gadget Serial
          Intel_Peter

          Hello APAR,

           

          If you would like to communicate from one Galileo to another using serial ports I'd suggest you to use pins 0 and 1. This is because the port you mention is reserved on Galileo to exclusively access the Linux terminal. I mean, it's not impossible to achieve, it would require kernel changes that would have to be included during the image's building process. So, it would be a lot simpler to use pins 0 and 1 even more if you note that they are in fact accessible from mraa while the port you mention isn't.

          If you decide to use this pins, there is a MUX configuration to use them but if you use mraa you don't need to set them automatically. Anyway, in case you need it, you can find it in How to program UART serial from Linux on Galileo Gen 2?

           

          Peter.

          • 2. Re: Connecting 2 Galileo gen 2 using Gadget Serial
            APAR

            Hi Peter,

             

            Tks for the fast and informative response. We have already got it working on IO ports 0 and 1 and also on 2 & 3. The MUX part also was worked out for ttyS1 (IO 2 & 3) and mraa uart init did work for IO 0 & 1 ports.

             

            We want to use the specific port, reason being we would have to otherwise solder a large number of Galileo cards with connectors on 0/1 or 2/3 which will be integrated as part of our solution. That increases our production time considerably.  Pl point me to detailed instructions on how to compile such an image and which device (ttyS0 or ttyS1) to use in our program.

             

            Regards

            Arun

            • 3. Re: Connecting 2 Galileo gen 2 using Gadget Serial
              APAR

              Hi Peter,

               

              To add to the question, would it be different if we are connecting between Galileo and another board using that port  Versus  between 2 galileo's.

               

              Thanks

              Arun

              • 4. Re: Connecting 2 Galileo gen 2 using Gadget Serial
                Intel_Peter

                If you would like to disable the console output and enable this serial port as a regular serial port, you will have to find the recipe that sets this port to be the console output by default. In that case I'd suggest you to read Quark's BSP 1.2.1. I have never tried to disable Galileo's console output so I'm not sure which recipe you will have to modify but I'll do some research and I'll get back to that as soon as I can.

                 

                To answer your second question, no it would not make a difference if you were to use a different board instead of another Galileo since you will have to modify the image for Galileo anyways.

                 

                Right now my suggestion is that you read the BSP and understand how it works in order to understand how to disable the console output.

                 

                Peter.

                • 5. Re: Connecting 2 Galileo gen 2 using Gadget Serial
                  APAR

                  Thanks Peter. I will look into the doc provided. Tks for all your help and time. Really appreciate it.

                  • 6. Re: Connecting 2 Galileo gen 2 using Gadget Serial
                    Intel_Peter

                    Hi APAR,

                     

                    I have some extra information that might interest you:

                     

                    Two files need to be changed in order to use this port as a regular serial port but first make sure you can SSH/Telnet to the board using Ethernet or Wi-Fi as you will lose access to Linux console through the FTDI cable and if you don't have a way to login to the Linux then you may have to start with fresh SD image to boot from, the files are:

                     

                    /boot/grub/grub.conf: find "console=ttyS1" and change ttyS1 to another tty device or null.

                    /etc/inittab: find "getty 115200 ttyS1" and change ttyS1 to another tty or null.

                     

                    Peter.

                    • 7. Re: Connecting 2 Galileo gen 2 using Gadget Serial
                      APAR

                      Hi Peter,

                       

                      Thats awesome. So that means i dont need to do a kernel recompile ?. I will try and update here. Thanks for your help man!.

                       

                      Regards

                      Arun

                      • 8. Re: Connecting 2 Galileo gen 2 using Gadget Serial
                        Intel_Peter

                        You shouldn't have to recompile kernel, but do make sure to have access to console from another way as I mentioned above. If this does not work it'll probably mean that you indeed need to modify the kernel for it to work. Test it and let us know what happens.

                         

                        Peter.