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 Buffer too small/slow?

    Scheduled Pinned Locked Moved LoPy
    uart
    3 Posts 2 Posters 684 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
      Avathar
      last edited by

      Hi!

      I'm using a Lopy1 with the latest 1.18.1 firmware for a little work project, where i'm reading doserate and spectral data from a measuring device.
      The probe is connected via UART, with 19200 baud. Every 10 seconds it sends a data string with 80 bytes and every 5 minutes i get spectral data in binary format, which is 2048bytes long.

      The small data packages are no problem, but when i receive a big message, only part of the message, about 500bytes, is read.
      I've tried several ways, using

      • readline
      • readinto using a bytearray
      • read every byte at once with read(1)
      • ....

      This seems to be also connected somehow to https://forum.pycom.io/topic/2595/uart-rx-buffer-issue-after-buffer-overflow/8 but i'm not sure. Nevertheless, uart.any() does not seem to report the correct values.

      I also read, that in micropython it's possible to define the read_into_buf for a uart connection, but this does not seem possible with the current pycom firmware.

      With another adafruit microcontroller and connected to the PC the probe works fine. Can you give me any hints on solving this problem or is this a limitiation of this board?

      Thanks!

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

        I am just guessing now, but maybe this is worth a try...

        In https://github.com/pycom/pycom-micropython-sigfox/blob/master/esp32/mods/machuart.c there is a constant that looks like the UART RX buffer size and the value is 512. Don´t know if changing this value will solve your problem, but I think it is worth a try!

        Johan

        1 Reply Last reply Reply Quote 3
        • A Offline
          Avathar
          last edited by

          Big Thanks for the hint!

          I compiled the firmware with a buffer_len of 4096 instead of 512 and it seems to be working now.
          At least it says it reads the correct number of bytes. I still have to verify the data ;)

          1 Reply Last reply Reply Quote 1

          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