-
Notifications
You must be signed in to change notification settings - Fork 517
attachInterrupt vs. SoftDevice #171
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Ah yeah, it is mentioned multiple times in the forum. Bluefruit.begin() enable sd, which will affect the vector table in some ways. Some irq may not work if called before that. We haven't looked into the details to resolve this, maybe later when we got more free time. |
Nenik
added a commit
to Nenik/Adafruit_nRF52_Arduino
that referenced
this issue
Sep 1, 2018
Nordic SoftDevice needs to have control over lowest priority interrupts for reliable, timing sensitive operation. If user code tries to use such a low priority level, SoftDevice refuses to start. One way to overcome this limitation is to start the SoftDevice before attaching pin change interrupts, though in such a case, SD will cap the effective priority of the user interrupt anyway and it is a common mistake API users do. This change simply changes the priority to 2, which is legal (for fast interrupt handlers anyway) under SoftDevice, no matter if attached before of after SD start.
Nenik
added a commit
to Nenik/Adafruit_nRF52_Arduino
that referenced
this issue
Sep 1, 2018
Nordic SoftDevice needs to have control over lowest priority interrupts for reliable, timing sensitive operation. If user code tries to use such a low priority level, SoftDevice refuses to start. One way to overcome this limitation is to start the SoftDevice before attaching pin change interrupts, though in such a case, SD will cap the effective priority of the user interrupt anyway and it is a common mistake API users do. This change simply changes the priority to 2, which is legal (for fast interrupt handlers anyway) under SoftDevice, no matter if attached before of after SD start.
Pull request: #179 |
hathach
added a commit
that referenced
this issue
Sep 5, 2018
Fix upstream issue #171: Better choice of pin interrupt priority
thanks for PR, this should be fixed already. |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
I have run into an issue when using GPIO interrupts.
If I call attachInterrupt() before Bluefruit.begin(), the Bluefruit.begin() fails with NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION, which I suspect might be related to the interrupt priority used by the attachInterrput() implementation.
Calling Bluefruit.begin() first, the interrupr callback works well.
This would really be worth documenting at least.
But should the change in the interrupt priority fix the issue, that would be even better.
The text was updated successfully, but these errors were encountered: