esp8266 / esp8266/Arduino

Use of busy-wait inside IRAM_ATTR function: core_esp8266_waveform_pwm.cpp

Open
#7,974 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
16.7k
Forks
13.1k
PR merge metrics
No merged PRs in 30d

Description

@earlephilhower Please check the busy-wait (idle == false)
```
while (pwmState.pwmUpdate) {
if (idle) {
delay(0);
}
MEMBARRIER();
}
```
from `static IRAM_ATTR void _notifyPWM(PWMState *p, bool idle)`
from `IRAM_ATTR bool _stopPWM_weak(uint8_t pin)`

A. This causes a busy wait inside an ISR (#8043).
B. The IRQ for PWM (NMI) does interrupt other ISRs that may be busy-waiting in notifyPWM. OK.
C. Won't any other GPIO interrupt still be blocked by the waiting ISR in A? Therefore, depending on how long PWM needs to clear the ISR in A to continue in `_notifyPWM`, every GPIO IRQ gets delayed? Does this leave room for acceptable responsiveness?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.