Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Maximum feed rate with quadrature scales
#1
First off, I would like to say how impressed I am with this TouchDRO and everything around it. A big pat on the back to Yuriy in particular for his efforts, and to all others who have contributed. I hope to be able to contribute something one day soon, but I am just getting started. 
I am trying to fit a DRO to my Maximat V10P which has some trying space constraints. I have purchased, and am about to start playing with some small RLB quadrature encoder modules from RLS, aiming for 1um resolution (just because I can Big Grin).
My first step has been to fire up the Launchpad/BT/TouchDRO driven by a quadrature simulator that I coded up on an Arduino using a PC as the UI. According to my Logic Analyzer, it runs quite accurately beyond 100kHz. However, at that frequency, the Launchpad starts to drop 3-4% of pulses (according to the display on the TouchDRO). Now, 100kHz at 1um is only 100mm/ sec which, while reasonably quick for a lathe, is well within the bounds of a fast hand wheel spin between cuts.
I expected something like this, of course. 10uS to service a pulse in a 16MHz CPU while still doing a bunch of other stuff (I imagine ASCII conversions are a big killer!) seems pretty good. But of course, I had to suck it and see. The main reason for getting the Launchpad was to help me in reverse engineering, as I think I am up for doing some more coding, like on an ESP (2 cores, 64 bit, 180MHz, integral BT) or similar. 

Have I understood this correctly, or am I way off course?


Roman
Reply
#2
(10-24-2018, 11:39 AM)Romeo Wrote: First off, I would like to say how impressed I am with this TouchDRO and everything around it. A big pat on the back to Yuriy in particular for his efforts, and to all others who have contributed. I hope to be able to contribute something one day soon, but I am just getting started. 
I am trying to fit a DRO to my Maximat V10P which has some trying space constraints. I have purchased, and am about to start playing with some small RLB quadrature encoder modules from RLS, aiming for 1um resolution (just because I can Big Grin).
My first step has been to fire up the Launchpad/BT/TouchDRO driven by a quadrature simulator that I coded up on an Arduino using a PC as the UI. According to my Logic Analyzer, it runs quite accurately beyond 100kHz. However, at that frequency, the Launchpad starts to drop 3-4% of pulses (according to the display on the TouchDRO). Now, 100kHz at 1um is only 100mm/ sec which, while reasonably quick for a lathe, is well within the bounds of a fast hand wheel spin between cuts.
I expected something like this, of course. 10uS to service a pulse in a 16MHz CPU while still doing a bunch of other stuff (I imagine ASCII conversions are a big killer!) seems pretty good. But of course, I had to suck it and see. The main reason for getting the Launchpad was to help me in reverse engineering, as I think I am up for doing some more coding, like on an ESP (2 cores, 64 bit, 180MHz, integral BT) or similar. 

Have I understood this correctly, or am I way off course?


Roman

Roman,
This sounds about right. The issue has little to do with MCU frequency. What you are running into is a limitation of MSP430's interrupt handler. Namely, it doesn't have nested interrupts and there is no interrupt buffer (short of the single bit interrupt flag). Pulse processing happens inside an ISR, which take on the order of 20-ish MCU cycles, which is plenty fast enough for almost 5x the speed you are seeing. The problem is UART ISR that is much slower. Although if fires at much lower frequency, it can take enough time to "masK" a pulse if two pulses are received within that time. (One will be captured in the flag and IO ISR will fire when UART ISR exits). 

As far as "reverse engineering", there isn't much to reverse engineer. Here is the protocol: Arduino DRO Serial Protocol Considerations. Reading quadrature signal is straightforward: have an interrupt on both scale pins (A and B). When it fires, see which pin fired and what the state of the other lines is to calculate direction and then either increment or decrement the position.

All that said, I did a bunch of optimization at one point to get past that but it's shelved right now, mostly because 100KHz on one scale is pretty insane reading speed, no matter how you look at it. 99.xx% of people don't use 1 micron scales on lathe's Z axis, since there is no way you will take advantage of it, given the relatively crude positioning mechanism. At 5 micron resolution this is 1/2 of a meter per second... Even 100mm per second is actually really fast. On most lathes it would take several revolutions of the hand wheel per second to get to that speed, and most human being would be hard pressed to make even two full revolutions per second. For short distances this is not an issue either, since there is a lot of inertia in the carriage, so you can't really jerk the wheel fast enough.

Do't get me wrong. I'd be as excited as the next guy to throw a 16-core ThreadRipper with custom real-time OS and read the pulses from 8 scales at 100MHz frequency, there is no practical (or even theoretical) need for it. 16MHz MCU is more than enough for pretty much any reasonable usage scenario.

Hope this makes sense.
Yuriy
Reply
#3
Yuriy,
Your points are well made. I have 1um encoders for all 3 axes, although your point about the resolution being excessive on the long axis is taken. So I think speed on that axis may prove to be a problem - with an obvious workaround Smile . I’m going to get everything going first using the Launchpad and possibly update it later on.
Great to see that you are still active with this. I’m really looking forward to your next release of TouchDRO.
Roman
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)