For the record, the QNEthernet library doesn’t have to use EventResponder or hook into yield(). In fact, that’s how it started out. The only thing that you need is to call Ethernet.loop() regularly. (And comment out the attachLoopToYield() call.)...
Indeed many years ago I tested almost every breadboard I could find, about 40 different models (but many were probably the same with different packaging).
BPS and Twin Industries were by far the best quality. That's why PJRC sells the BPS...
When you want to, removing a Teensy from a prototyping board can be a challenge.
There is a temptation to lift it just from one end. DO NOT DO THIS. The Teensy will likely give way quickly and pins will probably be bent.
As a better solution for...
Just to be clear, I wasn’t suggesting doing audio updating from the main loop, just sending things over Ethernet from the main loop, where the things you’re sending are buffered in the interrupt.
This is almost equivalent to hooking into yield()...
@h4yn0nnym0u5e would you then advocate for having a user call SomeLibrary.loop() inside their main program loop, plus anywhere they’d wait, instead of hooking into yield (whatever the mechanism)? (Eg. QNEthernet)
Better yet, in the interrupt, append the data you need to send to a concurrent-safe or “mutexed” queue/buffer and then in your main loop (or in a function called from your main loop), send the data you need from the queue.
The library isn’t designed to be called from within interrupts. The alternative is to set a (volatile) flag in the interrupt and then check that flag to do the operation from your main loop somewhere (and then clear the flag), i.e. not in an...
Yes, that's right. I first modified the example to do what I wanted my simple TCP server to do, and then tried to merge that functionality into the multi-tasking application, and that's when I ran into the issue related to yield().
Can you clarify: which example did what you wanted? Did it call one of the waiting functions? If so and it worked, what exactly didn’t work for you before?
My impression was that something actually didn’t work for you, as opposed to...
I think what happened is a tried an example, and since it did what I wanted, I never looked beyond it. When I download your modified code, I'll try the non-blocking functions. Thanks very much!
My view is that if you’re advanced enough to do your own cooperative task switching, you don’t actually need to use those functions in QNEthernet that use yield(). I don’t mind the change because, in theory, someone could have overridden yield()...
@joepasquariello The latest two commits in the QNEthernet library repo should address your needs. (96db12b1d and 9c572384f: https://github.com/ssilverman/QNEthernet/commits/9c572384f2998dc80883d55c02f8b23480868cfc/)
But I have a question: Why...
@joepasquariello Sure, I can call Ethernet.loop() before (or after or whatever) the yield() calls. (I think it would be interesting if there was a way I could tell if yield() was overridden.) I don’t think this will have a huge impact because use...
@joepasquariello One idea is I could add a configuration parameter that makes the user call Ethernet.loop() at the end of the main program loop() and that causes EventResponder to not be used.
It uses linker script magic to get pointers to the sections with a NULL pointer marking the end of each.
I left the rejected PR open just in case the code would be useful to someone: https://github.com/PaulStoffregen/cores/pull/734/files
I’d love to see some example code for this. Are you saying that there’s one “master override” for that startup hook, and then that main function loops through some pointers and calls each one, depending on where it is? How do you determine which...
What about those cases, for example in the QNEthernet library, where a user-called function needs to wait for something? I think it’s an appropriate use of yield() inside the “wait for condition” loop. But on the other hand, this is user-called...
That’s not quite the intent. I don’t rely on yield() being overridden; I rely on something being called regularly. It so happens that EventResponder provides that feature by making sure something is called every time loop() finishes without the...
The QNEthernet library doesn't override yield(). I hook into the EventResponder system's yield hook. Look for attachLoopToYield().
Below that code, however, is a commented-out example of how to call Ethernet.loop() from an overridden yield() on...
@shawn, thanks for the offer. It will take me a few days to get the hardware ready for you.
I will PM you once it is ready to ship.
The Single Pair Ethernet chipset is the Microchip LAN8651 10Base-T1S MAC/PHY. It talks to the Teensy via SPI...
The internal queue is a circular buffer (a vector) because then there’s no extra allocation. With a linked list, I’d have to use a pool of pre-allocated objects, and I think the implementation would be a little more complex. It sounds like doing...
Thinking aloud here… I wonder if it would be useful if I gave access to the internal queue, or if what you suggest, having a separate queue in your program, is the way to go. “UDP layer” and “application layer” being separate, etc.
Or maybe I...
Here's a tip: To access a packet's data, you don't need to copy it into a local buffer. You can simply call data() on the UDP object to access a pointer to the data, and size() to get the data size. That will save some memory and time.
I built and use the QNEthernet library for my own uses and use it in the field for streaming buffered pixel and controls data, and serving web pages for configuration. But it can do a lot more. I’m looking forward to your experiences using it for...
My suggestion is not to use the AsyncUDP_Teensy41 library plus your own buffering because the QNEthernet library already provides configurable buffering. This is, in fact, one of the reasons I don’t recommend that “async” library; when buffering...
I’m going to bookmark this thread and point to it in the future because it’s a perfect example of why including some code in one’s question will very possibly lead to a solution much more quickly.
I'm not a fan of Arduino's architecture names. My general feeling is we need to make the best of a bad situation.
Even though all the Teensy 2 and Teensy 3 hardware is discontinued, we're still publishing software support. So today we're...
I was making a PR for the Arduino_ConnectionHandler project (https://github.com/arduino-libraries/Arduino_ConnectionHandler/pull/128), and the build complained (just a warning) that AVR platforms aren't supported. That finally pushed me to write...
One basic thing I noticed is that you're accessing client.operator bool() from several different contexts. The state may be indeterminate, especially since you're copying into the object from outside the ISR with client = server.accept();, and...
Here's a minor-fix PR:
1. Make some minor fixes to CrashReport CFSR messages #716
Here's some fixes discovered with "-Wextra":
1. Fix some "cast between incompatible function types" warnings in usb_midi #694
2. Fix an "implicitly-declared copy...
The printf() functions should normally warn you when the parameter type doesn’t match, for example “%lu” and time_t, which should be “%llu”. However, the Teensyduino implementation of the Print interface (which contains a printf(), and is the one...
Sadly, our art car was destroyed on its way back from the playa this year when a drunk driver rear-ended our trailer at over 100mph. So this was its last ride. But thank you to PJRC, Teensy, OctoWS2811 and all the support over the years. It was a...
Here's a version without the VLAN processing:
// C++ includes
#include <algorithm>
#include <QNEthernet.h>
using namespace qindesign::network;
// VLAN EtherType constants
constexpr uint16_t kEtherTypeVLAN = 0x8100u;
constexpr uint16_t...
Good news is that you shouldn't have to do all this work yourself. I've designed the QNEthernet library to work without an IP stack, and with an "EthernetFrame" API similar to the "EthernetUDP" API. In other words, you can easily use the library...
First point is that the following will also work, without the use of #ifdef's:
bool poll() override {
yield();
return static_cast<bool>(server.available());
}
EthernetServer::available() returns an instance of EthernetClient. EthernetClient...