Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TinyProtocolStream - encapsulate tinyproto into Arduino Stream for ease of use #24

Open
embedded-creations opened this issue Sep 30, 2021 · 2 comments

Comments

@embedded-creations
Copy link

I need a reliable Serial connection between two Arduinos, and found your project. I created an Arduino Stream class that inherits from IFd and it's getting close to reliable at high throughput as tested through a loopback test running between two Teensy 4.1s.

https://github.com/embedded-creations/tinyproto/tree/stream

Take a look at this example to see how simple it is to use (just a few lines reference tinyproto in the sketch, and the API is nearly identical to a Stream object like Serial which makes it easy for a new user):

https://github.com/embedded-creations/tinyproto/blob/stream/examples/arduino_generic/TinyProtocolStreamTest/TinyProtocolStreamTest.ino

Some questions:

  • Would you like to include FdStream in the library once it's finished?
  • It's difficult to see the status of the library, have you thought about how to improve the API in this regard? I added a getStatus() method to access tiny_fd_get_status(), but beyond that I'd like to know if I lost any data so I can reset the protocol running on top of tinyproto.
  • Have you run any loopback tests that validate data? I didn't see any in the repo and found packets were getting dropped unless I left a couple of I slots free when running at high throughput. This may go overlooked if you're just counting packets received and not validating.
  • Do you have any Teensy devices? I'm using the Teensy 4 as it has multiple hardware serial ports, and I can enable multiple USB serial ports so I can get the tinyproto debug output on one, and sketch data on another. I had to make some HAL tweaks to get this to work, which I can contribute if it helps you.
@lexus2k
Copy link
Owner

lexus2k commented Oct 11, 2021

Hi Louis,

I'm sorry for the late reply, was too busy.
Thank you for the interest to the library. I'm really appreciate your help. Of course, you did the great job.
Answering to you questions,

Would you like to include FdStream in the library once it's finished?

Yes, it is the good idea to integrate your changes to tinyproto library. However, we need to be very careful, since the tinyproto library is used not only in Arduino environment.

It's difficult to see the status of the library, have you thought about how to improve the API in this regard? I added a getStatus() method to access tiny_fd_get_status(), but beyond that I'd like to know if I lost any data so I can reset the protocol running on top of tinyproto.

Absolutely agree with you, I have idea to capture the protocol statistics, and to make it available via some API for a applications.

Have you run any loopback tests that validate data? I didn't see any in the repo and found packets were getting dropped unless I left a couple of I slots free when running at high throughput. This may go overlooked if you're just counting packets received and not validating.

The library does not have any stress tests for now, but it have numerous checks for each commit.
With every commit, the CircleCI subsystem runs

  1. throughput tests via virtual sockets. You can find those in the .travis/run_tests.sh shell script.
  2. unit tests, which check only packets loss.

But both these checks must be as quick as possible (CircleCI has limit of 10 minutes for the operation).
And yes, the it is good idea to implement stress tests in some script and run them manually from time to time.

Do you have any Teensy devices? I'm using the Teensy 4 as it has multiple hardware serial ports, and I can enable multiple USB serial ports so I can get the tinyproto debug output on one, and sketch data on another. I had to make some HAL tweaks to get this to work, which I can contribute if it helps you.

No, I don't have that one. I have ESP32, which allows to implement similar setup. But it is not the problem, I can order Teensy boards from Aliexpress (it will take some time before the boards will be delivered). All I need to know is description of your setup, maybe some picture of how the boards are inter-connected.

@embedded-creations
Copy link
Author

Glad to hear you're interested in integrating this new feature into tinyproto. Although there is still work to be done (listed in the "TODOs" section in the README on my fork), it's currently functional enough to test and to discuss how to integrate it. Please let me know your thoughts when you've taken a look.

If you don't have a Teensy it's not necessary to get one, I just think it's convenient for debugging as it has multiple USB and hardware serial ports, and compiling and programming is very fast. I used a Teensy 4.1 for my testing, but a Teensy 4.0 should work just as well. A Teensy 3.2/3.5/3.6 probably would work well if it's easier to source. They're manufactured in the US and their list of worldwide distributors is available here:

https://www.pjrc.com/store/

I also have multiple ESP32s, but so far have only tested tinyproto on a single ESP32 connected to a Teensy 4.1. I don't think pictures are necessary, I just have three wires for GND/TX/RX connected between the two boards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants