[Grbl_Esp32 Issue#431] PWM output missing due to SPINDLE_ENABLE reversed.

未分类 bolang 4个月前 (10-14) 41次浏览

Issue #431 | 状态: 已关闭 | 作者: ghost | 创建时间: 2020-06-13

标签: help wanted


Please answer the following questions:

Have you read the wiki regarding how to compile?—-YES

What version of the Arduino IDE are you using? ….1.8.12

What version (commit date) of the Arduino core for the ESP32 are you using? ….1.0.4

Are you using the master branch of Grbl_ESP32?…..yes

Have you made any edits or configuration changes (list them) to the firmware?
edit SSID & PASSWORD in config.h


#include "Machines/lowrider_v1p2.h" in machine.h
`
edit lowrider_v1p2.h in \Machines to read

`#ifdef USESPINDLERELAY
#define SPINDLETYPE SPINDLETYPE_RELAY
#define SPINDLEOUTPUTPIN GPIONUM2
#else
#define SPINDLETYPE SPINDLETYPE_PWM
#define SPINDLEOUTPUTPIN GPIONUM16

#define SPINDLEENABLEPIN GPIONUM32
#endif

// Note: Only uncomment this if USESPINDLERELAY is commented out.
// Relay can be used for spindle or either coolant
#define COOLANTFLOODPIN GPIONUM2
//#define COOLANTMISTPIN GPIONUM2

#define XLIMITPIN GPIONUM17
#define YLIMITPIN GPIONUM4
#define ZLIMITPIN GPIONUM15
#define LIMIT_MASK B111

#ifndef ENABLESOFTWAREDEBOUNCE // V1P2 does not have R/C filters
#define ENABLESOFTWAREDEBOUNCE
#endif

#define PROBEPIN GPIONUM_35

// The default value in config.h is wrong for this controller
#ifdef INVERTCONTROLPIN_MASK
#undef INVERTCONTROLPIN_MASK
#endif

#define INVERTCONTROLPIN_MASK B1110

#define CONTROLRESETPIN GPIONUM34 // needs external pullup
#define CONTROLFEEDHOLDPIN GPIONUM_36 // needs external pullup
#define CONTROLCYCLESTARTPIN GPIONUM_39 // needs external pullup

#define DEFAULTSTEPPULSE_MICROSECONDS 3
#define DEFAULTSTEPPERIDLELOCKTIME 255 // 255 = Keep steppers on

#define DEFAULTSTEPPINGINVERTMASK 0 // uint8t
#define DEFAULTDIRECTIONINVERTMASK 0 // uint8t
#define DEFAULTINVERTST_ENABLE 0 // boolean
#define DEFAULTINVERTLIMIT_PINS 1 // boolean
#define DEFAULTINVERTPROBE_PIN 0 // boolean

#define DEFAULTSTATUSREPORT_MASK 1

#define DEFAULTJUNCTIONDEVIATION 0.01 // mm
#define DEFAULTARCTOLERANCE 0.002 // mm
#define DEFAULTREPORTINCHES 0 // false

#define DEFAULTSOFTLIMIT_ENABLE 0 // false
#define DEFAULTHARDLIMIT_ENABLE 0 // false

#define DEFAULTHOMINGENABLE 1 // false
#define DEFAULTHOMINGDIR_MASK 3 // move positive dir Z,negative X,Y
#define DEFAULTHOMINGFEED_RATE 100.0 // mm/min
#define DEFAULTHOMINGSEEK_RATE 200.0 // mm/min
#define DEFAULTHOMINGDEBOUNCE_DELAY 250 // msec (0-65k)
#define DEFAULTHOMINGPULLOFF 2.0 // mm

#ifdef USESPINDLERELAY
#define DEFAULTSPINDLERPM_MAX 1.0 // must be 1 so PWM duty is alway 100% to prevent relay damage
#else
#define DEFAULTSPINDLERPM_MAX 1000.0 // can be change to your spindle max
#endif

#define DEFAULTSPINDLERPM_MIN 0.0 // rpm

#define DEFAULTLASERMODE 0 // false

#define DEFAULTXSTEPSPERMM 200.0
#define DEFAULTYSTEPSPERMM 200.0
#define DEFAULTZSTEPSPERMM 800.0

#define DEFAULTXMAX_RATE 8000.0 // mm/min
#define DEFAULTYMAX_RATE 8000.0 // mm/min
#define DEFAULTZMAX_RATE 3000.0 // mm/min

#define DEFAULTXACCELERATION (200.06060) // 106060 mm/min^2 = 10 mm/sec^2
#define DEFAULTYACCELERATION (200.06060) // 106060 mm/min^2 = 10 mm/sec^2
#define DEFAULTZACCELERATION (100.06060) // 106060 mm/min^2 = 10 mm/sec^2

#define DEFAULTXMAX_TRAVEL 500.0 // mm NOTE: Must be a positive value.
#define DEFAULTYMAX_TRAVEL 500.0 // mm NOTE: Must be a positive value.
#define DEFAULTZMAX_TRAVEL 80.0 // mm NOTE: Must be a positive value.
`
The code compiles but there is no PWM output. The signal SPINDLE_ENABLE is LOW when enabled with an M3 command and HIGH when switched off with a M5 command (which is backwards) so the PWM signal does not make it through the 3 to 5v level changer. If I uncomment

`
// #define INVERTSPINDLEENABLE_PIN // Default disabled. Uncomment to enable.

then the SPINDLE_ENABLE signal changes to active high but the PWM output also changes from active HIGH to active LOW. There does not appear to be an INVERT PWM option.

Sorry if this is in the wrong place. Feel free to move/delete


评论 (5)

#1 – MitchBradley 于 2020-06-13

Try this fix https://github.com/bdring/GrblEsp32/tree/Fix431 and see if it does what you want. It adds a separate config options INVERTSPINDLEOUTPUTPIN in addition to the existing INVERTSPINDLEENABLE_PIN .


#2 – MitchBradley 于 2020-06-13

The patch is https://github.com/bdring/Grbl_Esp32/commit/66ac0eaa425d8329d94d1b5a5580940b5a340fe7 if you would just like to apply that to your tree.


#3 – ghost 于 2020-06-14

OK, I tried the patch and it adds the option to reverse the pwm output pin function. If I enable both spindle enable invert AND spindle PWM invert the pwm signal is still wrong but now you have added the OPTION if I leave the invert spindle output pin commented out it all works correctly. ie

// Inverts the spindle enable pin from low-disabled/high-enabled to low-enabled/high-disabled. Useful
// for some pre-built electronic boards.
#define INVERTSPINDLEENABLE_PIN // Default disabled. Uncomment to enable.

// Inverts the spindle PWM output pin from low-disabled/high-enabled to low-enabled/high-disabled.
// #define INVERTSPINDLEOUTPUT_PIN // Default disabled. Uncomment to enable.

has enable going high with an M3 and the PWM pulsing high
The nomenclature seems all ass-about-face to me but it works.

Thanks


#4 – MitchBradley 于 2020-06-14

Propose a different name and write the instructions then.


#5 – ghost 于 2020-06-14

Sorry Mitch, that maybe came across wrong, the existing script states that both the SPINDLEENABLEPIN and the SPINDLEOUTPUTPIN should be active HIGH and in my case that is not what is happening. I did not mean to offend and do appreciate all the effort both you and Bart put in, nothing needs to be re-written as it now works ‘ass-about-face’ and I would not know how to do so anyway, I just thought as this is your baby you might have been more interested in the root cause rather than just writing a fix.
Thank you for your efforts.


原始Issue: https://github.com/bdring/Grbl_Esp32/issues/431

喜欢 (0)