When you write to Serial (USB), interrupts will occasionally be disabled. I don't know for how long, but maybe long enough to occasionally miss an edge with Encoder? QuadEncoder keeps count in hardware, so it's using much less CPU and won't miss...
That doesn't necessarily mean that the Encoder library lost a count. Let's say that when you start the motion, the encoder position is right at the edge of a pulse. If you tell the stepper to go 10 revolutions forward and back, the encoder won't...
So I rewrote my code. Primarily to make it explicit what was happening. I seem to not get any errors. However, I changed a bunch of things, including the stepper driver code. To make myself feel that I haven't pulled the wool over my own...
If Serial6 interrupts are interfering with another interrupt, have you tried setting that interrupt to a higher priority? Or can you tell us why Serial6 is a problem?
You said 8200 versus the expected 8192, which is exactly 8 = 2 full steps. Try doing 1599 steps in each direction and see if you get 8192. I’ve been using QuadEncoder for years, and TTBOMK it has always been perfect, never over or under.
I have no idea how accurate it is, but if you ask claude.ai "what are the differences between the malloc implementations in newlib and nano-lib?", it gives you a plausible answer.
This has been asked before, at least a few times, if not many. See the thread below. Google works much better than forum search. My search phrase was "Teensy code in flash by default"...
Thanks to the wonderful culture of folks' here I was able to put together a fully functional standalone CP/M-80 version 2.2 machine using Teensy 4.1. None of the host teensy code is visible, it boots Z80/8080 code like a 1978 machine, with all of...
I'd be totally flattered if you had one of my boards. I have 10 version 3 boards, with repaired LPT ports, Im working on the last missing feature (keyboard scan code maps) likely needed for people using not-my-keyboard, no big deal, done in a day...
The reason you're having trouble is because you're trying to write a C string with EEPROM.put(), but the variable you're using to hold the string, and the size of that variable, are not correct. C strings are tricky. When you want to assign a...
TEENSY64 is a Commodore C64 emulation that runs on T3.6, by Frank Boesing. If you are running that emulation you would un-comment the #define TEENSY64. After that, the conditional logic means:
if (T3.6 and NOT running TEENSY64)
use these...
preAllocate() takes a while to run. I don't know of any way to reduce it, so I think you just have to accept that there is a short period of preparation before logging begins.
The warning in your little atof() program just means that you are computing "x", but not using it anywhere. The program below uses "x" in a print statement, which also resolves the missing _write(). I haven't run this program on 3.2, but I'm...
Assuming the rest of your code is okay, try using two pins that are both on the same FlexPWM module and sub-module. I think that would give you best possibility of synchronization. For example, pins 6 and 9 or pins 7 and 8, as shown below. Please...
Yes, I’ve done a lot of benchmarking on this, and as long as your data rate is well below the max of about 20 MB/s, calls to write() return in less than 5 us, which is fantastic. A number that’s easy to remember is 1 MB/s with only 1% of CPU. My...
I wanted to mention that the way you’re doing the SD logging is great. Did you start from the TeensySDIOLogger example? I always point to that as best practice for logging to SD.
Isn't it the timing of the data collection that matters? As long as you are reading data via CAN every 1 ms as precisely as possible, and you are completing the filtering and logging within the 1-ms data cycle, jitter in the filtering and logging...
Section 42.4.3 USB Power Control in the reference manual might get you started. You could also search the forum for power-related questions generally. I remember there being posts about trying to reduce power on T4, but not about USB power...
Okay, that's good. I think you mean 120 deg, which is what the simple example program does. It's been a while, but I have run this example and viewed all 6 channels with a scope, and they do exactly what you want. In this example, all of the pins...
The C++ standard library has some support for complex numbers. I've never used it before, but here is a quick example. You'll have to experiment from here, or perhaps others that have used it more will reply. You can also use <float> rather than...
Sorry, you're going to have say more. You downloaded (DL) from github (GH) an old version? Of what?
It you want to generate complementary PWM with deadtime, you can't just change the pins to whatever you want. You must use pins that are...
You've got a warning there, which is not an error, and the other info indicates that the build is completing. When you say "it won't run", what do you mean? What happens?
Following up on this, I added the function call below to my T4.1 code after closing an SD file. This makes the file "visible" to Windows Explorer (after I press F5).
MTP.send_DeviceResetEvent(); // send reset event to PC for refresh
I haven't used, but it sounds like it would be useful to run it when you want to be sure that the host is seeing the latest data. For example, let's say you write a file to SD on the Teensy, from what you're saying it sounds like calling...
When you post code, please use the </> button to keep the formatting.
I've never used the MCP23017 library, but I installed it and looked at the button (input) example. It uses the code shown below for enabling pull-ups. You are configuring your...
The flashloader library shows every sign of having been hacked together to fill an immediate need, without ever being properly finished ;). We've all been there ...
Unfortunately @joepasquariello hasn't quite finished the job, so the above...
The library seems to only be able to load samples into PSRAM, but not delete them. I haven't used this library, but here is something you can try.
The library example contains this code to create flashloader and load a sample into PSRAM...
Here is a modified version with an IntervalTimer configured for 10 kHz. The timer handler reads the encoder, computes the delta since the previous read, and updates a running sum. The number of interrupts and the running sum of encoder counts are...
Okay, pilot error on my part. The wiring should be pins 0,1,2 (EncSim outputs) to pins 4,5,6 (QuadEncoder inputs). The comments in the program are correct about that. I always get confused about the first argument in the QuadEncoder constructor...
I haven't run the program in a long time, but it seems like if the frequency is 27 kHz, and the count is being read at 1 kHz, then the delta should be about 27. I'll try to set it up on my bench tomorrow.
Yes, EncSim has a type on the word "continuous". Yes, the use of millis() or elapsedMillis yields only an approximate time, so you will get slight differences in the counts. Your delta count values look like negative numbers, so try entering a...