Disable interrupts 'cli()' crashes

Leoni

New member
Hi,

In this project, I'm using <TaskScheduler.h> which has 3 tasks -
a. Blink the built-in Led
b. Get System Information
c. Display System Information

When cli() is called inside "Get System Information", it will never return control back. Removing this statement at line#120 fixes this crash.

Please advise.

/leon
 

Attachments

  • Task Scheduler Crash.ino
    5.2 KB · Views: 21
Looks like you're using a bunch of stuff that depends on interrupts. Leaving interrupts turned off is a pretty sure way for 1 or more of those things to get stuck.
 
In general its wise to only turn interrupts off for timescales of microseconds, typically as a "critical section" (small amount of code bracketed by cli/sei). You never just turn them off and leave them off as many parts of the system rely on interrupts.

If you want to turn off one particular interrupt handler, that's a rather different matter.
 
Hi Paul and Mark,

Advices well heeled. I now attachInterrupt and detackInterrupt to handle.

Thanxs.
 
Back
Top