🤖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

    Units
    2
    3
    547
    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
      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
        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
          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
          • First post
            Last post