[Grbl_Esp32 Issue#270] Modified CPU map not working

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

Issue #270 | 状态: 已关闭 | 作者: mac7988 | 创建时间: 2019-10-27


I made changes to the CPUMAP and nothing else. When I upload it nothing seems to work. For now I am only trying to get X axis to work so don’t pay attention to the rest of the pin maps.

Do I need to adjust something else before compiling and uploading?

/*
cpu_map.h - Header for system level commands and real-time processes
Part of Grbl
Copyright (c) 2014-2016 Sungeun K. Jeon for Gnea Research LLC

2018 - Bart Dring This file was modified for use on the ESP32
CPU. Do not use this with Grbl for atMega328P

Grbl is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl. If not, see .
*/

#ifndef cpumaph
//#define cpumaph

/*
Not all pins can can work for all functions.
Check features like pull-ups, pwm, etc before
re-assigning numbers

(gpio34-39) are inputs only and don't have software pullup/down functions
You MUST use external pull-ups or noise WILL cause problems.

Unlike the AVR version certain pins are not forced into the same port.
Therefore, bit masks are not use the same way and typically should not be
changed. They are just preserved right now to make it easy to stay in sync
with AVR grbl

*/

//Set your pin definition
//let -1 to use default board pin
#define GRBLSPISS -1
#define GRBLSPIMOSI -1
#define GRBLSPIMISO -1
#define GRBLSPISCK -1
//Set your frequency
#define GRBLSPIFREQ 4000000

#define LIMIT_MASK 0 // no limit pins
#ifdef CPUMAPMPCNC // all versions...select below
// This is the CPU Map for the Buildlog.net MPCNC controller

// uncomment ONE of the following versions
//#define V1P1
#define V1P2 // works for V1.2.1 as well

#ifdef V1P1
#define CPUMAPNAME "CPUMAPMPCNC_V1P1"
#else // V1P2
#define CPUMAPNAME "CPUMAPMPCNC_V1P2"
#endif

// switch to the correct default settings
#ifdef DEFAULTS_GENERIC
#undef DEFAULTS_GENERIC
#endif
#define DEFAULTS_MPCNC

#define USEGANGEDAXES // allow two motors on an axis

#define XSTEPPIN GPIONUM4
#define XSTEPBPIN GPIONUM_22 // ganged motor
#define XAXISSQUARING

#define YSTEPPIN GPIONUM14
#define YSTEPBPIN GPIONUM_21 // ganged motor
#define YAXISSQUARING

#define ZSTEPPIN GPIONUM27

#define XDIRECTIONPIN GPIONUM15
#define YDIRECTIONPIN GPIONUM25
#define ZDIRECTIONPIN GPIONUM33

// OK to comment out to use pin for other features
#define STEPPERSDISABLEPIN GPIONUM13

// Note: if you use PWM rather than relay, you could map GPIONUM2 to mist or flood
//#define USESPINDLERELAY

#ifdef USESPINDLERELAY
#ifdef V1P1
#define SPINDLEPWMPIN GPIONUM17
#else // V1p2
#define SPINDLEPWMPIN GPIONUM2
#endif
#else
#define SPINDLEPWMPIN GPIONUM16
#define SPINDLEENABLEPIN GPIONUM32
#endif

#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 5000 // 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

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

#ifdef V1P1 //v1p1
#define XLIMITPIN GPIONUM2
#else
#define XLIMITPIN GPIONUM17
#endif

//#define YLIMITPIN GPIONUM4
//#define ZLIMITPIN GPIONUM15
#define LIMIT_MASK B111

#ifdef V1P2
#ifndef ENABLESOFTWAREDEBOUNCE // V1P2 does not have R/C filters
#define ENABLESOFTWAREDEBOUNCE
#endif
#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

// Note: default is #define IGNORECONTROLPINS in config.h
// uncomment to these lines to use them
#ifdef IGNORECONTROLPINS
#undef IGNORECONTROLPINS
#endif

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

#endif

// ================= common to all machines ================================

// These are some ESP32 CPU Settings that the program needs, but are generally not changed
#define F_TIMERS 80000000 // a reference to the speed of ESP32 timers
#define FSTEPPERTIMER 20000000 // frequency of step pulse timer
#define STEPPEROFFTIMER_PRESCALE 8 // gives a frequency of 10MHz
#define STEPPEROFFPERIOD_uSEC 3 // each tick is

#define STEPPULSEMIN 2 // uSeconds
#define STEPPULSEMAX 10 // uSeconds

// =============== Don't change or comment these out ======================
// They are for legacy purposes and will not affect your I/O

#define XSTEPBIT 0 // don't change
#define YSTEPBIT 1 // don't change
#define ZSTEPBIT 2 // don't change
#define ASTEPBIT 3 // don't change
#define BSTEPBIT 4 // don't change
#define CSTEPBIT 5 // don't change
#define STEP_MASK B111111 // don't change

#define XDIRECTIONBIT 0 // don't change
#define YDIRECTIONBIT 1 // don't change
#define ZDIRECTIONBIT 2 // don't change
#define ADIRECTIONBIT 3 // don't change
#define BDIRECTIONBIT 4 // don't change
#define CDIRECTIONBIT 5 // don't change

#define XLIMITBIT 0 // don't change
#define YLIMITBIT 1 // don't change
#define ZLIMITBIT 2 // don't change
#define ALIMITBIT 3 // don't change
#define BLIMITBIT 4 // don't change
#define CLIMITBIT 5 // don't change

#define PROBE_MASK 1 // don't change

#define CONTROL_MASK B1111 // don't change

// =======================================================================

#endif


评论 (3)

#1 – bdring 于 2019-10-27

I don’t understand.

1. Did you modify the MPCNC cpu map?
2. What hardware are you running on?
3. What did you modify?
4. Did you change anything in config.h?
5. Can you paste the startup text you get in the serial monitor?


#2 – mac7988 于 2019-10-27

Did you modify the MPCNC cpu map?
Yes, I have a different pin layout.
What hardware are you running on?
It’s a board I soldered to test. Using esp32 devkit c

What did you modify?
Just the CPU map
Did you change anything in config.h?
No
Can you paste the startup text you get in the serial monitor


#3 – mac7988 于 2019-10-27

I figured it out. all I had to do is read what you wrote on the WIKI.
I am so impressed by how well you wrote this. Even for a dummy like me.

What I did is change the config to to use the correct map. In this case the mpcnc map that I modified.


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

喜欢 (0)