@PaulStoffregen Setting up a new MacMini M4 for my shop computer. Getting the same error as the first post. I didn't need to add Rosetta (that I remember) for my M3 MacBook Pro. Is Rosetta still needed? Downloaded the 64 bit image of Arduino...
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...
Yes. Would be instructive to see how that's done.
Down in the shop, all the timing indications show "things are fine", but the syncing is most definitely erratic. Sync every once in a while is not good enough. So I'd like somehow to...
I added a 4" diameter disk, about 1/2" thick, coaxial with the bore of the timing pulley. Was good enough to drive the resonance from about 1200 RPM to over 2200 RPM, which was good enough for my application. (Max spindle speed on my lathe is...
Me too.;)
Mid-band resonance sounded like there was gravel in my gearbox, it really sounded terrible, like things were irreparably broken. In my case, I pushed mid-band resonance to a higher frequency by increasing the inertial load on the...
EncSim has a typo? in one of it's whatevers. Methods?
tachsim.setContinuousMode( true ); <=== won't compile. Compiler suggests setContinousMode
tachsim.setContinousMode( true ); will compile
Steppers behave funky, even with some load. I have seen this on my electronic lead screw on my lathe. I'm using 4 microsteps/step. The even microsteps are different in size than the odd. That's just how the stepper driver is. I can't do...
I need to return to this. I can try this code on a spare Teensy4.1 with a screw terminal test board. I'm trying to rule out whether EncoderTool on my ELS project is slipping counts. It's going to be a bear to shoehorn in. Not sure if the...
The program below is one that I wrote to test both EncSim and QuadEncoder. The encoder simulation uses pins 0,1,2 (outputs), and those must be looped to pins 3,4,5 (inputs) for QuadEncoder. The simulated encoder is set to 1200 PPR by default, and...
Trying to understand whether this library is suitable for what I have in mind. Simple questions, I hope.
Does quad encoder count on every edge of A and B? Or really only on a single edge of A? From reading the source files it wasn't clear to...
Yes, and yes.
Not really. I don't know the spindle RPM, it is computed from the encoder counts in a time interval, and the spindle RPM can depend on lathe motor load, or the whim of an operator. For all I know, the RPM is wowing, but my...
I'm sampling multiple things, angular position, aka the spindle, and linear position in Z. When the lead screw clutch is engaged the Z position has to follow exactly the spindle angular position. Yes, I'm taking advantage of the Z carriage...
Thanks for the suggestions. Will try to make something workable from it. Obviously will require a lot more planning than my previous ad hoc methodology. I'll have to think long and hard about what the bounds are for data or state transitions...
If I can't output to USB, then how do I log a "reasonable" amount of data? If I can only log at acoustic coupler rates (an exageration, but) and I'm running a system at 27 KHz, am I not running blind? How do I know I went from one state to...
Yes. The decision is dependent on the settings made by the operator, different feed rates or threads change the timing.
I did experiments in the beginning to ensure the algorithm could run up to 5000 RPM. My lathe (more importantly, my lathe...
At the moment, I can't see how to integrate the Bresenham algorithm, which is an integral part of what I need to do. Just knowing the count isn't good enough... I need to generate stepper pulses at exactly the right time, every time. Also have...
Yes. It is executed in integer math, very fast.
Not quite. I use every state change as a count, to determine when to step the motor. So I get a resolution of 4096 counts in a single rotation of the spindle.
Knowing where I am does help if...
I came to the same conclusion. I can't use USB communication if I'm doing something with interrupts with critical timing.
Understand that you've gone too far to change now, but this can be done with quadrature counting in hardware. Instead of...
To sort of answer the original question - I have managed to send a sustained 32 Mbits/s to the teensy over ethernet using the asyncTCP library, in testing I could push it up to around 50 without issues. This is receiving rather than sending so a...
I reviewed QuadEncoder again. Can't use it as is, as it breaks my entire software architecture. But I still will look at it to see if there's a non complex method to adapt it's use. At the moment, I'm having a tough time disconnecting from my...
Thanks for your helpful response. It gives me an idea of what to expect, at least for receive. I've done both ends of a client server in C long ago, lots of ACK'ing etc.
I could change things, sometimes that HAS to happen.
I know all about clough42, I was going to implement his system during the pandemic. But the TI control boards were unavailable for over 12 months due to supply chain disruptions, After...
uint32_t status, cyccnt=ARM_DWT_CYCCNT;
do {
USB1_USBCMD |= USB_USBCMD_ATDTW;
status = USB1_ENDPTSTATUS;
} while (!(USB1_USBCMD & USB_USBCMD_ATDTW) && (ARM_DWT_CYCCNT - cyccnt < 2400));
The way I...
Well, one place is usb.c, another is usb_serial.c I am running 1.58.1.
In usb.c there is
static void schedule_transfer(endpoint_t *endpoint, uint32_t epmask, transfer_t *transfer)
{
// when we stop at 6, why is the last transfer missing...
If QuadEncoder was 64 bit, and it allowed me to execute the Bresenham algorithm inside it, that would be great. 64 bits will never overflow in my lifetime, 32 bit, will in under a day. It's hard (for me) to debug unsigned arithmetic errors...
As I recall USB is fastest. But in usb.c and associated files, there is considerable amount of blocking, with ISR's globally blocked. I cannot have my ISR's blocked or I lose control of a machine. I may be interpreting things incorrectly, but...
I have a data logging problem, but it's really a debugging problem. I'm trying to find unexpected behavior (which I get every few days) and log a lot of data to find the problem. USB isn't so great for this, as there's a bit of blocking, at...
My Mac Book Pro M3 connects to Teensy 4.1 just fine. Some cables are charge only, they will not connect. Some cables seem to wear out, so I just replace them.
Solved my main issue by blocking display updates during a critical time, namely the synchronization period. I blank the updates for two revolutions of the spindle. Also elevated the priority of some interrupts. That helped a lot.
Thanks. Hmm, I'm getting impacted in my control loop by even updating the RPM, which is several milliseconds. 10's of milliseconds corresponds to a huge phase error. Definitely need to look into DMA, as long loop times give the motor control...
Thanks for responding.
For SPI being polled, can I interrupt it? Can any level interrupt it? Even 128?
For the DMA mode, then, right now it's just refreshing the whole screen? Rather than computing a clip window and all that byte skipping...
Not sure I understand fully the implications of using this library, so I have a couple of questions. @KurtE I'd appreciate your input, or anyone else who knows.
In non-DMA mode, is SPI running in a polled mode, or interrupt driven? I don't see...
My best RiseTime with Teensy4 and parallel GPIO Output is 960ps. Square frequency is 100KHz and CPU 600MHz.
I have connected four GPIO outputs in parallel via 51R resistor.
My code..
// 100KHz Square signal on Teensy4 with 4 Outs
const int...
I think there's an issue with my IRQ priorities for my Teensy4.1 based lathe controller. Seems that the ILI9341 display updates are the same priority as everything else. At least for my motor controlling, that's not good, as I am getting...
Some of my issues were self induced. I introduced a bug in my code which prevented an exponential ramp to stop. Fixed that. Found that doing a getTextBounds was quite expensive, to do every change, so I eliminated that along with a fillRect of...
I'm going to reopen this thread. I have an intermittent fault, which may or may not be display related. I have implemented a thread to stop algorithm, on my electronic lead screw. I am getting an intermittent delay after synchronization, which...
Since you only have one index pulse per revolution, and a presumed measurement interval of one second, the minimum RPM you can measure is 60, since that's 1 rev/second. If you want to measure lower RPM, you need more pulses per rev, or a longer...
FreqMeasure will give you the revolutions per second. For RPM you need to multiply it by 60.
I made my own Electronic Lead Screw controller using a Teensy4.1 and the ILI9341. I use the 1024 PPR quadrature encoder high speed output and simply...
It's not a bad idea. USB is pretty quick, and available on my laptop. My laptop only has a wireless ethernet interface, but I could get a dongle to get wired Ethernet.
Currently my board and display are in a printed enclosure, and sealed up...
With my current build, there are no serial outputs in an ISR except for a serious fault condition, (missing a count) which has never occurred in 18 months. So now, there are no serial outputs in an ISR under normal operation. All my serial...
Having the serial output, did prove to me the ISR was working as designed, at least at lower data rates. But pushing 4MB through the interface at high speeds did prove to be an undoing. I've tried not to put in printf statements in ISR's, for...
I generally drop it into a spreadsheet, ensuring the address columns are set to text (mayhem ensues otherwise), then filter and sort as needed. It’s not easy, though :mad:
Yes, definitely avoid serial output from within an ISR. Even sprintf...
Even if my logic is faulty, I may have stumbled on an answer. When I searched the objdump file, I see that the closest human readable descriptor indicates it may be related to _svfprintf_r. Whether that is true or not, it triggered a thought...
I did an objdump, which is somewhat useful. Set demangling, disassembly, line number and source flags.
[arm/bin] $ ./arm-none-eabi-objdump -C -d -l -S...