Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    UART: I cannot get any reading from GPS

    Scheduled Pinned Locked Moved GPy
    gpyuartexpansion boardgps
    4 Posts 2 Posters 730 Views 2 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.
    • A Offline
      andrejpekarcik
      last edited by

      Hi,
      I connected GPS module to GPy and tried to read some data from it using UART. No success despite many attempts. Reading is always None. GPS module works perfectly as I have connected it to my computer and sends data.

      
      from machine import UART
      
      uart = UART(1, 9600)
      uart.init(9600, bits=8, parity=None, stop=1, pins=('P3','P4'))
      
      print (uart.readline())
      
      while True:
          if (uart.any()>0):
                  print ('Yra')
      

      Any help appreciated!

      Used items:
      Exp. board 3.0
      (sysname='GPy', nodename='GPy', release='1.18.0.r1', version='v1.8.6-849-9569a73 on 2018-07-20', machine='GPy with ESP32', pybytes='0.9.0')
      GPS: GP-20U7

      robert-hhR 1 Reply Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @andrejpekarcik
        last edited by robert-hh

        @andrejpekarcik how about swapping P3 and P4, either the wires or the arguments?

        from machine import UART
        
        uart = UART(1, 9600)
        uart.init(9600, bits=8, parity=None, stop=1, pins=('P3','P4'))
        
        while True:
            if (uart.any()>0):
                    print (uart.readline())
        

        or better:

        from machine import UART
        import sys
        
        uart = UART(1, 9600)
        uart.init(9600, bits=8, parity=None, stop=1, pins=('P3','P4'), timeout_chars = 10)
        
        while True:
            if (uart.any()>0):
                sys.stdout.write(uart.read().decode())
        
        A 1 Reply Last reply Reply Quote 1
        • A Offline
          andrejpekarcik
          last edited by andrejpekarcik

          Hi,

          I tried your code, same result.

          How can I test somehow if UART on GPy is working?

          1 Reply Last reply Reply Quote 0
          • A Offline
            andrejpekarcik @robert-hh
            last edited by

            @robert-hh

            Hooray! I've got it!
            Signal wire was broken between pin and GPS. Thanks.

            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
            • 1 / 1
            • First post
              Last post

            Pycom on Twitter

            Pycom