Hi,
We used Teensy 3.2 for years in our project, and would continue using them, unfortunately, as you know, T3.2s are not possible to get at the moment. So, given that 4.0s are still available, I wanted to try to switch.
In our sketch, we manually update stepper motors and need the loop() spinning at a high frequency to update our proprietary acceleration logic.
In the same loop, we also need to receive commands from a PC at fairly high frequency (a few dozens of HZ).
We do this on T3.2 simply by placing RawHID.recv(readBuffer, 0); in the main loop. Literally:
This used to work fine on T3.2m where RawHID.recv() takes 3-4 microseconds at 72MHz
Now, with T4, the RawHID.recv() seems to take a fixed 1000 microseconds. So, we need to figure out the way to
Not sure I fully understand what the final resolution was. Is it possible to run RawHID.recv() without that 1000us delay? Even if we throttle calling it to say 50HZ, it would still consume 5% of the entire CPU time, regardless of clock speed, and at least one cycle will be stuck, and we will get errors in other parts of our code.
I am running TD 1.56, Arduino 1.8.19
Thanks!
We used Teensy 3.2 for years in our project, and would continue using them, unfortunately, as you know, T3.2s are not possible to get at the moment. So, given that 4.0s are still available, I wanted to try to switch.
In our sketch, we manually update stepper motors and need the loop() spinning at a high frequency to update our proprietary acceleration logic.
In the same loop, we also need to receive commands from a PC at fairly high frequency (a few dozens of HZ).
We do this on T3.2 simply by placing RawHID.recv(readBuffer, 0); in the main loop. Literally:
Code:
void loop()
{
unsigned char readBuffer[64] = {0};
RawHID.recv(readBuffer, 0);
// Process buffer, update stepeprs, etc
}
Now, with T4, the RawHID.recv() seems to take a fixed 1000 microseconds. So, we need to figure out the way to
- keep the main loop running at high frequency (at least 10,000 Hz)
- make sure we do not miss commands from the PC
Not sure I fully understand what the final resolution was. Is it possible to run RawHID.recv() without that 1000us delay? Even if we throttle calling it to say 50HZ, it would still consume 5% of the entire CPU time, regardless of clock speed, and at least one cycle will be stuck, and we will get errors in other parts of our code.
I am running TD 1.56, Arduino 1.8.19
Thanks!