CNC Controller Unit

XCore Project reviews, ideas, videos and proposals.
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm

Re: CNC Controller Unit

Postby Folknology » Mon Aug 04, 2014 2:47 pm

Well messing with the Acceleration I took it up to 500! it actually looks quite good but you can here it switching half octaves about 6 times. You can have it at 100 or below and get fairly smooth looking/sounding acceleration. But I am looking at them rotating not driving cartesian axis

Config wise I am using 1/8th stepping (These will do 1/16th but I am driving them fast for some separate >1KRPM tests), so YMMV.

Down at 10 it's silky smooth...

P.S. the deceleration issue only seems to occur with multi axis AFAICS

regards
Al
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm

Postby Folknology » Mon Aug 04, 2014 3:24 pm

I think is must be down to the missed steps, when I change the do--while to:

Code: Select all

while (((gpio_out == 0) | (gpio_out == 8)) && stepMissedTimeout-- > 0);
I get the issue in both directions

I am guessing we need to counter the decrementing of dmt as it should not count.

Thus I moved --dmt to below update ports with a conditional for step miss:

Code: Select all

  // Update outputs
  p <: gpio_out;
  // Don't decrement if no steps taken (step missed)    
  if(gpio_out & 7) --dmt;  // Decrement steps counter
That seems to do the trick

regards
Al
User avatar
BBenj
Member++
Posts: 21
Joined: Fri Sep 13, 2013 3:00 pm

Postby BBenj » Mon Aug 04, 2014 4:03 pm

Ok, thanks for testing out the acceleration. The value will depend mostly on the acceleration value I think, the higher the acceleration, the higher the step. By doing that I'll keep the acceleration timer a constant frequency, and thus a constant CPU usage.

Well, good guess ! Thanks !
I suspected that the main counter was decrementing too fast (all speeds and acceleration were ok, so it was the only left possible cause), but I could not figure out why.
I did some tests on Python with this algorithm, and it seems to work just fine! But apparently not, I'll check again :-p
I still don't know exactly why the "--dmt" needs to be out of the do-while loop, but I'll find.
And I forgot to mask the dir bit in the gpio_out test... damn :-p

Well, thanks for your help, I'm happy to see my code well driving stepper motors :-D
I'll post a corrected program until I figured out why exactly the decrement needs to be moved out of the loop.

As it works perfectly now, one more thing you can try: find the maximum speed & acceleration your motor can handle. I would like to know if the code still works at high speed. (don't forget to increase the acceleration step as you increase the acceleration)

Thanks!

Regards, Benj

PS: I'm automatically unsubscribed from topic posts each time I edit or post a topic, do you know why ?
User avatar
BBenj
Member++
Posts: 21
Joined: Fri Sep 13, 2013 3:00 pm

Postby BBenj » Mon Aug 04, 2014 6:22 pm

Ok, here is the fixed program.

I still don't understand why the previous algorithm doesn't work, as it works on my Python program. Actually the current algo works with XMOS, but not with Python... weird.

Anyway, I don't have much time to spend to figure out, so I'll do with that for now. It's working, that's all need. :-)

Regards, Benj
You do not have the required permissions to view the files attached to this post.

Who is online

Users browsing this forum: No registered users and 0 guests