Skip to content

When enabling interrupts and using clocks, ESP32 runs for 18 seconds and hangs #922

Answered by bjoernQ
yanshay asked this question in Q&A
Discussion options

You must be logged in to vote

Basically hal::xtensa_lx::interrupt::enable() just enables all CPU interrupts (see TRM chapter "2.3.2 CPU Interrupt") which includes interrupts Timer,0, Timer.1, Timer.2 which are CPU internal timers. One of them will wrap/overflow shortly after your counter gets to 18.

Those interrupts are unhandled. There is currently no good way to notice that (while unhandled peripheral interrupts should give you a log message).

But for using interrupts calling hal::xtensa_lx::interrupt::enable() yourself is unnecessary since enable_interrupt will enable the correct interrupt for you.

If I remove the clocks (need to then remove delay as well and its usage) then it works fine.

This wouldn't make sens…

Replies: 5 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by yanshay
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@yanshay
Comment options

@yanshay
Comment options

@bjoernQ
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants