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

Prevent full UART TX buffer from hanging processor #262

Merged
merged 1 commit into from
Jan 25, 2018

Conversation

sandeepmistry
Copy link
Contributor

Similar to #260, but with additional checks.

When UART::write(b) is called and the TX buffer is full it will now manually call the DRE IRQ handler if:

  • interrupts are currently disabled
    or
  • the current IRQ (exception number) has a higher or equal priority than the SERCOM IRQ

…riority ISR

When write is called and TX buffer is full.
@ArduinoBot
Copy link

✅ Build completed.

⬇️ Build URL: http://downloads.arduino.cc/PR/samd/package_samd-b167_index.json

ℹ️ To test this build:

  1. Open the Preferences of the Arduino IDE.
  2. Add the Build URL above in the Additional Boards Manager URLs field, and click OK.
  3. Open the Boards Manager (menu Tools->Board->Board Manager...)
  4. Install Arduino SAMD core - Pull Request Prevent full UART TX buffer from hanging processor #262
  5. Select one of the boards under SAMD Pull Request Prevent full UART TX buffer from hanging processor #262 in Tools->Board menu
  6. Compile/Upload as usual

@sandeepmistry
Copy link
Contributor Author

Tested with the following sketch:

void setup() {
  Serial.begin(9600);
  while (!Serial);

  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(2, INPUT_PULLUP);
  attachInterrupt(2, onPin2Change, CHANGE);
}

void loop() {
  Serial.println(millis());

  delay(1000);
}

void onPin2Change() {
  digitalWrite(LED_BUILTIN, digitalRead(2));


  Serial.println("onPin4Change1");
  Serial.println("onPin4Change2");
  Serial.println("onPin4Change3");
  Serial.println("onPin4Change4");
  Serial.println("onPin4Change5");
  Serial.println("onPin4Change6");
  Serial.println("onPin4Change7");
  Serial.println("onPin4Change8");
  Serial.println("onPin4Change9");
  Serial.println("onPin4Change0");
  Serial.println("onPin4Change1");
  Serial.println("onPin4Change2");
  Serial.println("onPin4Change3");
  Serial.println("onPin4Change4");
  Serial.println("onPin4Change5");
  Serial.println("onPin4Change6");
  Serial.println("onPin4Change7");
  Serial.println("onPin4Change8");
  Serial.println("onPin4Change9");
  Serial.println("onPin4Change0");

  Serial.println();
}

@ArduinoBot
Copy link

✅ Build completed.

⬇️ Build URL: http://downloads.arduino.cc/PR/samd/package_samd-b173_index.json

ℹ️ To test this build:

  1. Open the Preferences of the Arduino IDE.
  2. Add the Build URL above in the Additional Boards Manager URLs field, and click OK.
  3. Open the Boards Manager (menu Tools->Board->Board Manager...)
  4. Install Arduino SAMD core - Pull Request Prevent full UART TX buffer from hanging processor #262
  5. Select one of the boards under SAMD Pull Request Prevent full UART TX buffer from hanging processor #262 in Tools->Board menu
  6. Compile/Upload as usual

@sandeepmistry sandeepmistry merged commit a7c33fe into arduino:master Jan 25, 2018
@sandeepmistry sandeepmistry added this to the Release 1.6.18 milestone Jan 25, 2018
boseji pushed a commit to go-ut/combined-ArduinoCore-samd that referenced this pull request Nov 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants