Hi,
In sdk5, I use interrupt to wake up device, but the waking up interrupt may be fired in very high frequency, how to avoid problems due to concurrent running?
in callback function, I coded as below, but it doesn't work, I think the "=" operation is not atomic.
if(is_working==0)
{
is_working=1;
...
}
Device:
Hi achao,
I am not sure i understand the question, you want to know how you can prevent an other interrupt executing while the previous one is executed ? can you please give some more details about what you want to do ?
Thanks MT_dialog
我让设备进入deep sleep, while allowing interrupt to wake up it. the interrupt might happen in very high frequency, say there are 20 interrupts at almost the same time. thus, the wake up callback will be called almost 20 times in a very short time.
in above case, I want to only allow one execution of the call back (for the first interrupt, that is why set is_working=1), thus, the second and afters will be prevented and return directly.
by testing, I observed there are still multiple executions of the call back, that is why I am thinking the reason might be due to above codes are not atomic.
Hi achao1104,
Try to disable the wakeup interrupt after call of the ISR happens at the first time. The "=" is not atomic, the assembly command that is being executed maybe is but your code has more that one assembly commands that can be interrupted by an ISR call.
Thanks MT_dialog