Hello,
I have TTGO LoRa32-OLED V1 board and I'm trying to use the UART0 to generate LIN messages. Basically, i'm using the Serial the same way as if I were communicating on RS232, but I need to generate low (dominant) signal for the period of 13 bits. I'm writing the code in Arduino IDE and I'm using a LIN library that works great with ATTiny MCUs.
To generate the serial break, the library uses this piece of code:
Serial.flush();
Serial.end();
pinMode(txPin, OUTPUT);
digitalWrite(txPin, LOW);
delay(/*calculated value for 13bit duration*/);
digitalWrite(txPin, HIGH);
Serial.begin(baudrate);
The serial communication works, but the break is never generated. If I initialize the UART TX pin as a digital output and try to toggle it, it works. But if I initialize the Serial first and then try to use the TX pin as a digital output for a short time as shown above, it doesen't work.
Any ideas?
Thank you!
Generate serial break for LIN functionality
-
- Posts: 1
- Joined: Wed Dec 04, 2019 4:10 pm
Who is online
Users browsing this forum: No registered users and 70 guests