Hi,
I'm trying to switch Teensy 4.0 serials into single-wire mode but it doesn't quite work for me. I'm trying to follow the i.MX RT1060 Processor Reference Manual and do the following:
First I initialize Serial port 1 normally
then I switch the port into single-wire operation but setting the LOOPS and RSRC flags of the Serial 1 (UART6) CTRL register
finally I switch the port into receive mode by making sure the TXDIR flag of the same CTRL register is cleared
Then I connect the TX pin of Serial1 to TX pin of Serial2 and send some data in the loop from Serial2. Unfortunately none of that is received by Serial1.
Am I missing something?
Here is the complete code I use
I'm using Arduino 1.8.10 and Teensyduino 1.48
I'm trying to switch Teensy 4.0 serials into single-wire mode but it doesn't quite work for me. I'm trying to follow the i.MX RT1060 Processor Reference Manual and do the following:
First I initialize Serial port 1 normally
Code:
Serial1.begin(57600);
then I switch the port into single-wire operation but setting the LOOPS and RSRC flags of the Serial 1 (UART6) CTRL register
Code:
LPUART6_CTRL |= (LPUART_CTRL_LOOPS | LPUART_CTRL_RSRC);
Code:
LPUART6_CTRL &= ~LPUART_CTRL_TXDIR;
Then I connect the TX pin of Serial1 to TX pin of Serial2 and send some data in the loop from Serial2. Unfortunately none of that is received by Serial1.
Am I missing something?
Here is the complete code I use
Code:
void setup() {
Serial.begin(115200);
Serial1.begin(57600);
LPUART6_CTRL |= (LPUART_CTRL_LOOPS | LPUART_CTRL_RSRC);
LPUART6_CTRL &= ~LPUART_CTRL_TXDIR;
Serial2.begin(57600);
Serial.println("Teensy 4.0 Single-Wire Serial Test");
}
void loop() {
Serial2.write(0x02);
if(Serial1.available()) Serial.println(Serial1.read(), HEX);
}
I'm using Arduino 1.8.10 and Teensyduino 1.48