Help with the GPS module and M5Stack for AWS



  • I have an M5Stack for AWS, and I have a GPS module connected to its port C. What is the index of the HardwareSerial I should use?

    I tried from 0 to 6, but I had no luck reading the data.

    HardwareSerial GPSRaw(2);
    
    void loop() {
      if (GPSRaw.available())
      {
        int ch = GPSRaw.read();
        Serial.write(ch);
      }
    }
    

    Connection

    0_1689279562359_cca83b01-1be3-489c-90d9-b56ed0be219a-telegram-cloud-photo-size-1-5008453422650862428-y.jpg

    What I am doing wrong?



  • Hello @skhaz

    have a look at the M5Core2 GPS example. M5Core2 UART uses GPIO 13/14 whereas M5Stack uses GPIO 16/17. If GPSRaw.begin() is called w/o parameters then GPIO 16/17 are used by default. Try something like below to change the GPIOs:

    GPSRaw.begin(9600, SERIAL_8N1, 13, 14);
    

    BTW: Index 2 is fine.

    Thanks
    Felix



  • @felmue it worked flawless, thank you so much!