开源改变世界

带 RMT 的 ESP32D0WDQ6 上的引脚 D11 不能用作步进引脚 #736

推推 grbl 3年前 (2023-01-30) 227次浏览
关闭
shorai 打开了这个问题 2021 年 1 月 12 日 · 3条评论
关闭

带 RMT 的 ESP32D0WDQ6 上的引脚 D11 不能用作步进引脚#736

shorai 打开了这个问题 2021 年 1 月 12 日 · 3条评论

注释

带 RMT 的 ESP32D0WDQ6 上的引脚 D11 不能用作步进引脚 #736

描述

  • 当使用引脚 D11 作为步进脉冲引脚时,固件在启动时失败并反复重启。
  • 当步进功能被重新分配给另一个引脚时,固件可以完美运行。
  • 引脚 D11 可用于其他功能,在这种情况下固件可以正常工作。
  • 用于 RMT 的引脚 11 不可用可能是 ESP32 的一个未记录的功能

我找到了一些关于无法在多个频道上使用 RMT 的人的参考。(不是这种情况)
也许他们在不知不觉中偶然发现了这个或类似的问题并且无法解决它。

优先级
低,存在立即解决方法 – 避免将 D11 作为步进脉冲引脚。

您使用的是什么版本的固件?

[MSG:Grbl_ESP32 Ver 1.3a Date 20201212]
[MSG:Compiled with ESP32 SDK:v3.2.3-14-gd3e562907]
[MSG:Using machine:Rockwell]
[MSG:Axis count 4]
[MSG:RMT Steps]

这些模块来自 Banggood ESP-wroom-32
在 Arduino 下,ESP 模块标识为

Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None

问题是否可重复?

  • 该问题是可重复的,并在两个不同的 ESP 模块上进行了测试
  • 无需连接物理机即可在裸板上进行测试
  • 它在 Arduino 1.8.13 下可重复
    arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-80-g6c4433a-5.2.0/
    ,PIO 最新版本下载于 2021 年 1 月 11 日
    [MSG:Compiled with ESP32 SDK:v3.2.3-14-gd3e562907]
  • 我对 3 轴配置有同样的问题

什么情况下会出现bug?
启动

Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv: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:Grbl_ESP32 Ver 1.3a Date 20201212]
[MSG:Compiled with ESP32 SDK:v3.2.3-14-gd3e562907]
[MSG:Using machine:Rockwell]
[MSG:Axis count 4]
[MSG:RMT Steps]
[MSG:Init Motors]
[MSG:X  Axis Standard Stepper Step:GPIO(13) Dir:GPIO(12) Disable:GPIO(21) Limits(-500.000,0.000)]
Guru Meditation Error: Core  1 panic'ed (LoadStoreAlignment). Exception was unhandled.
Core 1 register dump:
PC      : 0x4018d1de  PS      : 0x00060630  A0      : 0x800d5b38  A1      : 0x3ffd30b0  
A2      : 0x00000002  A3      : 0x3ffc5cac  A4      : 0x00000002  A5      : 0x00000000  
A6      : 0x3ff56000  A7      : 0x00000000  A8      : 0x00000006  A9      : 0x3ff56000  
A10     : 0x00000000  A11     : 0x00000000  A12     : 0x00000002  A13     : 0x00000000  
A14     : 0x00060420  A15     : 0x00000000  SAR     : 0x00000015  EXCCAUSE: 0x00000009  
EXCVADDR: 0x3ff56006  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xffffffe6  

Backtrace: 0x4018d1de:0x3ffd30b0 0x400d5b35:0x3ffd30e0 0x400d5b49:0x3ffd3100 0x4021e825:0x3ffd3120 0x400d561a:0x3ffd3140 0x400d4435:0x3ffd3160 0x400d2c53:0x3ffd3180 0x400fa1c3:0x3ffd31a0 0x400902ed:0x3ffd31c0
  #0  0x4018d1de:0x3ffd30b0 in rmt_fill_tx_items at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/driver/rmt.c:519
  #1  0x400d5b35:0x3ffd30e0 in Motors::StandardStepper::init_step_dir_pins() at Grbl_Esp32/src/Motors/StandardStepper.cpp:92
  #2  0x400d5b49:0x3ffd3100 in Motors::StandardStepper::read_settings() at Grbl_Esp32/src/Motors/StandardStepper.cpp:52
  #3  0x4021e825:0x3ffd3120 in Motors::StandardStepper::init() at Grbl_Esp32/src/Motors/StandardStepper.cpp:47
  #4  0x400d561a:0x3ffd3140 in init_motors() at Grbl_Esp32/src/Motors/Motors.cpp:410 (discriminator 3)
  #5  0x400d4435:0x3ffd3160 in grbl_init() at Grbl_Esp32/src/Grbl.cpp:42
  #6  0x400d2c53:0x3ffd3180 in setup() at Grbl_Esp32/Grbl_Esp32.ino:28
  #7  0x400fa1c3:0x3ffd31a0 in loopTask(void*) at /home/chris/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:14
  #8  0x400902ed:0x3ffd31c0 in vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)

这是配置文件

  • 您可以通过注释/取消注释来测试引脚 D11 是否作为步进引脚
  • 还有一行成功地将 D11 用作步进器 (dis),在配置中启用了一点
#pragma once
// clang-format off

/*
    template.h
    Part of Grbl_ESP32

    Template for a machine configuration file.

    2020    - Mitch Bradley
    2021    - Chris Rowse
    
    This is built for a 4 channel driver XYZZ
    
    It is built on Veroboard to the simplest pinout possible
    
    Side 1 - Goes to a 20 pin IDC connectors
           - the Even number pins are all brought to ground
           - The odd number pins are used in sequence other than D34 D35 which are inputs
           -   The top two pins are connected to D19,D21
     
     Endstops - wires Earth, 3v3, Signal to conform to Servo wiring, 
              - WIRING IS NOT RAMPS as 3V3 and Gnd are swapped
           - D35 and D34 (Input only) go to end stops
           - D22 D23 are also endstops 
           - Limit pins plled upvia 3K3 with 10nF to ground
           
    Side 2 - Tx0 Rx0 are left free
           - D15, D2, D4, Rx2 Tx2  Go to a 10 way IDC connector.
           - THis can be usecd for inter processor comms or for another Stepper/Spindle
           - D5 D10 are not yet wired, they can be re-routed to 10 pin to free up TX2Rx2 
           
           
  // *********************************************************************************  

    Grbl_ESP32 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_ESP32.  If not, see <http://www.gnu.org/licenses/>.
*/

// This contains a long list of things that might possibly be
// configured.  Most machines - especially simple cartesian machines
// that use stepper motors - will only need to define a few of the
// options herein, often just the pin assignments.

// Pin assignments depend on how the ESP32 is connected to
// the external machine.  Typically the ESP32 module plugs into
// an adapter board that wires specific ESP32 GPIO pins to
// other connectors on the board, such as Pololu sockets for
// stepper drivers or connectors for external drivers, limit
// pins, spindle control, etc.  This file describes how those
// GPIO pins are wired to those other connectors.

// Some machines might choose to use an adapter board in a
// non-standard way, for example a 3-axis board might have axes
// labeled XYZ, but the machine might have only 2 axes one of which is
// driven by two ganged motors.  In that case, you would need
// a custom version of this file that assigns the pins differently
// from the adapter board labels.

// In addition to pin assignments, many other aspects of Grbl
// can be configured, such as spindle speeds, special motor
// types like servos and unipolars, homing order, default values
// for $$ settings, etc.  A detailed list of such options is
// given below.

// Furthermore, it is possible to implement special complex
// behavior in custom C++ code, for non-Cartesian machines,
// unusual homing cycles, etc.  See the Special Features section
// below for additional instructions.

// === Machine Name
// Change TEMPLATE to some name of your own choosing.  That name
// will be shown in a Grbl startup message to identify your
// configuration.

#define MACHINE_NAME            "Rockwell"

// If your machine requires custom code as described below in
// Special Features, you must copy Custom/custom_code_template.cpp
// to a new name like Custom/my_custom_code.cpp, implement the
// functions therein, and enable its use by defining:
// #define CUSTOM_CODE_FILENAME "Custom/my_custom_code.cpp"

// === Number of axes

// You can set the number of axes that the machine supports
// by defining N_AXIS.  If you do not define it, 3 will be
// used.  The value must be at least 3, even if your machine
// has fewer axes.
// #define N_AXIS 4


// == Pin Assignments

// Step and direction pins; these must be output-capable pins,
// specifically ESP32 GPIO numbers 0..31

 // try some alternate pins to avoid RMT problems ...
 #define X_STEP_PIN              GPIO_NUM_13
 #define X_DIRECTION_PIN         GPIO_NUM_12
 
 // Using  pin (11  breaks us on RMT during Steppers.init
 //       Looks like we cannot use pin 11 for stepper pulses

 #define Y_STEP_PIN              GPIO_NUM_11
//#define Y_STEP_PIN              GPIO_NUM_33
#define Y_DIRECTION_PIN         GPIO_NUM_32

#define Z_STEP_PIN              GPIO_NUM_26
#define Z_DIRECTION_PIN         GPIO_NUM_25


#define Z2_STEP_PIN              GPIO_NUM_5
#define Z2_DIRECTION_PIN         GPIO_NUM_4 
 
#define X_LIMIT_PIN             GPIO_NUM_35
#define Y_LIMIT_PIN             GPIO_NUM_34
#define Z_LIMIT_PIN             GPIO_NUM_22

#define PROBE_PIN            GPIO_NUM_23
#define Z2_LIMIT_PIN            GPIO_NUM_10 // or 15??

// Common enable for all steppers.  If it is okay to leave
// your drivers enabled at all times, you can leave
// STEPPERS_DISABLE_PIN undefined and use the pin for something else.
//#define STEPPERS_DISABLE_PIN    GPIO_NUM_10

// For this to work we need to supply power per our other boards
// a quick workaround provide bias and debounce on the board
// we will need to decouple the input with a capacitor
// #define STEPPERS_DISABLE_PIN    GPIO_NUM_19

#define X_DISABLE_PIN GPIO_NUM_21
#define y_DISABLE_PIN GPIO_NUM_19
// You can uncomment next line and use D11 as a disable pin, this works
//#define Z_DISABLE_PIN GPIO_NUM_11    // try either pin 11 or 27
#define Z2_DISABLE_PIN GPIO_NUM_2

// Pins for controlling various aspects of the machine.  If your
// machine does not support one of these features, you can leave
// the corresponding pin undefined.

// #define SPINDLE_OUTPUT_PIN         GPIO_NUM_2   // labeled SpinPWM
// #define SPINDLE_ENABLE_PIN      GPIO_NUM_22  // labeled SpinEnbl
// #define COOLANT_MIST_PIN        GPIO_NUM_21  // labeled Mist
// #define COOLANT_FLOOD_PIN       GPIO_NUM_25  // labeled Flood
// #define PROBE_PIN               GPIO_NUM_23  // labeled Probe

// Input pins for various functions.  If the corresponding pin is not defined,
// the function will not be available.

// CONTROL_SAFETY_DOOR_PIN shuts off the machine when a door is opened
// or some other unsafe condition exists.
// #define CONTROL_SAFETY_DOOR_PIN GPIO_NUM_35  // labeled Door,  needs external pullup

// RESET, FEED_HOLD, and CYCLE_START can control GCode execution at
// the push of a button.

// #define CONTROL_RESET_PIN       GPIO_NUM_34  // labeled Reset, needs external pullup
// #define CONTROL_FEED_HOLD_PIN   GPIO_NUM_36  // labeled Hold,  needs external pullup
// #define CONTROL_CYCLE_START_PIN GPIO_NUM_39  // labeled Start, needs external pullup

// === Ganging
// If you need to use two motors on one axis, you can "gang" the motors by
// defining a second pin to control the other motor on the axis.  For example:

// #define Y2_STEP_PIN             GPIO_NUM_27  /* labeled Z */
// #define Y2_DIRECTION_PIN        GPIO_NUM_33  /* labeled Z */

// === Servos
// To use a servo motor on an axis, do not define step and direction
// pins for that axis, but instead include a block like this:

// #define SERVO_Z_PIN             GPIO_NUM_22

// === Homing cycles
// Set them using $Homing/Cycle0= optionally up to $Homing/Cycle5=
// HOMING_CYCLE0 = Z
// HOMING_CYCLE1 = XY
//#define DEFAULT_HOMING_CYCLE_0 bit(Z_AXIS)
//#define DEFAULT_HOMING_CYCLE_1 (bit(X_AXIS) | bit(Y_AXIS))

#define HOMING_CYCLE0 = Z
#define HOMING_CYCLE1 = XY


// === Default settings
// Grbl has many run-time settings that the user can changed by
// commands like $110=2000 .  Their values are stored in non-volatile
// storage so they persist after the controller has been powered down.
// Those settings have default values that are used if the user
// has not altered them, or if the settings are explicitly reset
// to the default values wth $RST=$.
//
// The default values are established in defaults.h, but you
// can override any one of them by definining it here, for example:

//#define DEFAULT_INVERT_LIMIT_PINS 1
//#define DEFAULT_REPORT_INCHES 1

// === Control Pins

// If some of the control pin switches are normally closed
// (the default is normally open), you can invert some of them
// with INVERT_CONTROL_PIN_MASK.  The bits in the mask are
// Cycle Start, Feed Hold, Reset, Safety Door.  To use a
// normally open switch on Reset, you would say
// #define INVERT_CONTROL_PIN_MASK B1101

// If your control pins do not have adequate hardware signal
// conditioning, you can define these to use software to
// reduce false triggering.
// #define ENABLE_CONTROL_SW_DEBOUNCE // Default disabled. Uncomment to enable.
// #define CONTROL_SW_DEBOUNCE_PERIOD 32 // in milliseconds default 32 microseconds


// Grbl_ESP32 use the ESP32's special RMT (IR remote control) hardware
// engine to achieve more precise high step rates than can be done
// in software.  That feature is enabled by default, but there are
// some machines that might not want to use it, such as machines that
// do not use ordinary stepper motors.  To turn it off, do this:
// #undef USE_RMT_STEPS

// === Special Features
// Grbl_ESP32 can support non-Cartesian machines and some other
// scenarios that cannot be handled by choosing from a set of
// predefined selections.  Instead they require machine-specific
// C++ code functions.  There are callouts in the core code for
// such code, guarded by ifdefs that enable calling the individual
// functions.  custom_code_template.cpp describes the functions
// that you can implement.  The ifdef guards are described below:
//
// USE_CUSTOM_HOMING enables the user_defined_homing(uint8_t cycle_mask) function
// that can implement an arbitrary homing sequence.
// #define USE_CUSTOM_HOMING

// USE_KINEMATICS enables the functions inverse_kinematics(),
// kinematics_pre_homing(), and kinematics_post_homing(),
// so non-Cartesian machines can be implemented.
// #define USE_KINEMATICS

// USE_FWD_KINEMATICS enables the forward_kinematics() function
// that converts motor positions in non-Cartesian coordinate
// systems back to Cartesian form, for status reports.
//#define USE_FWD_KINEMATICS

// USE_TOOL_CHANGE enables the user_tool_change() function
// that implements custom tool change procedures.
// #define USE_TOOL_CHANGE

// Any one of MACRO_BUTTON_0_PIN, MACRO_BUTTON_1_PIN, and MACRO_BUTTON_2_PIN
// enables the user_defined_macro(number) function which
// implements custom behavior at the press of a button
// #define MACRO_BUTTON_0_PIN

// USE_M30 enables the user_m30() function which implements
// custom behavior when a GCode programs stops at the end
// #define USE_M30

// USE_TRIAMINIC enables a suite of functions that are defined
// in grbl_triaminic.cpp, allowing the use of Triaminic stepper
// drivers that require software configuration at startup.
// There are several options that control the details of such
// drivers; inspect the code in grbl_triaminic.cpp to see them.
// #define USE_TRIAMINIC
// #define X_TRIAMINIC
// #define X_DRIVER_TMC2209
// #define TRIAMINIC_DAISY_CHAIN

// USE_MACHINE_TRINAMIC_INIT enables the machine_triaminic_setup()
// function that replaces the normal setup of Triaminic drivers.
// It could, for, example, setup StallGuard or other special modes.
// #define USE_MACHINE_TRINAMIC_INIT


// === Grbl behavior options
// There are quite a few options that control aspects of Grbl that
// are not specific to particular machines.  They are listed and
// described in config.h after it includes the file machine.h.
// Normally you would not need to change them, but if you do,
// it will be necessary to make the change in config.h
// these are in defaults.h

#define DEFAULT_HOMING_DIR_MASK  (4|8)   // $23 move positive dir Z, negative X,Y

#define DEFAULT_HOMING_FEED_RATE 60.0  // $24 mm/min
#define DEFAULT_HOMING_SEEK_RATE 120.0  // $25 mm/min
#define DEFAULT_HOMING_PULLOFF 5.0  // $27 mm

// set motrors to 12800 steps /rev
#define DEFAULT_X_STEPS_PER_MM 4266.667 
#define DEFAULT_Y_STEPS_PER_MM 4266.667
#define DEFAULT_Z_STEPS_PER_MM 4266.667
#define DEFAULT_Z2_STEPS_PER_MM 4266.667


#define DEFAULT_X_MAX_RATE 1500.0  // mm/min
#define DEFAULT_Y_MAX_RATE 1500.0  // mm/min
#define DEFAULT_Z_MAX_RATE 1200.0  // mm/min

// ============== Axis Acceleration =========
#define DEFAULT_X_ACCELERATION 200.0
#define DEFAULT_Y_ACCELERATION 200.0
#define DEFAULT_Z_ACCELERATION 200.0

// ========= AXIS MAX TRAVEL ============

#define DEFAULT_X_MAX_TRAVEL 500.0  // $130 mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 300.0  // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 180.0  // mm NOTE: Must be a positive value.
带 RMT 的 ESP32D0WDQ6 上的引脚 D11 不能用作步进引脚 #736 shorai 添加了 漏洞 有些东西不工作标签 2021 年 1 月 12 日
带 RMT 的 ESP32D0WDQ6 上的引脚 D11 不能用作步进引脚 #736
贡献者

请注意https://github.com/bdring/Grbl_Esp32/wiki/Setting-Up-the-IO-Pins建议不要使用 GPIO_NUM_11 和许多其他 GPIO,因为它们用于其他目的。

带 RMT 的 ESP32D0WDQ6 上的引脚 D11 不能用作步进引脚 #736

关闭,因为这是硬件的已知限制。感谢您提供详细信息。

带 RMT 的 ESP32D0WDQ6 上的引脚 D11 不能用作步进引脚 #736
作者
翔来 评论了 2021 年 1 月 13 日 通过电子邮件
带 RMT 的 ESP32D0WDQ6 上的引脚 D11 不能用作步进引脚 #736  添加 阅读维基 并删除 漏洞 有些东西不工作标签 2021 年 1 月 15 日
喜欢 (0)