Is teensy threads recommended for High speed applications?

Hello, I'm currently making a program in Teensy 4.0 for an application that needs to handle some threads. One of these threads is USB serial communication (sending and receiving data via I2C, using wire.h library, wire and wire1 from a GUI), and another dedicated thread for sending and receiving digital and analog signals. In my current program, I use the teensythreads.h library to handle this, but I see some delay on external signals. Based on your experience,
Do you recommend using teensythreads to handle this heavy communication, or Do you recommend another alternative?
 
If you show your current program we may be able to make some suggestions.
It will also make more clear what you are trying to achieve.
When you post your code post it between code tags using the </> button.
 
Hello, I'm currently making a program in Teensy 4.0 for an application that needs to handle some threads. One of these threads is USB serial communication (sending and receiving data via I2C, using wire.h library, wire and wire1 from a GUI), and another dedicated thread for sending and receiving digital and analog signals. In my current program, I use the teensythreads.h library to handle this, but I see some delay on external signals. Based on your experience,
Do you recommend using teensythreads to handle this heavy communication, or Do you recommend another alternative?
Many (most?) Arduino libraries and drivers are not reentrant, so you cannot always use TeensyThreads in a preemptive mode. You must use it in a cooperative mode, which typically means define the timeslice as very long and make sure that task switches occur ONLY on command. That doesn't mean that threads are not useful, but you can't necessarily use threads to immediately switch to a high-priority thread when some event occurs. I2C is quite slow compared to the computing power of T4, so for anyone to help you, have to provide more details on what you are trying to accomplish, what you mean by "fast" or "slow", etc.
 
Back
Top