grbl_stm32 icon indicating copy to clipboard operation
grbl_stm32 copied to clipboard

PMW trouble.

Open J-Dunn opened this issue 5 years ago • 2 comments

Hi,

I want set up an opto isolated 10V control signal for my chinese VFD for the spindle. Having set up the opto I went to test and found I don't have a PWM pulse train on PB0 CN7/34 ( Arduino A3 ).

Am I correct in thinking I just need to $X then M3 S500 to get a pulse train on that pin?

thanks. I can't see what I'm missing here.

#define PWM_SPINDLE			// standard 0-100% pwm, if not defined RC servo pwm: 1.0-1.5ms on, 20ms period
#define PWM_MAX_VALUE 0xfff	// resulting PWM freq will 100MHz/PWM_MAX_VALUE, 0xffff = ~1.5KHz, 0xff = ~390KHz
#define VARIABLE_SPINDLE // Default enabled.

#ifdef PWM_SPINDLE
#ifdef STANDARD_GRBL
		  TIM_SetCompare1(TIM3,current_pwm);

If I'm understanding these library routines, this does not seem consistent with the AFconfig which sets PB0 AF which corresponds to TIM3_CH3.

GPIO_PinAFConfig(GPIOB, GPIO_PinSource0, GPIO_AF_TIM3);

J-Dunn avatar Apr 19 '19 14:04 J-Dunn

the STANDARD_GRBL define puts the spindle pwm on PA6

langwadt avatar Apr 20 '19 12:04 langwadt

Thanks for the reply. That was the wrong code snippet actually , not sure what happened. I'm not using STANDARD_GRBL . I'm using your original wiring on PB0 as I detailed. Anyway, I've got it working now and have the PWM driving the 0-10V spindle speed signal via an opto. Seems fine. I have 3 limits switches and z-probe similarly isolated.

I have a spare opto channel free which I'm trying to find a use for to pre-empt some future need before I box it all up and put it back on the machine.

J-Dunn avatar Apr 20 '19 19:04 J-Dunn