Skip to content

Make HardwareSerial::write(buf, len) non-blocking #529

@gicking

Description

@gicking

Serial1.write(buf, len) (HardwareSerial) is blocking on Arduino Uno R4 Minima.

I kindly propose as a feature request that it be made non-blocking.

Here is the used sketch:

uint8_t Tx[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09};

void setup() {
  pinMode(4, OUTPUT);
  Serial1.begin(19200);
}

void loop() {
  
  // send 10B
  Serial1.write(Tx, 10);
  
  // wait while toggling pin
  uint32_t tStart = millis();
  while (millis() - tStart < 200)
    digitalWrite(4, !digitalRead(4));
}

and the measurement of the test pin:

Image

Additional context

Serial.write() is non-blocking even on the old 8-bit AVRs w/o DMA.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: enhancementProposed improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions