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 HANG

    Scheduled Pinned Locked Moved LoPy
    10 Posts 4 Posters 2.6k Views 5 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.
    • J Offline
      jobbyworld
      last edited by

      Hello,
      Dear micropythonist,
      I wan't to read continually UART 1 but uart hang
      Try to call idle, sleep
      Using select.poll don't work more.
      Thanks !!

      com = UART(1,pins=("G23","G24"))
      while 1:
      ... print(com.readline())
      ... sleep_ms(500)
      ...
      ...
      ...
      b'RMC,100605.000,A,4935.9761,N,00106.8144,E,1.22,8.53,221016,,,A69\r\n'
      b'$GPVTG,8.53,T,,M,1.22,N,2.26,K,A
      34\r\n'
      b',,3.65,2.04,3.02*0E\r\n'
      b'$GP763,N,00106.8144,E,1,05,2.04,85.7,M,47.1,M,,58\r\n'
      b'$GPGSA,A,3,27,16,10,11,08,,,,,,,,3.65,2.04,3.02
      0E\r\n'
      b'$GPRMC,100606.000,A,4935.9'
      None
      None
      None

      1 Reply Last reply Reply Quote 0
      • D Offline
        daniel
        last edited by

        Hello jobbyworld,

        Could you please post the full script that reproduces your problem (using markdown please)? Thanks.

        Cheers,
        Daniel

        1 Reply Last reply Reply Quote 0
        • J Offline
          jobbyworld
          last edited by

          I have a gps connect to G23 G24 which sends trame every second.

          from machine import UART
          from time import sleep_ms
          com = UART(1, baudrate=9600, bits=8, parity=None, stop=1,pins=("G23","G24"))
          >>> for i in range(10):
          ...     print(com.readline())
          ...     sleep_ms(1000)
          ...     
          ...     
          ... 
          b',,,D*61\r\n'
          b'$GPVTG,239.25,T,,M,0.56,N,1.04,K,D*31\r\n'
          b'64,1.35,0.92*03\r\n'
          b'$GPRMC,230234.000,A,4935.9669,N,00106.8135,E,0.56,239.25,251016,294.47,251016,,,D*61\r\n'
          b'$GPVTG,294.47,T,,M,0.33,N,0.60,K,D*32\r\n'
          b'$GPGGA,230244.000,4935.9230243.000,A,4935.9686,N,00106.8116,E,0.3'
          None
          None
          None
          None
          >>> 
          

          I think my loop block update of incomming data from UART
          Perhaps i missed a function (idle?)
          Or there is some interference between rgbled and uart?
          Cheers.

          1 Reply Last reply Reply Quote 0
          • D Offline
            daniel
            last edited by

            Yes, it's probably interference caused by the RGB led. We have updated the docs to mentions this:

            https://docs.pycom.io/lopy/lopy/quickref.html

            Pin P2 (G23) is also connected to the LED. Please try to use a different pin and let us know if the results change. Thanks.

            Cheers,
            Daniel

            bmarkusB J 2 Replies Last reply Reply Quote 0
            • bmarkusB Offline
              bmarkus @daniel
              last edited by bmarkus

              @daniel said in UART HANG:

              Yes, it's probably interference caused by the RGB led. We have updated the docs to mentions this:

              https://docs.pycom.io/lopy/lopy/quickref.html

              Pin P2 (G23) is also connected to the LED. Please try to use a different pin and let us know if the results change. Thanks.

              Cheers,
              Daniel

              There are few typos in Warning:

              as this pins are used byt the SPI bus -> as these pins are used by the SPI bus

              1 Reply Last reply Reply Quote 0
              • J Offline
                jobbyworld @daniel
                last edited by

                @daniel
                First I remove the four jumper of the Expansion Board :
                TX, RTS, RX, CTS
                With UART(0,9600) (P0,P1) the problem is fixed, thanks.
                Thanks for solution.

                But i tried to use other UART port.
                Which pins are safe to use with Expansion Board :
                I've try G3 G4, but my (second) board don't appreciate : i realize probably one of this pins is connected to vbat ?
                Now all my UART(1) seem didn't work.
                Any chance to rescue them ?
                Thanks anyway.
                Cheers

                1 Reply Last reply Reply Quote 0
                • D Offline
                  daniel
                  last edited by

                  @jobbyworld

                  Can you try with G22 and G17? I don't think your hardware is damaged. G3 is connected to VBAT via a resistor divider, so ti should be OK.

                  Cheers,
                  Daniel

                  1 Reply Last reply Reply Quote 0
                  • S Offline
                    SmileyChris
                    last edited by

                    Hi Daniel -- this looks like the same issue I'm having.

                    I was also trying the 'G23', 'G24' pins because I found them in forum here for UART1. Probably this post :P
                    I tried your recommended 'G22', 'G17' pins and the issue is still the same (except it doesn't mess with the rgb led any more).

                    The "hang" seems to be related with input from UART0. If I send any character over the primary uart (0) channel then the UART1 reads again (until its buffer is full, then it stops again until another character is read)

                    J 1 Reply Last reply Reply Quote 0
                    • J Offline
                      jobbyworld @SmileyChris
                      last edited by

                      @SmileyChris
                      Hi I confirm the hangs, i use UART(1) for dupterm :

                      import os
                      from machine import UART
                      uartTerm = UART(1, baudrate=115200,pins=("G16","G17"))
                      os.dupterm(uartTerm)
                      

                      when i enter some keys on term, this keys are display only when some data are received in UART(0).
                      I will test with next firmware.
                      Cheers.

                      J 1 Reply Last reply Reply Quote 0
                      • J Offline
                        jobbyworld @jobbyworld
                        last edited by

                        @jobbyworld said in UART HANG:

                        I will test with next firmware.

                        Seems fixed in 0.9.3.b1
                        Cheers

                        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