-
Notifications
You must be signed in to change notification settings - Fork 433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interupts are not always cleared after soft reset (notably GPIO2) #524
base: master
Are you sure you want to change the base?
Conversation
good catch! |
but the int handler is set and enabled in the next lines: _xt_isr_unmask\ETS_INTR_ENABLE
|
there's gpio interrupt number in the CPU and then there are individual GPIO mode bits for each pin that are configured in mgos_gpio_hal_set_int_mode. all of those need to be set to GPIO_PIN_INTR_DISABLE before soft reset. |
this actually raises a larger issue of the state of other peripherals on soft reset... |
true.
I enabled it with config-set --try-once: I see that pwm for esp8266 uses hardware timer which has some deinit code before restart.
I haven't investigated this any deeper but it looks like some registers are not set up correctly. Maybe there should be a deinit function for each module or the responsible module should register for MGOS_EVENT_REBOOT and do any necessary cleanup. Or there should be explicit code in mgos_system_restart to reset all peripherals before software reset. Maybe there should be two versions of reset available: soft and hard. Other option is to leave it as it is but disable all the interrupts so no to fall into an infinite loop during startup and leave the responsibility of the correct init on the dev.
void esp_restart(void)
|
One more info:
|
I've seen changes in the mongoose os repo but they do not include calling mgos_gpio_hal_clear_int during initialization so I've updated the pull request. |
After a soft reset when there was an int on GPIO2 mcu can fall into infinite loop.
Probably the GPIO2 is triggered because of the second UART - U1TXD which is transmitting data during boot.
The isr is continuously trigger (esp8266_gpio_isr) but not forwarded into upper layers for processing because it's not enabled at the gpio lib level. Booting is halted and processors is reset by the hardware wdt.