Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gen3] fixes hardfault during low level USB peripheral initialization under an atomic section #2448

Merged
merged 1 commit into from May 18, 2022

Conversation

XuGuohui
Copy link
Member

Problem

When logging from ISR is enabled and use the Serial1 as the log interface, device runs into SOS. This is because that SD APIs require SVC interrupt to be enabled, whereas logging from ISR will prehibit the SVC interrupt and device has a chance to call into SD APIs and then hardfault.

Solution

Temporarily increase the BASEPRI value to enable SVC interrupt handling.

Example App

#include "Particle.h"

SYSTEM_MODE(MANUAL);
SYSTEM_THREAD(ENABLED);

Serial1LogHandler log(115200, LOG_LEVEL_ALL);

void setup() {
}

void loop() {
}

References

N/A


Completeness

  • User is totes amazing for contributing!
  • Contributor has signed CLA (Info here)
  • Problem and Solution clearly stated
  • Run unit/integration/application tests on device
  • Added documentation
  • Added to CHANGELOG.md after merging (add links to docs and issues)

@XuGuohui XuGuohui requested a review from avtolstoy April 29, 2022 06:53
@technobly technobly added the bug label Apr 30, 2022
@technobly technobly added this to the 4.0.0 milestone Apr 30, 2022
@technobly technobly changed the title [Gen3] Device runs into hardfault when logging from ISR is enabled [gen3] Device runs into hardfault when logging from ISR is enabled Apr 30, 2022
…from ISR is enabled while using Serial1 as the log interface.
@technobly technobly changed the title [gen3] Device runs into hardfault when logging from ISR is enabled [gen3] fixes hardfault during low level USB peripheral initialization under an atomic section May 18, 2022
@technobly technobly merged commit a6dfdb9 into develop May 18, 2022
@technobly technobly deleted the fix/gen3_log_from_isr branch May 18, 2022 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants