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

    M5stack GPS, use Serial2 and Serial1

    Scheduled Pinned Locked Moved Units
    3 Posts 2 Posters 2.1k Views
    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.
    • H Offline
      HappyUser
      last edited by

      This device : ATOMIC GPS Base (M8030-KT) uses Serial2 to communicate with the GPS chip.
      Now i am trying to use Serial1.begin(19200, SERIAL_8N1, 32, 26) to communicate with another device.
      I know that this device is working, i have tested it with master module.
      I have also switche TX and RX ports. Still no respond from the slave.

      So i was wondering, is it possible to use Serial1 on M5atom lite with the 32 and 26 ports?
      Thanks

      felmueF 1 Reply Last reply Reply Quote 0
      • felmueF Offline
        felmue @HappyUser
        last edited by felmue

        Hello @HappyUser

        have you tried directly looping back TX into RX? E.g. connect G26 to G32? Then try withsomething like this in the loop():

          static uint32_t lastTime = 0;
          if(millis() - lastTime > 5000)
          {
            lastTime = millis();
            Serial1.println("hello");
          }
          if(Serial1.available() > 0)
          {
            while(Serial1.available() > 0)
            {
              Serial.print(Serial1.readStringUntil('\n'));
            }
            Serial.println();
          }
        

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        H 1 Reply Last reply Reply Quote 0
        • H Offline
          HappyUser @felmue
          last edited by

          @felmue said in M5stack GPS, use Serial2 and Serial1:

          Well, now i need to recheck what i have been doing.
          Your example works both on M5Stick (using ports 0 and 26) and M5Atom (ports 26 and 32).

          Thank you, i have some work to do, Ha Ha

          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