-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Should OTAs disable timer1 interrupts? #1844
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
Comments
And this comment probably explains what is happening: |
You need to mark the ISR with ICACHE_RAM_ATTR. Also if running the ADC during an OTA is not required in your application, you can probably use OTA callback to disable the timer. |
I have put the ISR in RAM, and am poking the SPI and GPIO registers from RAM too (I have pulled the SPI and digitalWrite implementations directly in the sketch). This way everything in the ISR is supposed to run from RAM. Although it's probably not your bug, I'm still getting a WDT reset, with the following stack trace:
After some printf debugging(TM), I traced it to this call: This is the top of the stack trace, that wasn't decoded automatically:
So Wait_SPI_Idle it taking ages and trips the watchdog. Mmh, my ADC is also using SPI, but it's using SPI1 (I'm not sure how you call it), not SPI0 where the flash is, so I'm surprised it would have any impact. I appreciate your help (and your code). Thanks. |
I don't know if there is any interaction between SPI0 and SPI1 that Wait_SPI_Idle doesn't account for. Could you please check if disabling your SPI ADC code makes this issue disappear? |
Strangely enough, a sketch with nothing but OTA code does not make the issue disappear. This makes me believe there may be a HW issue - either power supply (but flash from UART works fine) or flash issues. |
I moved the circuit from a breadboard to the veroboard, with different decoupling caps, and OTAs seem to work now, as I suspected earlier. |
I encountered same problem. It boils down to Arduino SPI calls that are compiled without ICACHE_RAM_ATTR. I copy pasted critical code from Arduino library into my ISR. Ended up with following:
I am updating 'payload' value in 'loop()' code. Works like a champ with no resets and reliable OTA. |
I'm working on a esp8266-based babymonitor. I use timer1 interrupts to sample an external ADC at 12.5kHz.
When attempting to use OTAs, the ESP8266 resets with exception code 0 (theoretically "illegal instruction", but I don't think it's true in this case). Note that the program works perfectly without OTAs.
This is the decoded exception:
This is the isr:
And this is how it is set up:
Am I right in thinking that the OTA updater should disable the timer1 user callback? I have tried to do it and it makes this problem go away, but upon updating the ESP8266 resets after a "Soft WDT reset" message. The stack trace decodes to that:
The text was updated successfully, but these errors were encountered: