🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    New GSM module test

    Scheduled Pinned Locked Moved Modules
    5 Posts 2 Posters 7.1k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Z Offline
      zw29
      last edited by

      I just got the new GSM module (M6315). I can burn the EasyLoader successfully. After reboot, it shows a BLANK screen. If I burnt the GSM sample code from Arduino IDE to the M5stack, it shows a BLANK screen also. Is there anything I can try or have I missed anything?

      1 Reply Last reply Reply Quote 0
      • lukasmaximusL Offline
        lukasmaximus
        last edited by

        Hi @zw29 did you look at the Arduino code?

        #include <M5Stack.h>
        
        void IotWriteCommand(char cmd[],char date[]){
          char buf[256] = {0};
          if(cmd == NULL)
          sprintf(buf,"AT\r\n");
          else if(date == NULL)
          sprintf(buf,"AT+%s\r\n",cmd);
          else
          sprintf(buf,"AT+%s=%s\r\n",cmd,date);
        
          Serial2.write(buf);
        }
        //AT+CSQ=?
        void get_time(void){
          IotWriteCommand("CSQ=?",NULL);
          while(Serial2.available()){
            uint8_t ch = Serial2.read();
            Serial.write(ch);
            M5.Lcd.write(ch);
          }
        }
        
        void setup() {
          M5.begin();
          Serial.begin(115200);
          Serial2.begin(115200, SERIAL_8N1, 16, 17);
          pinMode(2, OUTPUT);
          digitalWrite(2, 0);
          delay(3000);
          digitalWrite(2, 1);
        }
        
        void loop() {
         if(M5.BtnA.wasReleased()){
            M5.Lcd.fillScreen(TFT_BLACK); 
            M5.Lcd.setCursor(60,80,2);
            get_time();
          }
        }
        
        

        The code really doesn't seem to do much other than fill the screen with black and supposedly print the time to the screen, Was there any output on the serial terminal?

        It looks as though it is simply a template and you need to add in your own AT commands. I do not have a GSM module to test unfortunately,What is your intended use for the project?

        1 Reply Last reply Reply Quote 0
        • Z Offline
          zw29
          last edited by

          @lukasmaximus Thank you for your suggestion. And sorry for the very late reply. The above code does not work for me. it is a blank screen.

          Z 1 Reply Last reply Reply Quote 0
          • Z Offline
            zw29 @zw29
            last edited by

            I modified the Button example and can get "OK" in the result. But I need to press the "A" button twice to get the result. Not sure if this is correct.

            #include <M5Stack.h>

            void setup() {
            // init lcd, serial, but don't init sd card
            M5.begin(true, false, true);
            M5.Power.begin();

            M5.Lcd.clear(BLACK);
            M5.Lcd.setTextColor(YELLOW);
            M5.Lcd.setTextSize(2);
            M5.Lcd.setCursor(65, 10);
            M5.Lcd.println("GSM TEST");

            Serial2.begin(115200, SERIAL_8N1, 16, 17);

            // to power on the gsm module
            pinMode(2, OUTPUT);
            digitalWrite(2, 0);
            delay(3000);
            digitalWrite(2, 1);
            delay(1000*60);
            M5.Lcd.println("Init done!");
            }

            // Add the main program code into the continuous loop() function
            void loop() {
            if (M5.BtnA.wasReleased()) {
            get_time();
            } else if (M5.BtnB.wasReleased()) {
            M5.Lcd.clear(BLACK);
            M5.Lcd.setCursor(0, 0);
            }
            // update button state
            M5.update();
            }

            void IotWriteCommand(char cmd[],char date[])
            {
            char buf[256] = {0};
            if(cmd == NULL)
            sprintf(buf,"AT\r\n");
            else if(date == NULL)
            sprintf(buf,"AT+%s\r\n",cmd);
            else
            sprintf(buf,"AT+%s=%s\r\n",cmd,date);

            Serial2.write(buf);
            }

            //AT+CSQ=?
            void get_time(void){
            IotWriteCommand("CSQ",NULL);
            while(Serial2.available()){
            uint8_t ch = Serial2.read();
            M5.Lcd.write(ch);
            }
            }

            Z 1 Reply Last reply Reply Quote 0
            • Z Offline
              zw29 @zw29
              last edited by

              It will help a lot if M5STACK can publish more sample code in sms/mqtt communication.

              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post