1 2 Previous Next 20 Replies Latest reply on Jul 16, 2015 8:40 AM by DiegoV_Intel

    error in software serial

    Heshamnouby

      I am using galielo 2

      when I type anycode which it has softwareserial.h

       

      the error is  collect2.exe: error: ld returned 1 exit status

       

      like : " so I want to run the code at galielo "

       

      /*
       
        Emic 2 Text-to-Speech Module: Basic Demonstration      
                                                              
        Author: Joe Grand [www.grandideastudio.com]            
        Contact: support@parallax.com                           
       
        Program Description:
       
        This program provides a simple demonstration of the Emic 2 Text-to-Speech
        Module. Please refer to the product manual for full details of system
        functionality and capabilities.

        Revisions:
       
        1.0 (February 13, 2012): Initial release
        1.1 (April 29, 2014): Changed rxPin/txPin to use pins 10/11, respectively, for widest support across the Arduino family (http://arduino.cc/en/Reference/SoftwareSerial)
         
      */

      // include the SoftwareSerial library so we can use it to talk to the Emic 2 module
      #include <SoftwareSerial.h>

      #define rxPin   2  // Serial input (connects to Emic 2's SOUT pin)
      #define txPin   3  // Serial output (connects to Emic 2's SIN pin)
      #define ledPin  13  // Most Arduino boards have an on-board LED on this pin

      // set up a new serial port
      SoftwareSerial emicSerial =  SoftwareSerial(rxPin, txPin);

      void setup()  // Set up code called once on start-up
      {
        // define pin modes
        pinMode(ledPin, OUTPUT);
        pinMode(rxPin, INPUT);
        pinMode(txPin, OUTPUT);
       
        // set the data rate for the SoftwareSerial port
        emicSerial.begin(9600);

        digitalWrite(ledPin, LOW);  // turn LED off
       
        /*
          When the Emic 2 powers on, it takes about 3 seconds for it to successfully
          initialize. It then sends a ":" character to indicate it's ready to accept
          commands. If the Emic 2 is already initialized, a CR will also cause it
          to send a ":"
        */
        emicSerial.print('\n');             // Send a CR in case the system is already up
        while (emicSerial.read() != ':');   // When the Emic 2 has initialized and is ready, it will send a single ':' character, so wait here until we receive it
        delay(10);                          // Short delay
        emicSerial.flush();                 // Flush the receive buffer
      }

      void loop()  // Main code, to run repeatedly
      {
        // Speak some text
        emicSerial.print('S');
        emicSerial.print("Hello. My name is the Emic 2 Text-to-Speech module. I would like to sing you a song.");  // Send the desired string to convert to speech
        emicSerial.print('\n');
        digitalWrite(ledPin, HIGH);         // Turn on LED while Emic is outputting audio
        while (emicSerial.read() != ':');   // Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command
        digitalWrite(ledPin, LOW);
         
        delay(500);    // 1/2 second delay
         
        // Sing a song
        emicSerial.print("D1\n");
        digitalWrite(ledPin, HIGH);         // Turn on LED while Emic is outputting audio
        while (emicSerial.read() != ':');   // Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command
        digitalWrite(ledPin, LOW);

        while(1)      // Demonstration complete!
        {
          delay(500);
          digitalWrite(ledPin, HIGH);
          delay(500);             
          digitalWrite(ledPin, LOW);
        }
      }

       

        • 1. Re: error in software serial
          Heshamnouby

          CMata_Intel - Intel_Peter  can u help me ?

           

          thamk u (:

          • 2. Re: error in software serial
            DiegoV_Intel

            Hi Heshamnouby,

             

            The library SoftwareSerial is not supported by Galileo. The regular SoftwareSerial library has been written based on the Arduino boards’ architecture so it won't work when you try to compile it for the Galileo board.

             

            However, there is a workaround that you might find useful. I've written a simple code that you can run to test it. I did it and it worked for me. The test code is attached below.

             

            Basically, you have to use a modified version of the SoftwareSerial library. This version was included in the Arduino IDE 1.5.3, but on versions newer than the 1.6.0 it is no longer included. I attached the files from the Arduino IDE 1.5.3, you can find them below. Please follow these steps:

             

            1. Unzip the file SoftwareSerialGalileo2.zip. It contains a folder with two files: SoftwareSerial.cpp and SoftwareSerial_Class.h.
            2. Copy the uncompressed folder into the Arduino libraries folder. In my case I was using the Arduino IDE 1.6.0 and the libraries folder was located in C:\...\arduino-1.6.0+Intel\libraries
            3. Open the test code SoftwareSerialExampleGalileo2.ino. At this point, you should be able to upload the code into your Galileo Gen2 and see the Serial Monitor output.

             

            I hope you find this way useful.

             

            Regards,

            Diego.

            1 of 1 people found this helpful
            • 3. Re: error in software serial
              Heshamnouby

              thank u very much

               

              than u for ur effort , it worked !

              • 4. Re: error in software serial
                Heshamnouby

                hi DiegoV_Intel

                The example works but the emic 2 code didn't work :/

                why that ? :/

                "the code above "

                 

                Orange (Blinking): Error state. Emic 2 has malfunctioned due to an on-board communication error. If a power cycle of Emic 2 does not remedy the situation, please contact Parallax technical support for further assistance. 

                • 5. Re: error in software serial
                  DiegoV_Intel

                  Hello Heshamnouby,

                   

                  I tried to compile the code you posted above with the workaround I explained before. The code compiled successfully. There were no error messages. However, I don’t have the Emic2 to test it. Where does the error message appear? According to it, there is a communication error with the board.

                   

                  Regards,

                  Diego.

                  • 6. Re: error in software serial
                    Heshamnouby

                    DiegoV_Intel

                    No error in compiling , it compiles successifuly

                    But the emic 2 didnt work

                    In its docentation told when orange light in it blinking : there r error in the comminucTio. At board !

                    So what the error is :/

                    Do u understand me ?

                    Thnx

                    • 7. Re: error in software serial
                      Heshamnouby

                      DiegoV_Intel Intel_Peter CMata_Intel

                      The emic 2 works when i remove SD card " eglibic image which 210 mb " and when i put it the emic disnt work ?

                      So must i configure pin 2,3 or what on linux ?

                      • 8. Re: error in software serial
                        DiegoV_Intel

                        Hi Heshamnouby,

                         

                        I tested the code again to make sure that there is data flowing from the Galileo board. As you can see in the picture below, there is data flowing from the board. The data showed in the picture is the message sent by the Galileo with the following line:

                         

                        emicSerial.print("Hello. My name is the Emic 2 Text-to-Speech module. I would like to sing you a song.");  // Send the desired string to convert to speech
                        

                        testEmic2.JPG

                        I tested the code with the SD image and it worked. However I used this SD image: http://downloadmirror.intel.com/24355/eng/SDCard.1.0.4.tar.bz2. According to your description, you are using the IoT image which has restrictions with the Arduino IDE. I highly recommend you to use the one in the link above when running Arduino sketches.

                         

                        Regards,

                        Diego.

                        • 9. Re: error in software serial
                          Heshamnouby

                          DiegoV_Intel

                          Okay thank u but i meed iot image ! I cant use my project without it so can i use code stty -f dev / " name of serial "  to make pins work or what ?

                          Plz i want solution

                          Thank u (:

                          • 10. Re: error in software serial
                            DiegoV_Intel

                            Hi Heshamnouby,

                             

                            The Arduino sketch won't work if you are using the IoT image because it has restrictions when compiling Arduino sketches. The reason is because the IoT image is based on eglibc, but the Arduino sketches are compiled based on uclibc. That can't be changed because this is the way the Arduino IDE compile each sketch.

                             

                            On the other hand, the standard Yocto image is based on uclibc and the Arduino sketches will work (if they are compatible) when this image is used. That's why I recommend you to use the standard Yocto image instead of the IoT for Arduino applications.

                             

                            Regards,

                            Diego.

                            • 11. Re: error in software serial
                              Heshamnouby

                              DiegoV_Intel

                              First solution !

                              Mmm.... So can in sketch finish my work at iot and then reboot the galileo and open at the firmware of intel galileo 1.0.4 ?

                               

                              Second solution !

                              Can i use same code of emic2 at eclipse or intel xdk?! , thank u

                              • 12. Re: error in software serial
                                DiegoV_Intel

                                Hi Heshamnouby,

                                 

                                I'm afraid that I didn't understand your first solution. Both images, IoT and Standard, have the same firmware. If the project with the IoT image doesn't involve Arduino sketches you can finish it and then you can use the Standard image for Arduino applications, but the work made in one image can't be used in the other one.

                                 

                                Regarding your second solution, the same code won't work at Eclipse IDE or the XDK. You can program a similar code to use the serial port and send strings through it, but the workaround made for the SoftwareSerial library won't work because it is specifically for the Arduino IDE. You would have to use the pins 0 and 1.

                                 

                                Regards,

                                Diego.

                                • 13. Re: error in software serial
                                  Heshamnouby

                                  I install boost packages and the emic start working ! so I am trying to make it work well

                                   

                                   

                                   

                                   

                                  can I install this camera with iot image and pins 0-1 ? Using the Camera | TTL Serial Camera | Adafruit Learning System

                                   

                                  or I can buy camera with usb ?

                                  • 14. Re: error in software serial
                                    DiegoV_Intel

                                    Hi Heshamnouby,

                                     

                                    It's hard to say if that camera will work or not because it hasn't been validated. The camera has serial interface so you could try using it with the pins 0 and 1. If you are planning to use the Arduino libraries for this camera, I suggest you to check if they are compatible with the Galileo’s architecture because they might work only for Arduino boards. Galileo and Arduino boards have different architectures and some libraries won't compile for Galileo.

                                     

                                    I noticed that you opened another thread for the camera question. You have received an answer there. Since this question is completely different to the original one, please continue replying in the other thread: camera module serial

                                     

                                    Regards,

                                    Diego.

                                    1 2 Previous Next