Giter Club home page Giter Club logo

Comments (16)

lloydroc avatar lloydroc commented on September 28, 2024 1

The PR seems to be working for me. Here is an example of the worst case scenario:

Nov 24 15:23:42 pi1 e32[27060]: e32_poll_gpio_aux: transition from IDLE to RX state
Nov 24 15:23:42 pi1 e32[27060]: e32_poll_input_disable
Nov 24 15:23:42 pi1 e32[27060]: e32_poll_uart: received 8 bytes for a total of 8 bytes from uart
Nov 24 15:23:42 pi1 e32[27060]: e32_poll_uart: received 8 bytes for a total of 16 bytes from uart
Nov 24 15:23:42 pi1 e32[27060]: e32_poll_uart: received 8 bytes for a total of 24 bytes from uart
Nov 24 15:23:42 pi1 e32[27060]: e32_poll_gpio_aux: transition from RX to IDLE state
Nov 24 15:23:42 pi1 e32[27060]: e32_poll_gpio_aux: additional sleep for uart buffered data
Nov 24 15:23:42 pi1 e32[27060]: e32_poll_gpio_aux: received 7 bytes for a total of 31 bytes from uart

from ebyte-sx1276.

renanqts avatar renanqts commented on September 28, 2024

I was debugging it, this is an issue introduced in 37bf0ef
as the line removed in this commit says, it requires to sleep a bit

    /* we need to sleep and read from the uart again as remaining
      * bytes are not ready until AFTER the AUX pin transitions from
      * low to high. If we don't do this we will leave bytes in the
      * buffer
      */
    usleep(54000);

from ebyte-sx1276.

lloydroc avatar lloydroc commented on September 28, 2024

@renanqts sorry to hear you're having this issue. I've seen an issue similar to this on one ONLY on my Raspberry Pi B+ and not on a Pi Zero or Pi 4. The problem as far as I remember is it should be buffering 1 byte and not 8 bytes at a time. So it leaves the remainder modulus 8 out. I will try to confirm it but I was only able to reproduce it on a B+. Give me a couple days and I'll see if I can reproduce it. Just to confirm adding that sleep back has resolved your issue?

from ebyte-sx1276.

renanqts avatar renanqts commented on September 28, 2024

Hey @lloydroc

Yes, it solved the issue including the lines back.
I'm Pi 3 B+, probably that is why.
Sure, take your time. No rush here :D

from ebyte-sx1276.

lloydroc avatar lloydroc commented on September 28, 2024

For example here are the logs in my Pi 4, it will not buffer the 8 bytes and you can see it is 1 byte. That delay is not present. Not sure why that delay would fix it.

pi@raspberrypi:/var/log $ journalctl -u e32
-- Logs begin at Tue 2021-08-17 21:30:19 MDT, end at Fri 2021-11-19 17:35:52 MST. --
Aug 17 21:30:19 raspberrypi e32[19855]: e32_poll_gpio_aux: transition from RX to IDLE state
Aug 17 21:30:19 raspberrypi e32[19855]: e32_poll_gpio_aux: received 0 bytes for a total of 10 bytes from uart
Aug 17 21:30:19 raspberrypi e32[19855]: e32_poll_input_enable
Aug 17 21:30:29 raspberrypi e32[19855]: e32_poll_gpio_aux: transition from IDLE to RX state
Aug 17 21:30:29 raspberrypi e32[19855]: e32_poll_input_disable
Aug 17 21:30:29 raspberrypi e32[19855]: e32_poll_uart: received 1 bytes for a total of 1 bytes from uart
Aug 17 21:30:29 raspberrypi e32[19855]: e32_poll_uart: received 1 bytes for a total of 2 bytes from uart
Aug 17 21:30:29 raspberrypi e32[19855]: e32_poll_uart: received 1 bytes for a total of 3 bytes from uart
Aug 17 21:30:29 raspberrypi e32[19855]: e32_poll_uart: received 1 bytes for a total of 4 bytes from uart
Aug 17 21:30:29 raspberrypi e32[19855]: e32_poll_uart: received 1 bytes for a total of 5 bytes from uart
Aug 17 21:30:29 raspberrypi e32[19855]: e32_poll_uart: received 1 bytes for a total of 6 bytes from uart
Aug 17 21:30:29 raspberrypi e32[19855]: e32_poll_uart: received 1 bytes for a total of 7 bytes from uart
Aug 17 21:30:29 raspberrypi e32[19855]: e32_poll_uart: received 1 bytes for a total of 8 bytes from uart

from ebyte-sx1276.

renanqts avatar renanqts commented on September 28, 2024

As far as I understood, the data is not there when the line is executed, meaning that the delay waits a bit for it.
I just didn't get where these 8 bytes come from. Is this internally in the library? At least I didn't see it there.

from ebyte-sx1276.

lloydroc avatar lloydroc commented on September 28, 2024

Good find! When I send 18 bytes I actually do see 8+8+2 coming in. Before I thought the 2 additional bytes wouldn't come in until there were 6 more to make it 8.

Nov 20 07:57:27 pi1 e32[20667]: e32_poll_gpio_aux: transition from IDLE to RX state
Nov 20 07:57:27 pi1 e32[20667]: e32_poll_input_disable
Nov 20 07:57:27 pi1 e32[20667]: e32_poll_uart: received 8 bytes for a total of 8 bytes from uart
Nov 20 07:57:27 pi1 e32[20667]: e32_poll_uart: received 8 bytes for a total of 16 bytes from uart
Nov 20 07:57:27 pi1 e32[20667]: e32_poll_gpio_aux: transition from RX to IDLE state
Nov 20 07:57:27 pi1 e32[20667]: e32_poll_gpio_aux: received 0 bytes for a total of 16 bytes from uart
Nov 20 07:57:27 pi1 e32[20667]: e32_poll_input_enable
Nov 20 07:57:27 pi1 e32[20667]: e32_poll_uart: received 2 bytes for a total of 18 bytes from uart

Will need to add a fix for this. It only seems to happen this way in the B+. Not sure yet if the sleep should be added always (for all Raspberry Pi Models) or just when we are buffering >1 bytes. I really don't like adding in unnecessary sleeps when we don't have to.

from ebyte-sx1276.

renanqts avatar renanqts commented on September 28, 2024

I would just add it when finding multiples of 8

from ebyte-sx1276.

renanqts avatar renanqts commented on September 28, 2024

@lloydroc should I send this PR?

from ebyte-sx1276.

lloydroc avatar lloydroc commented on September 28, 2024

from ebyte-sx1276.

renanqts avatar renanqts commented on September 28, 2024

yes, I thought this should the one

from ebyte-sx1276.

lloydroc avatar lloydroc commented on September 28, 2024

from ebyte-sx1276.

lloydroc avatar lloydroc commented on September 28, 2024

I created a branch and will send a PR shortly need to do some testing with the RPI models I have.

from ebyte-sx1276.

lloydroc avatar lloydroc commented on September 28, 2024

#16

from ebyte-sx1276.

renanqts avatar renanqts commented on September 28, 2024

I will give a try

from ebyte-sx1276.

lloydroc avatar lloydroc commented on September 28, 2024

PR 16 above addresses the issue.

from ebyte-sx1276.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.