0

Serial1.end doesn't end UART on Feather M0
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Serial1.end doesn't end UART on Feather M0

by carl0s on Tue Nov 21, 2017 6:19 pm

Hi.

My code needs to briefly bit-bang the TX pin. However once, Serial1.begin() had happened, it seems the TX pin stays idle high, and the digitalWrite() doesn't work any more.

Code: Select all | TOGGLE FULL SIZE
  Serial.println("Sending init pulse..");
  Serial1.end();
 
  // This is the ISO 14230-2 "Fast Init" sequence.
  digitalWrite(K_OUT, HIGH);
  delay(300);
  Serial.println("about to go low for 25ms");
  digitalWrite(K_OUT, LOW);
  delay(25);
  Serial.println("Going high again");
  digitalWrite(K_OUT, HIGH);
  delay(25);

  Serial1.begin(10400);


So, after the first attempt, it doesn't work any more. I can see on the scope that tx is staying high, and the 25ms low doesn't happen.

I saw some code like this, but this is for an Arduino Duo or something, not the AT SAMD based Feather. Can you offer any ideas?
Code: Select all | TOGGLE FULL SIZE
UCSR0B &= ~(_BV(TXEN0))

carl0s
 
Posts: 13
Joined: Thu Sep 29, 2016 8:38 pm

Re: Serial1.end doesn't end UART on Feather M0

by carl0s on Tue Nov 21, 2017 6:49 pm

I got it...
Code: Select all | TOGGLE FULL SIZE
#include wiring_private.h
  pinPeripheral(K_OUT, PIO_OUTPUT);


:-*

carl0s
 
Posts: 13
Joined: Thu Sep 29, 2016 8:38 pm

Please be positive and constructive with your questions and comments.