-
-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RC-Servo on Spindle PWM? #323
Comments
I just recognized, that the user already made his own issue: #322 |
Hi @svenhb, But your issue is better as it gives a clue for resolution :-) Servo control is in my TODO list as accessory tool like the recently added functions digital and analog output. It's a rather bit complicated because we need to change some PWM registers and timers without made disruption on other timers functionalities. For this, we can't use the standard Arduino servo library. The trick to do this is to modify the PWM register to obtain the right frequency usable by a servo (~50Hz?) and send pulses between about 1 and 2 ms. 1ms give a servo position close to one end of its travel, 2ms give the servo to go close to the other end. For this, I plan to hack the servo library to understand how it exactly work on AtMega2560, then, write the optimized code for grbl-Mega-5X... It will take a while as like all other retired, I'm over-surbooked :-D If you plan to work on this subject for a faster result, do not hesitate to come back here to share your progress. @++; |
Ok, I don't like it but I had to... look into the datasheet (https://ww1.microchip.com/downloads/en/devicedoc/atmel-2549-8-bit-avr-microcontroller-atmega640-1280-1281-2560-2561_datasheet.pdf). Setup for RC-Servo: prescaler = 1/1024 (CSn0,2=1), top value 512 -> PWM freq 30Hz. This means, following changes are needed in cpu_map.h: This gives a step-width of 0,064 ms (1/30Hz / 512) I hope I'm right... |
Hi,
can't find an option to change the spindle PWM generation like here: https://github.com/cprezzi/grbl-servo
You may have a quick solution to solve this problem?: svenhb/GRBL-Plotter#327 (comment)
User switches from Arduino-Uno with Servo-PWM to Mega2560 with your grbl version...
Thanks
The text was updated successfully, but these errors were encountered: