6 Replies Latest reply on Nov 27, 2014 9:23 AM by CMata_Intel

    Additional UART port (SoftwareSerial)?

    gzyulin

      Is it possible to config additional UART like using the SoftwareSerial from standard Arduino library to specify 2 GPIO to be an additional UART/serial port? My project already used all the available serial port already. I tried to port the SoftwareSerial library to the project but so far not much luck yet. Any suggestion?

        • 1. Re: Additional UART port (SoftwareSerial)?
          CMata_Intel

          Hi gzyulin;

           

          In your project, Are you using the UART in pin 0 and 1?

          You are having problems with the SoftwareSerial library because is not added in the IDE. You can see the available libraries in:

          >C:\arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison\cores

          >C:\arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison\libraries

           

          In this document you will find in the section 4.3 the available UART's  in the Edison Module. If you are using UART1 and UART2, you could access to your terminal via telnet, and change the purpose of the port for the Linux terminal communication in to what you want. For this, you will have to create your own image with your customized packages.

          https://communities.intel.com/docs/DOC-23159. This document will help you a lot in this part of your project.

           

           

          Regards;

          CMata

          • 2. Re: Additional UART port (SoftwareSerial)?
            gzyulin

            Hi CMata_Intel, thanks for the information. I have read these documents but unsure how to configure GPIO as UART. I have used both UART1 and UART2 already and need 1 more UART. Is it possible to config unused GPIO as additional UART? If possible, can you provide some example? Thank you.

            • 3. Re: Additional UART port (SoftwareSerial)?
              CMata_Intel

              Hi gzyulin;

               

              Take a look of this thread; where mikalhart explained the configuration of the Serial Ports, in there  you could see an example that explains how he did to use the libraries TTYUART. You can find these files in:

              C:\arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison\cores\arduino\TTYUART.cpp

              C:\arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison\cores\arduino\TTYUART.h

               

              If you want to use this, be aware of the specifications of each one of the ports in the Edison, you could have problems according to the speed that you want to use, take a look at the Hardware Guides in order to prevent this:

              Intel® Edison Arduino Board Hardware Guide

              The specified item was not found.

              Intel® Edison Compute Module Hardware Guide

               

              The other way to do this, is as I replied in the message before. I hope this helps and gives you an idea on how to start.

               

              Regards;

              CMata

              • 4. Re: Additional UART port (SoftwareSerial)?
                gzyulin

                Thank you CMata, the TTYUART seems to work.

                 

                I have couple more questions that are related to this one. How does the Arduino PIN mapped to the Linux GPIO and is there a full map of the GPIO mapping? How do I define GPIO when I custom build my own image? For example, for Arudino, the PIN 0 and 1 are used as UART, which mapped to the GPIO 130 and 131 in LINUX according to this guide EmutexLabs. I need to develop the program under Arduino IDE. I need to define some of the GPIO so that I can use them in the Arduino IDE to program. From my understanding, I will need to custom build my own image, which I already did, and configure the GPIOs. But I could not find much information about how to define the GPIO and how the GPIO are mapped to the Arduino IDE.

                • 5. Re: Additional UART port (SoftwareSerial)?
                  deium

                  gzyulin

                  To answer your question - it actually could be possible to use two GPIO pins as serial RX/TX, but that is probably a project in and of itself.

                  There of course wouldn't be any hardware flow control or hardware buffered input/output as provide by an actual UART.  One pin would need to be synchronized to the rate of the data flowing across the line to define the length and timing of a bit, the other line for bidirectional communications.  You would also need to define your communications protocols such that both the Edison side and the device side would have to understand that protocol to communicate.  You would need error correction in your routines to detect when what was received does not match to what was sent.  The routines would probably be less of an industrial grade at first, so effective through put would be slow at first until you had all your bugs worked out, then increasing speed to find your top reliable stable speeds.

                   

                  Of course, this actually describes how most of the protocols we use today actually started out at a blazing 30 characters per second (at 300 8N1 baud).

                  Did you consider purchasing another UART for your project - might be quicker and comes with higher speeds and reliability.

                  • 6. Re: Additional UART port (SoftwareSerial)?
                    CMata_Intel

                    Hi gzyulin;

                     

                    In order to define and hook your GPIOs you can use the MRAA library  there are several threads in the communities (This is an useful example) related to this that I think It could help you.Take a look of the files in this link to understand more about the library: https://github.com/intel-iot-devkit/mraa/tree/master/docs

                    Let us know about your results.

                     

                    Best Regards;

                    CMata