Sorry to post this as an issue, I’m looking in all the wrong places but where is the pinout for the limit switches? What circuit do you suggest to help with noise? Looks like some resistors present here.
!image
These also have R/C filters to eliminate high frequency noise from false triggering the switches.
Also where is the entire pinout mapping?
I looked through the following:
https://github.com/bdring/Grbl_Esp32/wiki/Setting-Up-the-I-O-Pins
https://github.com/bdring/GrblEsp32/blob/master/GrblEsp32/grbl_limits.cpp
https://github.com/bdring/GrblEsp32/blob/master/GrblEsp32/grbl_limits.h
https://github.com/bdring/Grbl_Esp32
https://github.com/bdring/GrblEsp32/wiki/Controlling-GrblESP32
http://www.buildlog.net/blog/wp-content/uploads/2018/10/outlineesp32cnctestv3p1.pdf
评论 (17)
#2 – derFrickler 于 2019-10-26
Just look them up or change them in the CPU map:
https://github.com/bdring/GrblEsp32/blob/master/GrblEsp32/cpu_map.h#L92
#3 – bdring 于 2019-10-26
The cpu map is this one
“C++“
#ifdef CPUMAPESP32
// This is the CPU Map for the ESP32 Development Controller
// https://github.com/bdring/GrblESP32Development_Controller
// https://www.tindie.com/products/33366583/grbl_esp32-cnc-development-board-v35/
...
I suggest using the V4 version.
There is also limit switch debouncing that can help with noise.
#4 – jaysettle 于 2019-10-26
Why V4? I have V3 working, what’s the difference? Thanks.
#5 – bdring 于 2019-10-26
Some i/o was shuffled around on V4. The primary reason was io2. Most dev boards have an LED on io2 and that can give problems if you use it as an input. For some reason, I have never had the problem, but many people have reported it. It must be close to a threshold.
io2 is used for the x limit switch on V3 and earlier. On V4 it is the spindle PWM. It works well as a PWM output because you can see the brightness change. A few other things shuffled around too.
Everything I know about ESP32 gpio is on this wiki page. I add to it every time I learn something new.
#6 – TimeWaster4000 于 2019-11-04
Why is reset tied to P34 when the esp32 dev kit has the reset on the EN pin.
I would like to use P34 for limit pin but when you use a pullup and the limit switch is triggered it resets the unit.
I have commented out ( //#define CONTROLRESETPIN GPIONUM34 ) still resets the unit
Thank You
#7 – bdring 于 2019-11-04
It is a different type of reset. Grbl reset is a way to “soft” reset grbl.
– If Grbl is using hard or soft limit switches, you need do a soft reset to clear the error
– If you are running a job and do a feed hold, you can either restart the job or do a Grbl reset to end it.
Generally a soft reset clears out Grbl’s buffer, but you do not loose position and don’t need to rehome.
You don’t need a button. The soft reset can also be done with a Gcode sender.
Attach your cpu_map
#8 – bdring 于 2019-11-04
Please paste your map into the reply.
…just the one you are using.
#9 – TimeWaster4000 于 2019-11-04
“C++
#ifdef CPUMAPESP32_LPCNC
// This is the CPU Map for the LPCNC Shield
// It is OK to comment out any step and direction pins. This
// won't affect operation except that there will be no output
// form the pins. Grbl will virtually move the axis. This could
// be handy if you are using a servo, etc. for another axis.
#define CPUMAPNAME "CPUMAPESP32_LPCNC"
#define XSTEPPIN GPIONUM12
#define XDIRECTIONPIN GPIONUM14
#define XRMTCHANNEL 0
#define YSTEPPIN GPIONUM27
#define YDIRECTIONPIN GPIONUM26
#define YRMTCHANNEL 1
#define ZSTEPPIN GPIONUM25
#define ZDIRECTIONPIN GPIONUM33
#define ZRMTCHANNEL 2
// OK to comment out to use pin for other features
#define STEPPERSDISABLEPIN GPIONUM13
// * the flood coolant feature code is activated by defining this pins
// * Comment it out to use the pin for other features
// #define COOLANTFLOODPIN GPIONUM16
//#define COOLANTMISTPIN GPIONUM21
// If SPINDLEPWMPIN is commented out, this frees up the pin, but Grbl will still
// use a virtual spindle. Do not comment out the other parameters for the spindle.
#define SPINDLEPWMPIN GPIONUM17
#define SPINDLEPWMCHANNEL 0
// PWM Generator is based on 80,000,000 Hz counter
// Therefor the freq determines the resolution
// 80,000,000 / freq = max resolution
// For 5000 that is 80,000,000 / 5000 = 16000
// round down to nearest bit count for SPINDLEPWMMAX_VALUE = 13bits (8192)
#define SPINDLEPWMBASE_FREQ 5333 // Hz
#define SPINDLEPWMBITPRECISION 8 // be sure to match this with SPINDLEPWMMAXVALUE
#define SPINDLEPWMOFF_VALUE 0
#define SPINDLEPWMMAXVALUE 255 // (2^SPINDLEPWMBITPRECISION)
#ifndef SPINDLEPWMMIN_VALUE
#define SPINDLEPWMMIN_VALUE 1 // Must be greater than zero.
#endif
// #define SPINDLEENABLEPIN GPIONUM22
#define SPINDLEPWMRANGE (SPINDLEPWMMAXVALUE-SPINDLEPWMMINVALUE)
// if these spindle function pins are defined, they will be activated in the code
// comment them out to use the pins for other functions
//#define SPINDLEENABLEPIN GPIONUM16
//#define SPINDLEDIRPIN GPIONUM16
#define XLIMITPIN GPIONUM34
#define YLIMITPIN GPIONUM35
#define ZLIMITPIN GPIONUM32
#define LIMIT_MASK B111
// if using a probe, Door, Reset, Hold, Start, Servo or Solenoid uncomment and asign a pin
// Useable pins are 0,15, 21, 22, 32, 34, 35, 36, 39
// Pins 34, 35, 36 and 39 need external pullup
//#define PROBEPIN GPIONUM_32
//#define CONTROLSAFETYDOORPIN GPIONUM_35
//#define CONTROLRESETPIN GPIONUM34
//#define CONTROLFEEDHOLDPIN GPIONUM_36
//#define CONTROLCYCLESTARTPIN GPIONUM_39
//#define USING_SERVO // uncomment to use this feature
//#define USING_SOLENOID // uncomment to use this feature
#ifdef USING_SERVO
#define USESERVOAXES
#define SERVOZPIN GPIONUM27
#define SERVOZCHANNEL_NUM 3
#define SERVOZRANGE_MIN 0
#define SERVOZRANGE_MAX 10
#endif
#ifdef USING_SOLENOID
#define USEPENSOLENOID
#define SOLENOIDPENPIN GPIONUM16
#define SOLENOIDCHANNELNUM 6
#endif
#endif
“
This cpu_map entry is for my diy board
#10 – bdring 于 2019-11-05
What exactly is the problem you are experiencing? I just loaded your cpu map onto an ESP32 dev kit and the x limit works fine.
This is cut from my serial monitor. This shows status from the ? command. I connected pin 34 to ground and see pin X and connect it to 3.3v and don’t see X. This was a loose board without pullups, so when disconnected, X and Y could be anything.
No resets.
“text
[MSG:Using cpumap...CPUMAPESP32LPCNC]
Grbl 1.1f ['$' for help]
ok
ok
ok
ok
ok
ok
ok
“
#11 – TimeWaster4000 于 2019-11-05
Works fine without pull up when you add a pullup and trigger the limit switch it resets.
I have looked all over the place in the firmware for a reference to P34 to move the grbl_reset to a different pin.
Is the GRBL_Reset hard coded to that pin.
#12 – bdring 于 2019-11-05
The pullup should not affect anything. Are you pulling up to 3.3V?
There are no hard coded pins in the firmware. It is all referenced to the cpu map.
The limit switch operation is defined in system.cpp. They are attached to an interrupt where they are read. System.cpp gets all GPIO_NUMs from cpu map.
#13 – bdring 于 2019-11-05
Are you seeing text like [MSG:Reset via control pin] in the serial console?
#14 – TimeWaster4000 于 2019-11-05
Yes pull 3.3V just checked it to be sore.
Console output when limit triggered.
rst:0x1 (POWERONRESET),boot:0x13 (SPIFASTFLASHBOOT)
configsip: 0, SPIWP:0xee
clkdrv:0x00,qdrv:0x00,ddrv:0x00,cs0drv:0x00,hddrv:0x00,wpdrv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:9720
ho 0 tail 12 room 4
load:0x40080400,len:6352
entry 0x400806b8
[MSG:Axis count 3]
[MSG:Timed Steps]
[MSG:Client Started]
[MSG:Connecting The_Monster]
[MSG:Connecting.]
[MSG:Connected with 192.168.2.13]
[MSG:Connected with 192.168.2.13]
[MSG:Start mDNS with hostname:http://Laser.local/%5D
[MSG:SSDP Started]
[MSG:HTTP Started]
[MSG:TELNET Started 23]
[MSG:Using cpumap…CPUMAPESP32LPCNC]
Grbl 1.1f [‘$’ for help]
[MSG:’$H’|’$X’ to unlock]
#15 – bdring 于 2019-11-05
That is hard reset (POWERON_RESET). Grbl reset is not doing that.
Grbl reset via button will send this text to the serial port [MSG:Reset via control pin]. You will not see that startup text.
That is not a firmware crash or watchdog timeout either. With a crash you will see some backtrace information.
I get what you are getting by clicking the ESP32 reset button which is connected to the EN pin.
#16 – TimeWaster4000 于 2019-11-05
Wow I mist it.
Thank you for your patience.
The problem is nether the firmware or the board.
It is the endstop malfunctioning.
Thank you again I was looking in the wrong place.
#17 – bdring 于 2019-11-05
OK, Good.
The serial console will always offer a lot of clues.
#1 – jaysettle 于 2019-10-26
Ok I think I found them here in the pdf. Is there an easier path for people to find the pin mapping? Thanks for your work here!
http://www.buildlog.net/blog/wp-content/uploads/2019/05/schmesp32cnctestv3p5.pdf
!image
And so you appear to use an RC filter. What values would you recommend? NO or NC on the switch?
!image
Also I do have two parallel switches per axis and see this line here:
!image
Is there anything else I’ll need to do to get this working?
1. correct pins 2, 4, and 15
2. rc filter
3. enable “#define LIMITSTWOSWITCHESONAXES”