gnea / grbl

An open source, embedded, high performance g-code-parser and CNC milling controller written in optimized C that will run on a straight Arduino
https://github.com/gnea/grbl/wiki
Other
4.07k stars 1.61k forks source link

Configure Spindle Enable and Spindle PWM on ATMega644p #565

Open Elmi77 opened 5 years ago

Elmi77 commented 5 years ago

I try to configure GRBL to use a spindle-enable output at PD7 and a spindle PWM output AT PA0. For this I have laser mode enabled and configured the following in cpu_map.h:

define SPINDLE_ENABLE_DDR DDRD

define SPINDLE_ENABLE_PORT PORTD

define SPINDLE_ENABLE_BIT 7

ifndef USE_SPINDLE_DIR_AS_ENABLE_PIN

define SPINDLE_DIRECTION_DDR DDRD

define SPINDLE_DIRECTION_PORT PORTD

define SPINDLE_DIRECTION_BIT 7

endif

define SPINDLE_PWM_DDR DDRA

define SPINDLE_PWM_PORT PORTA

define SPINDLE_PWM_BIT 0

In config.h following is configured:

define VARIABLE_SPINDLE

Nevertheless I can't se any signals at both outputs, even spindle enbale is missing.

Any idea what is wrong here?

Thanks!

Elmi77 commented 5 years ago

OK, I'm getting closer: the spinde-enable-pin is not enabled automatically but only when a command M3/M4 is sent and disabled when M2 is sent (so this was my mistake). So my question: is there a mode available where the spinde-enable bit is set automatically as long as a G1 motion is running?

And: is a similar command required to see the spindle PWM output (power ramping)?

ghost commented 5 years ago

You can't use PA0 for PWM! Only PD6 or PD7!