7 Replies Latest reply on May 7, 2016 11:19 AM by jinzai

    Sending AT commands to GSM module using Eclipse IDE

    KS_Nathan

      I am currently working on interfacing GSM module with galileo.

      So with arduino IDE there seems to be no problem in getting it going, but when I am working with Eclipse(C/C++) I having difficulties in executing the same.

      Below is my code in C to send AT commands to the GSM module

      I have attached the code in attachement below

      Any suggestions would be heartily appreciated.

       

      by the way I am using .SIM900A board ver 2.

        • 1. Re: Sending AT commands to GSM module using Eclipse IDE
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hi,

          What difficulties are you experiencing, are you getting any errors compiling the code, is the code not working as expected? Please provide more information.

          There’s a section in the shield testing report dedicated to SIM900A. Take a look at section 28 of http://www.intel.com/content/www/us/en/support/boards-and-kits/000005913.html .

          Sergio
           

          • 2. Re: Sending AT commands to GSM module using Eclipse IDE
            Intel Corporation
            This message was posted on behalf of Intel Corporation

            Hi

            Do you still need help with this thread? Did you look at the recommended section of the guide we provided?

            Sergio
             

            • 3. Re: Sending AT commands to GSM module using Eclipse IDE
              KS_Nathan

              Hey yes I still need the thread..

              • 4. Re: Sending AT commands to GSM module using Eclipse IDE
                Intel Corporation
                This message was posted on behalf of Intel Corporation

                If you still need help with this thread, please answer our questions above and let us know if you found useful information in the link we posted.

                Sergio
                 

                • 5. Re: Sending AT commands to GSM module using Eclipse IDE
                  KS_Nathan

                  Hey sergio,

                  I am not getting any errors. I am able to run the code but the module is not performing the operations as I require(like sending SMS,receive SMS etc).I know that is too less of information but I feel the code attached in my post is not working as expected.I need some guidance.

                   

                  nathan

                  • 6. Re: Sending AT commands to GSM module using Eclipse IDE
                    Intel Corporation
                    This message was posted on behalf of Intel Corporation

                    What model specifically are you using and how are you connecting the module? If you look at the shield report posted above you can see the sim900 is used in several different configurations such as in LinkSprite* Quad-band GPRS/GSM Shield (Section 28), SIMCOM* Quad-band Mobile Sim900 – Arduino* Pack (Section 29) or SeeedStudio* GPRS Shield (Section 33).

                    Sergio
                     

                    • 7. Re: Sending AT commands to GSM module using Eclipse IDE
                      jinzai

                      Looking at your code -- I think you have just a couple of assumptions in there that are not going to get you very far. First of all -- communicating with the serial device in that manner is called polling and it might seem easier, but -- it most definitely is far more difficult in the long run. Like I said in your thread about GSM modules, this is an old -- old school thing and the confusion and frustration surrounding it is -- well, unfortunate, to say the least.

                       

                      Right now, I am on the Linux side of this laptop and my Arduino GSM code is on another laptop -- in Windows and written for the Arduino MegaADK and a SIM900 module. Later tonight, or tomorrow -- I will post you some basic code to use the module in the Arduino IDE,

                       

                      Let me ask you some questions about your code...

                       

                      First -- you are editing the phone number in this line, right?

                       

                        char *the_msg_init = "AT+CMGS=\"<10 digit mob no.>\"";

                       

                       

                      Of course, as it shows above -- that won't work even a little bit. (Also there is no carriage return at the end of it -- that is what the modem sees as the end of the command string.) I think that command needs the "\r"

                       

                      Next, at 9600BPS, a one millisecond delay is probably not enough. Code like you want to write should not use this method -- you will fight with that -- forever. It is very frustrating to poll a serial device with a 400Mhz processor like Galileo has. (Sleep is okay, though -- it does not care how fast the devices are -- it uses time only.) Event/Interrupt driven communications is vastly superior and you don't have to fiddle with delays all over your code. The downside is that it is also nearly impossible to stumble upon the right code on your own and the information for writing such code has all but disappeared because people tend to use other people's code for this type of thing.

                       

                      How very lucky for you that I am old. ;-)

                       

                      So, when I bought the SIM900 module, I did what you are doing -- looking for some code to abstract it somewhat. I had no success on the Arduino side, really. So, I started with a SerialPort example and downloaded the SIM900 documentation -- then used my antiquated knowledge of serial port/modem communications to do what you are doing -- taking each command and getting something going with that. I knew then that polling was not going to help much -- especially for the more complex commands. (Just ----ewww! Really.)

                       

                      I have some errands to run -- I need to go buy a 16GB microSD card to write a procedure for expanding the root filesystem on Galileo to make room for packages like a GSM package for nodeJS -- which I believe you wanted in the first place, right? However, later tonight or tomorrow, I will post up a sketch for you to start with -- would that help you at all?