Search results

  1. C

    Issue with Stepper Motor with Builtin Decoder

    @mjs513 I'm apparently more confused then you. This program works as expected. #include "QuadEncoder.h" uint32_t mCurPosValue; uint32_t old_position = 0; uint32_t mCurPosValue1; uint32_t old_position1 = 0; QuadEncoder myEnc1(1, 0, 1, 0, 4); // Encoder on channel 1 of 4 available...
  2. C

    Issue with Stepper Motor with Builtin Decoder

    Is this the correct way to reverse the count direction? myEnc.setInitConfig(); myEnc.init(); //myEnc.write(initvalue); // just because Serial.printf("\nUsing HW encoder\n"); //myEnc.printConfig(&myEnc.EncConfig); myEnc.EncConfig.enableReverseDirection = true; //...
  3. C

    Issue with Stepper Motor with Builtin Decoder

    Thanks. Now I have the initial settings. enableReverseDirection: 0 decoderWorkMode: 0 HOMETriggerMode: 0 INDEXTriggerMode: 0 IndexTrigger: 0 HomeTrigger: 0 clearCounter: 0 clearHoldCounter: 0 filterCount: 0 filterSamplePeriod: 0 positionCompareValue: ffffffff revolutionCountCondition: 0...
  4. C

    Issue with Stepper Motor with Builtin Decoder

    More fundamental question, how do I invoke void QuadEncoder::printConfig(enc_config_t *config)? QuadEncoder myEnc(1, A, B, 0, IDX); // HW spindle encoder myEnc.setInitConfig(); myEnc.init(); myEnc.write(16384*4); myEnc.printConfig(&config); // ??? // want to print out all the settings, so I...
  5. C

    Issue with Stepper Motor with Builtin Decoder

    Hmm, these encoders behave differently and making things hard to compare. The SW encoder counts position from t=0. The HW encoder is doing something different. My experiment is to have 10 revs forward, and 11 revs backwards. With an ideal stepper, the motor should return to the same angular...
  6. C

    Issue with Stepper Motor with Builtin Decoder

    With the trials I have been doing, (USB Serial off during acquisition) it seems that the HW encoder never seems to lose or gain counts, but the SW encoder may be +/- 1. Usually get 0 or +1. Basically these results are inconclusive, not sure if there's an issue or not. It is curious that the...
  7. C

    Issue with Stepper Motor with Builtin Decoder

    Decent idea, but hard for me to implement. I'd need to procure timing pulleys, source a new belt and machine a new mounting plate. Previously I printed a plate to hold the motor and encoder. It wasn't rigid enough and I got more counts. My aluminum plate is much more rigid.
  8. C

    Issue with Stepper Motor with Builtin Decoder

    Good point. My arch nemesis SerialUSB. That bit of code (SerialUSB) is poorly behaved. I'm waiting for my FTDI cable to arrive, to dump that to the curb. I'll try that. Edit: Gained a count. Initial 16384, Final 16385.
  9. C

    Issue with Stepper Motor with Builtin Decoder

    Post #29 is 10 cycles of 10 revs forward, then 10 revs back. That's +/-1 count. I tried 10 cycles of 15 revs forward then 15 cycles back, and got 16386 counts with the SW encoder. HW encoder is always 16384. Well the thing is, if I repeat the SW test, it's sometimes 16384. Tests are...
  10. C

    Issue with Stepper Motor with Builtin Decoder

    Seems that the SW encoder has lost a count. Using SW encoder Initial position = 16384 Number of revolutions before reversal = 10 Pulse Repetition Interval = 180 microseconds Full steps per revolution = 200 Micro-steps/full step = 4 Repetitions of the test = 10 Steps/sec = 5555.556 Delay...
  11. C

    Issue with Stepper Motor with Builtin Decoder

    Ok, here's a version with both encoders. But one needs to compile the option, one vs the other. Just comment out the #define HW 1 or #undef HW statement. Luni's encoder behaves a lot different, and I can't explain why right now. I get zero output with QuadEncoder but voluminous output with...
  12. C

    Issue with Stepper Motor with Builtin Decoder

    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 eyes, I will put in Luni's SW encoder, and I should...
  13. C

    Issue with Stepper Motor with Builtin Decoder

    Good point. That fact got past me. Sometimes it's not quite that neat, but this time it was either 8199 or 8200. I'll try that. Maybe today will bring fresh new insights! Is there a way on quad encoder to get an interrupt on the index pulse so I can check the count value at the index? It...
  14. C

    Issue with Stepper Motor with Builtin Decoder

    Good idea. The whole premise of using a stepper is that it is a discrete device, and angular errors don't accumulate. It may be true on an aggregate level, but it seems that on an arbitrary start point I'm not getting to the count I expect when turning two turns forward and two turns...
  15. C

    Issue with Stepper Motor with Builtin Decoder

    I have no idea at this point. One full step would correspond to 4096 counts/rev / ( 200 steps/rev) = 20.48 counts/step. One micro-step is 1/4 of that, or 5.12 counts. I observe ~6 counts, which perhaps coincidentally(?) is about 1/4 step (1 micro-step) 5.12 counts rounded up to 6. Maybe I...
  16. C

    Issue with Stepper Motor with Builtin Decoder

    I'm just as puzzled as you are. I'm doing something similar and seeing bizarre stuff. My driver is set up to do 4 microsteps/step. The NEMA17 stepper is 200 full steps per revolution. I have connected a 1024 PPR rotary encoder to the stepper, via a 2GT timing belt. When I do 1600 steps...
  17. C

    Problems with Arduino IDE 2.0.3 on Ventura

    @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 for Mac (Apple Silicon). Version: 2.3.6 Date...
  18. C

    QuadEncoder counting question

    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 shoehorn quad encoder into it, so I can determine if the...
  19. C

    QuadEncoder counting question

    Ok, moving the pins and using the default settings does get 80,000 counts.
  20. C

    Issue with Stepper Motor with Builtin Decoder

    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 2200 RPM.) Downside, is it takes a little longer...
  21. C

    QuadEncoder counting question

    No I have not changed the program at all. No edits. I did send commands to set the ppr to 1024, and the rpm to -400. That's it. Nothing else.
  22. C

    Issue with Stepper Motor with Builtin Decoder

    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 motor. (Added an aluminum disk to the motor pulley...
  23. C

    QuadEncoder counting question

    OK. Here's the output with -400 RPM, 1024 PPR ppr = 1024 rpm = -400.0 frq = 27306.7 4294967276 0 1 0 0 0 0 0 0 0 4294967295 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 4294967295 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 4294967295 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 4294967295 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 4294967295...
  24. C

    QuadEncoder counting question

    Why does the count value vary? Because the millisecond timer isn't 1ms exactly? Application TachSim0 May 12 2025 14:19:55 ppr = 1200 rpm = 1000.0 frq = 80000.0 4294967229 4294967228 4294967232 4294967228 4294967228 4294967232 4294967228 4294967228 4294967232 4294967228 4294967228...
  25. C

    QuadEncoder counting question

    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
  26. C

    QuadEncoder counting question

    FYI that project you linked was archived last year. There will not be any updates. I will install it to try it out though.
  27. C

    QuadEncoder counting question

    Thanks for the URL, that ought to help. Hugo's library came up first, so I used that. I was trying to compile as is, just to see how things worked.
  28. C

    Issue with Stepper Motor with Builtin Decoder

    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 anything about it. I had a 1um resolution digital...
  29. C

    QuadEncoder counting question

    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 application will run after integration. One more...
  30. C

    QuadEncoder counting question

    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 me. If the former, (first question is...
  31. C

    What is the maximum sustained data transmit rate for Ethernet on Teensy?

    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 algorithm doesn't care. I certainly don't know the time...
  32. C

    What is the maximum sustained data transmit rate for Ethernet on Teensy?

    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 inertia, and to some extent the spindle inertia. I'm...
  33. C

    What is the maximum sustained data transmit rate for Ethernet on Teensy?

    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 being an error or not. Haven't thought about it...
  34. C

    What is the maximum sustained data transmit rate for Ethernet on Teensy?

    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 another? and when I did it? I can only monitor 2 pins...
  35. C

    What is the maximum sustained data transmit rate for Ethernet on Teensy?

    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 chuck) only goes to 2000 RPM, so I considered it as...
  36. C

    What is the maximum sustained data transmit rate for Ethernet on Teensy?

    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 a working system for 3 years now, and thousands...
  37. C

    What is the maximum sustained data transmit rate for Ethernet on Teensy?

    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 there's an unexpected change in program flow. I'm...
  38. C

    What is the maximum sustained data transmit rate for Ethernet on Teensy?

    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 existing paradigm. It's forcing a big time...
  39. C

    What is the maximum sustained data transmit rate for Ethernet on Teensy?

    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.
  40. C

    What is the maximum sustained data transmit rate for Ethernet on Teensy?

    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 being told the delivery time was another 6 months out...
  41. C

    What is the maximum sustained data transmit rate for Ethernet on Teensy?

    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 figure it, there's blocking up to 2400 cycles just...
  42. C

    What is the maximum sustained data transmit rate for Ethernet on Teensy?

    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 from the USB output? //if (transfer_log_count >=...
  43. C

    What is the maximum sustained data transmit rate for Ethernet on Teensy?

    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, especially if they are infrequent. I remember...
  44. C

    What is the maximum sustained data transmit rate for Ethernet on Teensy?

    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 during receive all ISR's are blocked by a...
  45. C

    What is the maximum sustained data transmit rate for Ethernet on Teensy?

    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 least from reading the code. I can't have my...
  46. C

    No serial ports on imac

    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.
  47. C

    ILI9341_t3n Library basic question

    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.
  48. C

    ILI9341_t3n Library basic question

    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 system heartburn (loss of synchronization). SPI is...
  49. C

    ILI9341_t3n Library basic question

    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? But this whole screen refresh allows my program to...
  50. C

    ILI9341_t3n Library basic question

    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 any reference to a call to SPI using interrupts...
Back
Top