gin66 / FastAccelStepper

A high speed stepper library for Atmega 168/328p (nano), Atmega32u4, Atmega 2560, ESP32, ESP32S2, ESP32S3, ESP32C3 and Atmel SAM Due
MIT License
282 stars 67 forks source link

forceStop() and stopMove() cause esp32 crash #235

Closed ejngnng closed 4 months ago

ejngnng commented 4 months ago

Thanks this project, issue description: When I invoke forceStop or stopMove in ISR, and this cause esp32 crash. Is there any way to stop motor immediately?

Hardware: ESP32-WROOM-32D IDE: vscode + platformIO

code: void IRAM_ATTR ext_isr() { motor->forceStop(); // or motor->stopMove(); }

logs:

`rst:0x1 (POWERON_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:2 load:0x3fff0030,len:1184 load:0x40078000,len:13232 load:0x40080400,len:3028 entry 0x400805e4 E (21) gpio: gpio_set_level(227): GPIO output gpio_num error E (21) gpio: gpio_set_level(227): GPIO output gpio_num error Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.

Core 1 register dump: PC : 0x400d5a2f PS : 0x00060031 A0 : 0x800d3c87 A1 : 0x3ffbf6bc
A2 : 0x00000000 A3 : 0x003fffff A4 : 0x80090158 A5 : 0x3ffb2140
A6 : 0x00000003 A7 : 0x00060a23 A8 : 0x00000001 A9 : 0x0000001f
A10 : 0x007bde64 A11 : 0x003fffff A12 : 0x3ffb2270 A13 : 0x3ffb2250
A14 : 0x00000002 A15 : 0x3ffc3b0c SAR : 0x00000003 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000056 LBEG : 0x4008a8c0 LEND : 0x4008a8cb LCOUNT : 0x00000000

Backtrace: 0x400d5a2c:0x3ffbf6bc |<-CORRUPTED`

ejngnng commented 4 months ago

Sorry, It's my mistake, it's a hardware issue, the GPIO34 is only input, without external pull-up, it's always trigger the interrupt.