Skip to content

Conversation

@sandeepmistry
Copy link
Contributor

Inspired by #341.

@arduino arduino deleted a comment from ArduinoBot Aug 17, 2018
@ArduinoBot
Copy link

✅ Build completed.

⬇️ Build URL: http://downloads.arduino.cc/PR/samd/package_samd-b196_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 UART frame error handling #349
  5. Select one of the boards under SAMD Pull Request UART frame error handling #349 in Tools->Board menu
  6. Compile/Upload as usual

@sandeepmistry
Copy link
Contributor Author

Tested with the following sketch from @cmaglie:

unsigned int baud = 4800;
unsigned int delta = 1000000 / baud;

void setup() {
  pinMode(6, OUTPUT);
  digitalWrite(6, HIGH);
  Serial.begin(9600);
  while (!Serial);
  Serial1.begin(baud);
  delay(100);

  Serial.println("Starting");
  for (int l=20; l<51; l++) {
    Serial.print(l);
    Serial.print(" ");
    frame(l);
    delay(1);
    send(0x66);
    send(0x88);
    delay(10);
    dump();
  }
}

void loop() {
}

void dump() {
  Serial.print("RX> ");
  while (Serial1.available()) {
    char c = Serial1.read();
    Serial.print((int)c, HEX);
    Serial.print(" ");
  }
  Serial.println();
}

void d() {
  delayMicroseconds(delta);
}

void send(byte data) {
  digitalWrite(6, LOW); // START
  d();
  digitalWrite(6, data & 0x01); // 1
  d();
  digitalWrite(6, data & 0x02); // 1
  d();
  digitalWrite(6, data & 0x04); // 1
  d();
  digitalWrite(6, data & 0x08); // 1
  d();
  digitalWrite(6, data & 0x10); // 1
  d();
  digitalWrite(6, data & 0x20); // 1
  d();
  digitalWrite(6, data & 0x40); // 1
  d();
  digitalWrite(6, data & 0x80); // 1
  d();
  digitalWrite(6, HIGH); // STOP
  d();
}

void frame(int l) {
  digitalWrite(6, LOW);
  for (int i=0; i<l; i++) d();
  digitalWrite(6, HIGH);
  d();
}

@arduino arduino deleted a comment from ArduinoBot Aug 17, 2018
@sandeepmistry sandeepmistry merged commit a62ef26 into arduino:master Aug 17, 2018
@sandeepmistry sandeepmistry added this to the Release 1.6.20 milestone Aug 17, 2018
@cmaglie cmaglie deleted the uart-frame-error branch August 19, 2018 20:57
sabas1080 added a commit to ElectronicCats/ArduinoCore-samd that referenced this pull request Jul 24, 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.

3 participants