[Grbl_Esp32 Issue#736] Pin D11 unusable as step pin on ESP32D0WDQ6 with RMT

未分类 bolang 6个月前 (10-14) 62次浏览

Issue #736 | 状态: 已关闭 | 作者: shorai | 创建时间: 2021-01-12

标签: Read The Wiki


Description

– When using pin D11 as a step pulse pin the firmware fails on startup with a repeated reboot.
– When the step function is reassigned to another pin, the firmware works perfectly.
– Pin D11 can be used for other functions, in which case the firmware works correctly.
– The unavailability of Pin 11 for RMT may be an undocumented feature of ESP32

I found some reference to someone unable to use RMT with more than one channel.(not the case)
Perhaps they unknowingly stumbled into this or a similar problem and were unable to resolve it.

Priority
Low, an immediate workaround exists – avoid D11 as a step pulse pin.

What version of the firmware are you using?

[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]
`
The modules are from Banggood ESP-wroom-32
Under Arduino the ESP modules identify as
`
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
`

Is the problem repeatable?
- The problem is repeatable and tested on two different ESP modules
- It can be tested on a bare board without connections to a physical machine
- It is repeatable under Arduino 1.8.13
arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-80-g6c4433a-5.2.0/
and PIO latest release downloaded 11 January 2021
[MSG:Compiled with ESP32 SDK:v3.2.3-14-gd3e562907]
- I had the same problem with 3 axis configuration

Under what conditions does the bug occur?
Startup

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

rst:0xc (SWCPURESET),boot:0x13 (SPIFASTFLASH_BOOT)
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: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 rmtfilltx_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::initstepdirpins() at GrblEsp32/src/Motors/StandardStepper.cpp:92
#2 0x400d5b49:0x3ffd3100 in Motors::StandardStepper::readsettings() at GrblEsp32/src/Motors/StandardStepper.cpp:52
#3 0x4021e825:0x3ffd3120 in Motors::StandardStepper::init() at Grbl_Esp32/src/Motors/StandardStepper.cpp:47
#4 0x400d561a:0x3ffd3140 in initmotors() at GrblEsp32/src/Motors/Motors.cpp:410 (discriminator 3)
#5 0x400d4435:0x3ffd3160 in grblinit() at GrblEsp32/src/Grbl.cpp:42
#6 0x400d2c53:0x3ffd3180 in setup() at GrblEsp32/GrblEsp32.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)
`
Here is the config file
- You can test pin D11 as a stepper pin or not by commenting/uncommenting
- There is also a line that successfully uses D11 as a stepper (dis) enable a bit lower in the config

`C++
#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 .
*/

// 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/customcodetemplate.cpp
// to a new name like Custom/mycustomcode.cpp, implement the
// functions therein, and enable its use by defining:
// #define CUSTOMCODEFILENAME "Custom/mycustomcode.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 XSTEPPIN GPIONUM13
#define XDIRECTIONPIN GPIONUM12

// Using pin (11 breaks us on RMT during Steppers.init
// Looks like we cannot use pin 11 for stepper pulses

#define YSTEPPIN GPIONUM11
//#define YSTEPPIN GPIONUM33
#define YDIRECTIONPIN GPIONUM32

#define ZSTEPPIN GPIONUM26
#define ZDIRECTIONPIN GPIONUM25

#define Z2STEPPIN GPIONUM5
#define Z2DIRECTIONPIN GPIONUM4

#define XLIMITPIN GPIONUM35
#define YLIMITPIN GPIONUM34
#define ZLIMITPIN GPIONUM22

#define PROBEPIN GPIONUM_23
#define Z2LIMITPIN GPIONUM10 // or 15??

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

// 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 STEPPERSDISABLEPIN GPIONUM19

#define XDISABLEPIN GPIONUM21
#define yDISABLEPIN GPIONUM19
// You can uncomment next line and use D11 as a disable pin, this works
//#define ZDISABLEPIN GPIONUM11 // try either pin 11 or 27
#define Z2DISABLEPIN GPIONUM2

// 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 SPINDLEOUTPUTPIN GPIONUM2 // labeled SpinPWM
// #define SPINDLEENABLEPIN GPIONUM22 // labeled SpinEnbl
// #define COOLANTMISTPIN GPIONUM21 // labeled Mist
// #define COOLANTFLOODPIN GPIONUM25 // labeled Flood
// #define PROBEPIN GPIONUM_23 // labeled Probe

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

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

// RESET, FEEDHOLD, and CYCLESTART can control GCode execution at
// the push of a button.

// #define CONTROLRESETPIN GPIONUM34 // labeled Reset, needs external pullup
// #define CONTROLFEEDHOLDPIN GPIONUM_36 // labeled Hold, needs external pullup
// #define CONTROLCYCLESTARTPIN GPIONUM_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 Y2STEPPIN GPIONUM27 / labeled Z /
// #define Y2DIRECTIONPIN GPIONUM33 / 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 SERVOZPIN GPIONUM22

// === Homing cycles
// Set them using $Homing/Cycle0= optionally up to $Homing/Cycle5=
// HOMING_CYCLE0 = Z
// HOMING_CYCLE1 = XY
//#define DEFAULTHOMINGCYCLE0 bit(ZAXIS)
//#define DEFAULTHOMINGCYCLE1 (bit(XAXIS) | 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 DEFAULTINVERTLIMIT_PINS 1
//#define DEFAULTREPORTINCHES 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 INVERTCONTROLPIN_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 INVERTCONTROLPIN_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 ENABLECONTROLSW_DEBOUNCE // Default disabled. Uncomment to enable.
// #define CONTROLSWDEBOUNCE_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 USERMTSTEPS

// === 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. customcodetemplate.cpp describes the functions
// that you can implement. The ifdef guards are described below:
//
// USECUSTOMHOMING enables the userdefinedhoming(uint8t cyclemask) function
// that can implement an arbitrary homing sequence.
// #define USECUSTOMHOMING

// USEKINEMATICS enables the functions inversekinematics(),
// kinematicsprehoming(), and kinematicsposthoming(),
// so non-Cartesian machines can be implemented.
// #define USE_KINEMATICS

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

// USETOOLCHANGE enables the usertoolchange() function
// that implements custom tool change procedures.
// #define USETOOLCHANGE

// Any one of MACROBUTTON0PIN, MACROBUTTON1PIN, and MACROBUTTON2_PIN
// enables the userdefinedmacro(number) function which
// implements custom behavior at the press of a button
// #define MACROBUTTON0_PIN

// USEM30 enables the userm30() 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 XDRIVERTMC2209
// #define TRIAMINICDAISYCHAIN

// USEMACHINETRINAMICINIT enables the machinetriaminic_setup()
// function that replaces the normal setup of Triaminic drivers.
// It could, for, example, setup StallGuard or other special modes.
// #define USEMACHINETRINAMIC_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 DEFAULTHOMINGDIR_MASK (4|8) // $23 move positive dir Z, negative X,Y

#define DEFAULTHOMINGFEED_RATE 60.0 // $24 mm/min
#define DEFAULTHOMINGSEEK_RATE 120.0 // $25 mm/min
#define DEFAULTHOMINGPULLOFF 5.0 // $27 mm

// set motrors to 12800 steps /rev
#define DEFAULTXSTEPSPERMM 4266.667
#define DEFAULTYSTEPSPERMM 4266.667
#define DEFAULTZSTEPSPERMM 4266.667
#define DEFAULTZ2STEPSPERMM 4266.667

#define DEFAULTXMAX_RATE 1500.0 // mm/min
#define DEFAULTYMAX_RATE 1500.0 // mm/min
#define DEFAULTZMAX_RATE 1200.0 // mm/min

// ============== Axis Acceleration =========
#define DEFAULTXACCELERATION 200.0
#define DEFAULTYACCELERATION 200.0
#define DEFAULTZACCELERATION 200.0

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

#define DEFAULTXMAX_TRAVEL 500.0 // $130 mm NOTE: Must be a positive value.
#define DEFAULTYMAX_TRAVEL 300.0 // mm NOTE: Must be a positive value.
#define DEFAULTZMAX_TRAVEL 180.0 // mm NOTE: Must be a positive value.


评论 (3)

#1 – rafl 于 2021-01-12

Note how https://github.com/bdring/GrblEsp32/wiki/Setting-Up-the-I-O-Pins suggest to not use GPIONUM_11 and a number of other GPIOs because of their use for other purposes.


#2 – MitchBradley 于 2021-01-12

Closing since this is a known restriction of the hardware. Thanks for providing the detailed information.


#3 – shorai 于 2021-01-12

Thanks for the quick response.

Apologies for having missed that document.

On Tue, 12 Jan 2021 at 19:17, Mitch Bradley
wrote:

> Closing since this is a known restriction of the hardware. Thanks for
> providing the detailed information.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/bdring/Grbl_Esp32/issues/736#issuecomment-758809314>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAZD3HF32CJBZKGTMUO7UVLSZR7ZZANCNFSM4V7GERUA>
> .
>


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

喜欢 (0)