Go Down

Topic: Disabling UART on Due? (Read 3 times) previous topic - next topic

Bi0H4z4rD

#20
Jan 12, 2013, 08:48 pm Last Edit: Jan 12, 2013, 09:19 pm by Bi0H4z4rD Reason: 1
Thanks for the tip stimmer!

I changed it from USART2 to USART1, but still getting exactly the very same thing on the LA.

The weird thing is that it does the "LOW/HIGH" thing before serial printing "123456" for the first time, while that is supposed to go after printing it.


BR

Markus_L811


Trying to do some ISO-9141 (car ECU) communications, and i need to send a 5-baud start sequence which is done with:

Code: [Select]
pinMode(TX0, OUTPUT);
pinMode(RX0, INPUT);

digitalWrite(TX0, HIGH);
....
Serial.begin(10400);


BR

You mean K-Line I think so you have the same Problem I have with L-Line and the USART may you can use an K-Line Transciever and the Lin support from the SAM.

Bi0H4z4rD


stimmer

I can't understand exactly what didn't work with the PIO_PER/PDR approach - I modified your example like this:
Code: [Select]

#define IN    17 //RX2
#define OUT   16 //TX2

void setup(){
  pinMode(0,INPUT);
  pinMode(1,INPUT);
Serial2.begin(115200);
Serial2.print("123456");
delay(1000);

g_APinDescription[IN].pPort -> PIO_PER = g_APinDescription[IN].ulPin;
g_APinDescription[OUT].pPort -> PIO_PER = g_APinDescription[OUT].ulPin;

pinMode(OUT, OUTPUT);
pinMode(IN, INPUT);
delay(1000);
  digitalWrite(OUT, HIGH);
  delay(200);
  digitalWrite(OUT, LOW);
  delay(200);
  digitalWrite(OUT, HIGH);
  delay(200);
  digitalWrite(OUT, LOW);
  delay(1400);

g_APinDescription[IN].pPort -> PIO_PDR = g_APinDescription[IN].ulPin;
g_APinDescription[OUT].pPort -> PIO_PDR = g_APinDescription[OUT].ulPin;


  Serial2.print("123456");
  delay(20);
  Serial2.print("123456");
}

void loop(){}


and connected pin 16 directly to pin 1 (to get output from Serial2 on the serial monitor), and also connected it to an LED. It appears to flash and transmit serial exactly as you'd want.

Bi0H4z4rD

You are totally right stimmer, just checked it with the LA and it works perfectly. I must have done something wrong while trying it.

Big thanks for the help!

BR

Go Up